diff --git a/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml b/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml index 3770e9d267e..332722e461e 100644 --- a/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml +++ b/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml @@ -1239,6 +1239,18 @@ + + + + receive_timestamp + 0 + + + timestamp_source + ASSUMPTION + + + diff --git a/plc4go/assets/testing/protocols/opcua/DriverTestsuite.xml b/plc4go/assets/testing/protocols/opcua/DriverTestsuite.xml index 09dd484b99f..84fd77de48d 100644 --- a/plc4go/assets/testing/protocols/opcua/DriverTestsuite.xml +++ b/plc4go/assets/testing/protocols/opcua/DriverTestsuite.xml @@ -34,101 +34,2048 @@ + + + + false + false + + + HEL + + F + + 47 + + 0 + + + 65535 + 65535 + 2097152 + 64 + + + + + 15 + opc.test://hurz + + + + + + + + + true + false + + + ACK + + F + + 24 + + 0 + + + 65535 + 65535 + 2097152 + 64 + + + + + + + + + false + false + + + OPN + + F + + 132 + + + + + 0 + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + + + -1 + 0x + + + + + -1 + 0x + + + + + + + + + + 1 + 1 + + + + + + + + false + false + + + + 1 + + + 0 + 446 + + + + + + + + + + + + + + + 0 + + + + 0 + + + 0 + + + + + + 0 + 0 + 0 + + + 0 + + + + 60000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0 + + 0 + + + 1 + + + + -1 + 0x + + + 3600000 + + + + + + + + + + + + + + + + true + false + + + OPN + + F + + 135 + + + + + 1 + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + + + -1 + 0x + + + + + -1 + 0x + + + + + + + + + + 1 + 1 + + + + + + + + false + false + + + + 1 + + + 0 + 449 + + + + + + + + + + + + + 133747673145090000 + 0 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0 + + + + 1 + 1 + 133747673145040000 + 3600000 + + + + + + -1 + 0x + + + + + + + + + + + + + + + + + + false + false + + + MSG + + F + + 310 + + + + 1 + 1 + + + + + + + 2 + 2 + + + + + + + + false + false + + + + 1 + + + 0 + 461 + + + + + + + + + + + + + + + 0 + + + + 0 + + + 0 + + + + + + 0 + 1 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + + + + 23 + urn:apache:plc4x:client + + + + + 23 + urn:apache:plc4x:client + + + + + 0 + true + true + + + 2 + en + + + + + 47 + OPCUA client for the Apache PLC4X:PLC4J project + + + + + + 1 + + + + 0 + + + + + + 0 + + + + 0 + + + + + + + + 0 + + + + + + 15 + opc.test://hurz + + + + + 78 + UaSession:OPCUA client for the Apache PLC4X:PLC4J project:xyz + + + + + -1 + 0x + + + + + -1 + 0x + + + 120000.0 + 0 + + + + + + + + + + + + + + + + true + false + + + MSG + + F + + 6450 + + + + 2 + 2 + + + + + + + 2 + 2 + + + + + + + + false + false + + + + 1 + + + 0 + 464 + + + + + + + + + + + + + 133747673167260000 + 1 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + 0 + + + + 3 + + + 1 + + + 44 + Session:9f4a975a-9f74-43f8-8a01-a0b6cc325cc9 + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 120000.0 + + + 32 + 0x64fc10fa00582aa654f211eec59b9b45972d5663511af8917c8c715e1ed58555 + + + + + 1222 + 0x308204c2308203aaa00302010202060192daaf4928300d06092a864886f70d01010b050030763124302206035504030c1b45636c69707365204d696c6f204578616d706c652053657276657231153013060355040a0c0c6469676974616c7065747269310c300a060355040b0c03646576310f300d06035504070c06466f6c736f6d310b300906035504080c024341310b3009060355040613025553301e170d3234313032393233303030305a170d3237313032393232303030305a30763124302206035504030c1b45636c69707365204d696c6f204578616d706c652053657276657231153013060355040a0c0c6469676974616c7065747269310c300a060355040b0c03646576310f300d06035504070c06466f6c736f6d310b300906035504080c024341310b300906035504061302555330820122300d06092a864886f70d01010105000382010f003082010a0282010100bcf039c878db79487e3ce9571d54858e1b46f76476b7a00a8a7eba602a67c06dc924e52b3c6a78bdb6ba1c948490b21954b116128b61caa2c3b1083a81f8459cd42b34e2f672b7703a1016ab19a97c22056caa3bed70e730fa1c0eb00786b47f05012b5a1d4d3716e34c1da8173c91291194f1b38b7dbfc11581ce7e44d93501d81bed0b4daf0d3a6ebcf71d90443439fd95a3bb0574342d9e2e560cc66311c5c89107fd6c90041bf7f8ad4729c67088931268bb7433b70375fd8f301fecd9a27ef8c41c2657f70554398c91846536026baf8dc5a64a2a096a1c97ca5e534f65122d0e2feb78a3dfcd28770b49afbb9ee3ddd85a6c3bd06f81190ef5b82026730203010001a382015430820150301f0603551d230418301680149b1b32655e707e5045c1c755ff716ece6d28ed8930090603551d1304023000300b0603551d0f0404030202f4301d0603551d250416301406082b0601050507030206082b060105050703013081d60603551d110481ce3081cb864575726e3a65636c697073653a6d696c6f3a6578616d706c65733a7365727665723a37386335666137322d373232342d343338362d613263642d3131636630313036636535658204617263688704ac1600018704ac1900018704ac1b000187040a0b14018704ac1d00018704ac1800018704ac1200018704c0a820018704c0a830018704ac1400018704c0a810018704ac1f00018704ac15000187040a0a14018704ac1c00018704c0a8026a8704ac1a00018704ac1e00018704ac1700018704ac1100018704ac130001301d0603551d0e041604149b1b32655e707e5045c1c755ff716ece6d28ed89300d06092a864886f70d01010b050003820101006222edfffd42ca65cd19509f8f6eacbe1479043a3327ed46804fd70c3652845bb2df9961d3a6befb7e5cc46e7cee139607690558d32bde3eb1f60329ce261d44622c61c3078abc187b9e0597db3572c9ea9dc3ff0b2b9c12f6eedb24d417edf69b0b39af4f7c71c18d8d04b8dd3d92f60d20ae507859dc7a68589dee4fef5fb5e5dd1e1a9239a040ea2efbd67a34a6ff6d61460b3c13ae5dfe00c82bc3367909684e577cb41be709632285bce066bdd8802889eabea425845c4d0b500b9ef6de3f19c787eedb15922161bf05ddcd0fa39a32eea264c738f120099f4cdf8b9e74cf1fa354c9f1cfc21d5d9a87e5923425a8e47ada642327d435ce8e7cc6b99e85 + + + 1 + + + + + + 25 + opc.tcp://hurz + + + + + + + + 69 + urn:eclipse:milo:examples:server:78c5fa72-7224-4386-a2cd-11cf0106ce5e + + + + + -1 + + + + + 0 + false + false + + + + 0 + + + + -1 + + + + + -1 + + + -1 + + + + + + -1 + 0x + + + + 1 + + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + 3 + + + + + + 9 + anonymous + + + + 0 + + + + -1 + + + + + -1 + + + + + -1 + + + + + + + + + 8 + username + + + + 1 + + + + -1 + + + + + -1 + + + + + 51 + http://opcfoundation.org/UA/SecurityPolicy#Basic256 + + + + + + + + + 11 + certificate + + + + 2 + + + + -1 + + + + + -1 + + + + + 51 + http://opcfoundation.org/UA/SecurityPolicy#Basic256 + + + + + + + + 65 + http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary + + + 32 + + + + 0 + + + + + + + + -1 + + + + + -1 + 0x + + + + + + 2097152 + + + + + + + + + + + + + + + + false + false + + + MSG + + F + + 140 + + + + 2 + 2 + + + + + + + 3 + 3 + + + + + + + + false + false + + + + 1 + + + 0 + 467 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 2 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + + + + 0 + + + + + + -1 + 0x + + + + + + -1 + -1 + + + + + false + false + + + + 1 + + + 0 + 321 + + + + + + + + + 0 + false + false + true + + + + 13 + + + + + + 9 + anonymous + + + + + + + + + + + + + + + 0 + + + + + + -1 + 0x + + + + + + + + + + + + + + + + + + + + + true + false + + + MSG + + F + + 96 + + + + 2 + 2 + + + + + + + 3 + 3 + + + + + + + + false + false + + + + 1 + + + 0 + 470 + + + + + + + + + + + + + 133747673167520000 + 2 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + 32 + 0x176c1d0bb34ca7db0a00f71b604d3c06e83930d46e66d8451a6dbe4ab431420b + + + 0 + + + 0 + + + + + + + + + + + + + + + + - Hello Request Response + Read tag - + + + + + + time +
ns=0;i=2258
+
+
+
+
+ + false + false - HEL + MSG F - 47 - - 0 - - - 65535 - 65535 - 2097152 - 64 - - - - - 15 - opc.test://hurz - - - + 131 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 631 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 3 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0.0 + + 2 + + 1 + + + + + + 0 + + + + 2 + + + 0 + 2258 + + + + + + 13 + + + -1 + + + + + 0 + + + -1 + + + + + + + + + + + + + + + + + - + true + false - ACK + MSG F - 24 - - 0 - - - 65535 - 65535 - 2097152 - 64 - - - + 70 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 634 + + + + + + + + + + + + + 133748547148430000 + 3 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + 0 + false + false + false + false + false + true + + + false + false + 13 + + + 133748547148420000 + + + + + + + + + 0 + + + + + + + + + + + + - + + + + + test_int64 +
ns=2;s=HelloWorld/ScalarTypes/Int64;LINT
+ 1 +
+
+
+
+ + false + false - OPN - - F - 132 - 0 - - - 47 - http://opcfoundation.org/UA/SecurityPolicy#None - - - - - -1 - - - - - - - -1 - - - - - 1 - 1 - 0x0100be010000f068ddb096d5d7010000000000000000ffffffff10270000000000000000000000000001000000ffffffff00512502 - + MSG + + F + + 151 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 673 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 3 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + + + + 0 + + + + 3 + + + 2 + + + 28 + HelloWorld/ScalarTypes/Int64 + + + + + + + + 13 + + + -1 + + + + + 0 + false + false + false + false + false + true + + + false + false + 8 + + + 1 + + + + + + + + + + + + + + + + + + + + + ---> + + + + true + false + + + MSG + + F + + 64 + + + + 10 + 10 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 676 + + + + + + + + + + + + + 0 + 3 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ns=2;s=HelloWorld/ScalarTypes/Int64 + Value + LINT + + + + 1 + + + + + + + + + + 1 + + + +
+
diff --git a/plc4go/internal/opcua/EncryptionHandler.go b/plc4go/internal/opcua/EncryptionHandler.go index 771afd3612b..f52e4906256 100644 --- a/plc4go/internal/opcua/EncryptionHandler.go +++ b/plc4go/internal/opcua/EncryptionHandler.go @@ -78,7 +78,7 @@ func (h *EncryptionHandler) encodeMessage(ctx context.Context, pdu readWriteMode numberOfBlocks := preEncryptedLength / PREENCRYPTED_BLOCK_LENGTH encryptedLength := numberOfBlocks*256 + positionFirstBlock buf := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err := readWriteModel.NewOpcuaAPU(pdu, false).SerializeWithWriteBuffer(ctx, buf); err != nil { + if err := readWriteModel.NewOpcuaAPU(pdu, false, true).SerializeWithWriteBuffer(ctx, buf); err != nil { return nil, errors.Wrap(err, "error serializing") } paddingByte := byte(paddingSize) @@ -168,7 +168,7 @@ func (h *EncryptionHandler) decodeMessage(ctx context.Context, pdu readWriteMode } readBuffer := utils.NewReadBufferByteBased(buf.GetBytes(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - return readWriteModel.OpcuaAPUParseWithBuffer(ctx, readBuffer, true) + return readWriteModel.OpcuaAPUParseWithBuffer(ctx, readBuffer, true, true) default: h.log.Trace().Msg("unmapped security policy") return pdu, nil diff --git a/plc4go/internal/opcua/MessageCodec.go b/plc4go/internal/opcua/MessageCodec.go index f161153cd95..e1393d0becb 100644 --- a/plc4go/internal/opcua/MessageCodec.go +++ b/plc4go/internal/opcua/MessageCodec.go @@ -70,7 +70,7 @@ func (m *MessageCodec) Send(message spi.Message) error { opcuaApu, ok := message.(readWriteModel.OpcuaAPU) if !ok { if message, ok := message.(readWriteModel.MessagePDU); ok { - opcuaApu = readWriteModel.NewOpcuaAPU(message, false) + opcuaApu = readWriteModel.NewOpcuaAPU(message, false, true) } else { return errors.Errorf("Invalid message type %T", message) } @@ -124,7 +124,7 @@ func (m *MessageCodec) Receive() (spi.Message, error) { } ctxForModel := options.GetLoggerContextForModel(context.Background(), m.log, options.WithPassLoggerToModel(m.passLogToModel)) rbbb := utils.NewReadBufferByteBased(readBytes, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - opcuaAPU, err := readWriteModel.OpcuaAPUParseWithBuffer(ctxForModel, rbbb, true) + opcuaAPU, err := readWriteModel.OpcuaAPUParseWithBuffer(ctxForModel, rbbb, true, true) if err != nil { return nil, errors.New("Could not parse pdu") } diff --git a/plc4go/internal/opcua/Reader.go b/plc4go/internal/opcua/Reader.go index 902b7454100..114a2367e2f 100644 --- a/plc4go/internal/opcua/Reader.go +++ b/plc4go/internal/opcua/Reader.go @@ -23,7 +23,6 @@ import ( "context" "encoding/binary" "runtime/debug" - "strconv" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -73,7 +72,7 @@ func (m *Reader) readSync(ctx context.Context, readRequest apiModel.PlcReadReque REQUEST_TIMEOUT_LONG, NULL_EXTENSION_OBJECT, ) - readValueArray := make([]readWriteModel.ExtensionObjectDefinition, len(readRequest.GetTagNames())) + readValueArray := make([]readWriteModel.ReadValueId, len(readRequest.GetTagNames())) for i, tagName := range readRequest.GetTagNames() { tag := readRequest.GetTag(tagName).(Tag) @@ -94,35 +93,25 @@ func (m *Reader) readSync(ctx context.Context, readRequest apiModel.PlcReadReque requestHeader, 0.0, readWriteModel.TimestampsToReturn_timestampsToReturnNeither, - int32(len(readValueArray)), readValueArray) - identifier, err := strconv.ParseUint(opcuaReadRequest.GetIdentifier(), 10, 16) - if err != nil { - result <- spiModel.NewDefaultPlcReadRequestResult(readRequest, nil, errors.Wrapf(err, "error parsing identifier")) - return - } - + identifier := opcuaReadRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( - expandedNodeId, - nil, - opcuaReadRequest, - false) + extObject := readWriteModel.NewExtensiblePayload(nil, readWriteModel.NewRootExtensionObject(expandedNodeId, opcuaReadRequest, identifier), 0) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err = extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { + if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { result <- spiModel.NewDefaultPlcReadRequestResult(readRequest, nil, errors.Wrapf(err, "Unable to serialise the ReadRequest")) return } consumer := func(opcuaResponse []byte) { - reply, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + reply, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { result <- spiModel.NewDefaultPlcReadRequestResult(readRequest, nil, errors.Wrapf(err, "Unable to read the reply")) return diff --git a/plc4go/internal/opcua/SecureChannel.go b/plc4go/internal/opcua/SecureChannel.go index 2f8b5b622b1..8e98e2493a9 100644 --- a/plc4go/internal/opcua/SecureChannel.go +++ b/plc4go/internal/opcua/SecureChannel.go @@ -30,7 +30,6 @@ import ( "net/url" "regexp" "slices" - "strconv" "sync" "sync/atomic" "time" @@ -57,8 +56,8 @@ const ( ) var ( - SECURITY_POLICY_NONE = readWriteModel.NewPascalString("http://opcfoundation.org/UA/SecurityPolicy#None") - NULL_STRING = readWriteModel.NewPascalString("") + SECURITY_POLICY_NONE = readWriteModel.NewPascalString(utils.ToPtr("http://opcfoundation.org/UA/SecurityPolicy#None")) + NULL_STRING = readWriteModel.NewPascalString(nil) NULL_BYTE_STRING = readWriteModel.NewPascalByteString(-1, nil) NULL_EXPANDED_NODEID = readWriteModel.NewExpandedNodeId(false, false, @@ -66,17 +65,18 @@ var ( nil, nil, ) - NULL_EXTENSION_OBJECT = readWriteModel.NewExtensionObject(NULL_EXPANDED_NODEID, + BINARY_ENCODING_MASK = readWriteModel.NewExtensionObjectEncodingMask(false, false, true) + NULL_EXTENSION_OBJECT = readWriteModel.NewNullExtensionObjectWithMask(NULL_EXPANDED_NODEID, readWriteModel.NewExtensionObjectEncodingMask(false, false, false), - readWriteModel.NewNullExtension(), + 0, false) // Body INET_ADDRESS_PATTERN = regexp.MustCompile(`(.(?Ptcp))?://(?P[\w.-]+)(:(?P\d*))?`) URI_PATTERN = regexp.MustCompile(`^(?Popc)` + INET_ADDRESS_PATTERN.String() + `(?P[\w/=]*)[?]?`) - APPLICATION_URI = readWriteModel.NewPascalString("urn:apache:plc4x:client") - PRODUCT_URI = readWriteModel.NewPascalString("urn:apache:plc4x:client") - APPLICATION_TEXT = readWriteModel.NewPascalString("OPCUA client for the Apache PLC4X:PLC4J project") + APPLICATION_URI = readWriteModel.NewPascalString(utils.ToPtr("urn:apache:plc4x:client")) + PRODUCT_URI = readWriteModel.NewPascalString(utils.ToPtr("urn:apache:plc4x:client")) + APPLICATION_TEXT = readWriteModel.NewPascalString(utils.ToPtr("OPCUA client for the Apache PLC4X:PLC4J project")) DEFAULT_CONNECTION_LIFETIME = uint32(36000000) ) @@ -124,11 +124,11 @@ type SecureChannel struct { func NewSecureChannel(log zerolog.Logger, ctx DriverContext, configuration Configuration) *SecureChannel { s := &SecureChannel{ configuration: configuration, - endpoint: readWriteModel.NewPascalString(configuration.Endpoint), + endpoint: readWriteModel.NewPascalString(&configuration.Endpoint), username: configuration.Username, password: configuration.Password, securityPolicy: "http://opcfoundation.org/UA/SecurityPolicy#" + configuration.SecurityPolicy, - sessionName: "UaSession:" + APPLICATION_TEXT.GetStringValue() + ":" + utils.RandomString(20), + sessionName: "UaSession:" + *APPLICATION_TEXT.GetStringValue() + ":" + utils.RandomString(20), authenticationToken: readWriteModel.NewNodeIdTwoByte(0), clientNonce: []byte(utils.RandomString(40)), keyStoreFile: configuration.KeyStoreFile, @@ -197,6 +197,7 @@ func (s *SecureChannel) submit(ctx context.Context, codec *MessageCodec, errorDi uint32(len(buffer.GetBytes())), ), uint32(len(buffer.GetBytes())), + true, ) var apu readWriteModel.OpcuaAPU @@ -206,13 +207,13 @@ func (s *SecureChannel) submit(ctx context.Context, codec *MessageCodec, errorDi errorDispatcher(err) return } - apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false) + apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false, true) if err != nil { errorDispatcher(err) return } } else { - apu = readWriteModel.NewOpcuaAPU(messageRequest, false) + apu = readWriteModel.NewOpcuaAPU(messageRequest, false, true) } requestConsumer := func(transactionId int32) { @@ -299,6 +300,7 @@ func (s *SecureChannel) onConnect(ctx context.Context, connection *Connection, c DEFAULT_MAX_CHUNK_COUNT, ), s.endpoint, + true, ) requestConsumer := func(transactionId int32) { @@ -372,12 +374,7 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti s.lifetime) } - identifier, err := strconv.ParseUint(openSecureChannelRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - connection.fireConnectionError(err, ch) - return - } + identifier := openSecureChannelRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -386,11 +383,10 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti nil, ) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, openSecureChannelRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -404,7 +400,7 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti readWriteModel.ChunkType_FINAL, readWriteModel.NewOpenChannelMessageRequest( 0, - readWriteModel.NewPascalString(s.securityPolicy), + readWriteModel.NewPascalString(&s.securityPolicy), s.publicCertificate, s.thumbprint), readWriteModel.NewBinaryPayload( @@ -413,6 +409,7 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti uint32(len(buffer.GetBytes())), ), uint32(len(buffer.GetBytes())), + true, ) var apu readWriteModel.OpcuaAPU @@ -424,14 +421,14 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti connection.fireConnectionError(err, ch) return } - apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false) + apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false, true) if err != nil { s.log.Debug().Err(err).Msg("error parsing") connection.fireConnectionError(err, ch) return } } else { - apu = readWriteModel.NewOpcuaAPU(openRequest, false) + apu = readWriteModel.NewOpcuaAPU(openRequest, false, true) } requestConsumer := func(transactionId int32) { @@ -457,7 +454,7 @@ func (s *SecureChannel) onConnectOpenSecureChannel(ctx context.Context, connecti messagePDU := opcuaAPU.GetMessage() opcuaOpenResponse := messagePDU.(readWriteModel.OpcuaOpenResponse) readBuffer := utils.NewReadBufferByteBased(opcuaOpenResponse.(readWriteModel.BinaryPayload).GetPayload(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, readBuffer, false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, readBuffer, false) if err != nil { return errors.Wrap(err, "error parsing") } @@ -512,10 +509,9 @@ func (s *SecureChannel) onConnectCreateSessionRequest(ctx context.Context, conne applicationName := readWriteModel.NewLocalizedText( true, true, - readWriteModel.NewPascalString("en"), + readWriteModel.NewPascalString(utils.ToPtr("en")), APPLICATION_TEXT) - noOfDiscoveryUrls := int32(-1) var discoveryUrls []readWriteModel.PascalString clientDescription := readWriteModel.NewApplicationDescription(APPLICATION_URI, @@ -524,7 +520,6 @@ func (s *SecureChannel) onConnectCreateSessionRequest(ctx context.Context, conne readWriteModel.ApplicationType_applicationTypeClient, NULL_STRING, NULL_STRING, - noOfDiscoveryUrls, discoveryUrls) createSessionRequest := readWriteModel.NewCreateSessionRequest( @@ -532,19 +527,14 @@ func (s *SecureChannel) onConnectCreateSessionRequest(ctx context.Context, conne clientDescription, NULL_STRING, s.endpoint, - readWriteModel.NewPascalString(s.sessionName), + readWriteModel.NewPascalString(&s.sessionName), readWriteModel.NewPascalByteString(int32(len(s.clientNonce)), s.clientNonce), NULL_BYTE_STRING, 120000, 0, ) - identifier, err := strconv.ParseUint(createSessionRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - connection.fireConnectionError(err, ch) - return - } + identifier := createSessionRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -552,11 +542,10 @@ func (s *SecureChannel) onConnectCreateSessionRequest(ctx context.Context, conne nil, nil) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, createSessionRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -567,7 +556,7 @@ func (s *SecureChannel) onConnectCreateSessionRequest(ctx context.Context, conne } consumer := func(opcuaResponse []byte) { - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { s.log.Error().Err(err).Msg("error parsing") connection.fireConnectionError(err, ch) @@ -654,32 +643,23 @@ func (s *SecureChannel) onConnectActivateSessionRequest(ctx context.Context, con activateSessionRequest := readWriteModel.NewActivateSessionRequest( requestHeader, clientSignature, - 0, nil, - 0, nil, userIdentityToken, clientSignature, ) - identifier, err := strconv.ParseUint(activateSessionRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - connection.fireConnectionError(err, ch) - return - } - + identifier := activateSessionRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, activateSessionRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -690,7 +670,7 @@ func (s *SecureChannel) onConnectActivateSessionRequest(ctx context.Context, con } consumer := func(opcuaResponse []byte) { - message, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + message, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { s.log.Error().Err(err).Msg("error parsing") return @@ -708,7 +688,7 @@ func (s *SecureChannel) onConnectActivateSessionRequest(ctx context.Context, con } s.log.Debug().Msg("Got Activate Session Response Connection Response") - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { s.log.Error().Err(err).Msg("error parsing") return @@ -773,11 +753,10 @@ func (s *SecureChannel) onDisconnect(ctx context.Context, connection *Connection requestHeader, true) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, closeSessionRequest, - false, + closeSessionRequest.GetExtensionId(), ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -787,7 +766,7 @@ func (s *SecureChannel) onDisconnect(ctx context.Context, connection *Connection } consumer := func(opcuaResponse []byte) { - message, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + message, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { s.log.Error().Err(err).Msg("error parsing") return @@ -804,7 +783,7 @@ func (s *SecureChannel) onDisconnect(ctx context.Context, connection *Connection } s.log.Debug().Msg("Got Close Session Response Connection Response") - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { s.log.Error().Err(err).Msg("error parsing") return @@ -842,11 +821,7 @@ func (s *SecureChannel) onDisconnectCloseSecureChannel(ctx context.Context, conn closeSecureChannelRequest := readWriteModel.NewCloseSecureChannelRequest(requestHeader) - identifier, err := strconv.ParseUint(closeSecureChannelRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - return - } + identifier := closeSecureChannelRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -860,17 +835,17 @@ func (s *SecureChannel) onDisconnectCloseSecureChannel(ctx context.Context, conn readWriteModel.NewSecurityHeader(s.channelId.Load(), s.tokenId.Load()), readWriteModel.NewExtensiblePayload( readWriteModel.NewSequenceHeader(transactionId, transactionId), - readWriteModel.NewExtensionObject( + readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, closeSecureChannelRequest, - false, + identifier, ), 0, ), + true, ) - apu := readWriteModel.NewOpcuaAPU(closeRequest, false) + apu := readWriteModel.NewOpcuaAPU(closeRequest, false, true) requestConsumer := func(transactionId int32) { if err := connection.messageCodec.SendRequest( @@ -927,9 +902,10 @@ func (s *SecureChannel) onDiscover(ctx context.Context, codec *MessageCodec) { DEFAULT_MAX_CHUNK_COUNT, ), s.endpoint, + true, ) - apu := readWriteModel.NewOpcuaAPU(hello, false) + apu := readWriteModel.NewOpcuaAPU(hello, false, true) requestConsumer := func(transactionId int32) { if err := codec.SendRequest( @@ -993,11 +969,7 @@ func (s *SecureChannel) onDiscoverOpenSecureChannel(ctx context.Context, codec * s.lifetime, ) - identifier, err := strconv.ParseUint(openSecureChannelRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - return - } + identifier := openSecureChannelRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -1006,11 +978,10 @@ func (s *SecureChannel) onDiscoverOpenSecureChannel(ctx context.Context, codec * nil, ) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, openSecureChannelRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -1033,9 +1004,10 @@ func (s *SecureChannel) onDiscoverOpenSecureChannel(ctx context.Context, codec * uint32(len(buffer.GetBytes())), ), uint32(len(buffer.GetBytes())), + true, ) - apu := readWriteModel.NewOpcuaAPU(openRequest, false) + apu := readWriteModel.NewOpcuaAPU(openRequest, false, true) requestConsumer := func(transactionId int32) { if err := codec.SendRequest( @@ -1060,7 +1032,7 @@ func (s *SecureChannel) onDiscoverOpenSecureChannel(ctx context.Context, codec * messagePDU := opcuaAPU.GetMessage() opcuaOpenResponse := messagePDU.(readWriteModel.OpcuaOpenResponse) readBuffer := utils.NewReadBufferByteBased(opcuaOpenResponse.(readWriteModel.BinaryPayload).GetPayload(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, readBuffer, false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, readBuffer, false) if err != nil { return errors.Wrap(err, "error parsing") } @@ -1123,16 +1095,10 @@ func (s *SecureChannel) onDiscoverGetEndpointsRequest(ctx context.Context, codec endpointsRequest := readWriteModel.NewGetEndpointsRequest( requestHeader, s.endpoint, - 0, nil, - 0, nil) - identifier, err := strconv.ParseUint(endpointsRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - return - } + identifier := endpointsRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -1141,11 +1107,10 @@ func (s *SecureChannel) onDiscoverGetEndpointsRequest(ctx context.Context, codec nil, ) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, endpointsRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -1166,9 +1131,10 @@ func (s *SecureChannel) onDiscoverGetEndpointsRequest(ctx context.Context, codec uint32(len(buffer.GetBytes())), ), uint32(len(buffer.GetBytes())), + true, ) - apu := readWriteModel.NewOpcuaAPU(messageRequest, false) + apu := readWriteModel.NewOpcuaAPU(messageRequest, false, true) requestConsumer := func(transactionId int32) { if err := codec.SendRequest( @@ -1193,7 +1159,7 @@ func (s *SecureChannel) onDiscoverGetEndpointsRequest(ctx context.Context, codec messagePDU := opcuaAPU.GetMessage() messageResponse := messagePDU.(readWriteModel.OpcuaMessageResponse) readBuffer := utils.NewReadBufferByteBased(messageResponse.(readWriteModel.BinaryPayload).GetPayload(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, readBuffer, false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, readBuffer, false) if err != nil { return errors.Wrap(err, "error parsing") } @@ -1212,8 +1178,8 @@ func (s *SecureChannel) onDiscoverGetEndpointsRequest(ctx context.Context, codec endpoints := response.GetEndpoints() for _, endpoint := range endpoints { endpointDescription := endpoint.(readWriteModel.EndpointDescription) - if endpointDescription.GetEndpointUrl().GetStringValue() == (s.endpoint.GetStringValue()) && endpointDescription.GetSecurityPolicyUri().GetStringValue() == (s.securityPolicy) { - s.log.Info().Str("stringValue", s.endpoint.GetStringValue()).Msg("Found OPC UA endpoint") + if endpointDescription.GetEndpointUrl().GetStringValue() == (s.endpoint.GetStringValue()) && *endpointDescription.GetSecurityPolicyUri().GetStringValue() == (s.securityPolicy) { + s.log.Info().Str("stringValue", *s.endpoint.GetStringValue()).Msg("Found OPC UA endpoint") s.configuration.SenderCertificate = endpointDescription.GetServerCertificate().GetStringValue() } } @@ -1254,11 +1220,7 @@ func (s *SecureChannel) onDiscoverCloseSecureChannel(ctx context.Context, codec closeSecureChannelRequest := readWriteModel.NewCloseSecureChannelRequest(requestHeader) - identifier, err := strconv.ParseUint(closeSecureChannelRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Debug().Err(err).Msg("error parsing identifier") - return - } + identifier := closeSecureChannelRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified @@ -1275,17 +1237,17 @@ func (s *SecureChannel) onDiscoverCloseSecureChannel(ctx context.Context, codec ), readWriteModel.NewExtensiblePayload( readWriteModel.NewSequenceHeader(transactionId, transactionId), - readWriteModel.NewExtensionObject( + readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, closeSecureChannelRequest, - false, + identifier, ), uint32(0), ), + true, ) - apu := readWriteModel.NewOpcuaAPU(closeRequest, false) + apu := readWriteModel.NewOpcuaAPU(closeRequest, false, true) requestConsumer := func(transactionId int32) { if err := codec.SendRequest( @@ -1376,23 +1338,17 @@ func (s *SecureChannel) keepAlive() { NULL_BYTE_STRING, uint32(s.lifetime)) } - identifier, err := strconv.ParseUint(openSecureChannelRequest.GetIdentifier(), 10, 16) - if err != nil { - s.log.Error().Err(err).Msg("error parsing identifier") - return - } - + identifier := openSecureChannelRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, openSecureChannelRequest, - false, + identifier, ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) @@ -1404,7 +1360,7 @@ func (s *SecureChannel) keepAlive() { openRequest := readWriteModel.NewOpcuaOpenRequest( readWriteModel.ChunkType_FINAL, readWriteModel.NewOpenChannelMessageRequest(0, - readWriteModel.NewPascalString(s.securityPolicy), + readWriteModel.NewPascalString(&s.securityPolicy), s.publicCertificate, s.thumbprint, ), @@ -1414,6 +1370,7 @@ func (s *SecureChannel) keepAlive() { uint32(len(buffer.GetBytes())), ), uint32(len(buffer.GetBytes())), + true, ) var apu readWriteModel.OpcuaAPU @@ -1424,13 +1381,13 @@ func (s *SecureChannel) keepAlive() { s.log.Error().Err(err).Msg("error encoding") return } - apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false) + apu, err = readWriteModel.OpcuaAPUParse(ctx, message, false, true) if err != nil { s.log.Error().Err(err).Msg("error parsing") return } } else { - apu = readWriteModel.NewOpcuaAPU(openRequest, false) + apu = readWriteModel.NewOpcuaAPU(openRequest, false, true) } requestConsumer := func(transactionId int32) { @@ -1456,7 +1413,7 @@ func (s *SecureChannel) keepAlive() { messagePDU := opcuaAPU.GetMessage() opcuaOpenResponse := messagePDU.(readWriteModel.OpcuaOpenResponse) readBuffer := utils.NewReadBufferByteBased(opcuaOpenResponse.(readWriteModel.BinaryPayload).GetPayload(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)) - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, readBuffer, false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, readBuffer, false) if err != nil { return errors.Wrap(err, "error parsing") } @@ -1560,7 +1517,7 @@ func (s *SecureChannel) selectEndpoint(sessionResponse readWriteModel.CreateSess // - @return error - If the returned endpoint string doesn't match the format expected func (s *SecureChannel) isEndpoint(endpoint readWriteModel.EndpointDescription) bool { // Split up the connection string into its individual segments. - matches := utils.GetSubgroupMatches(URI_PATTERN, endpoint.GetEndpointUrl().GetStringValue()) + matches := utils.GetSubgroupMatches(URI_PATTERN, *endpoint.GetEndpointUrl().GetStringValue()) if len(matches) == 0 { s.log.Error().Stringer("endpoint", endpoint).Msg("Endpoint returned from the server doesn't match the format '{protocol-code}:({transport-code})?//{transport-host}(:{transport-port})(/{transport-endpoint})'") return false @@ -1609,23 +1566,23 @@ func (s *SecureChannel) hasIdentity(policies []readWriteModel.UserTokenPolicy) { // - @param tokenType the token type // - @param policyId the policy id // - @return returns an ExtensionObject with an IdentityToken. -func (s *SecureChannel) getIdentityToken(tokenType readWriteModel.UserTokenType, policyId string) readWriteModel.ExtensionObject { +func (s *SecureChannel) getIdentityToken(tokenType readWriteModel.UserTokenType, policyId *string) readWriteModel.ExtensionObject { switch tokenType { case readWriteModel.UserTokenType_userTokenTypeAnonymous: //If we aren't using authentication tell the server we would like to log in anonymously - anonymousIdentityToken := readWriteModel.NewAnonymousIdentityToken() + anonymousIdentityToken := readWriteModel.NewAnonymousIdentityToken(readWriteModel.NewPascalString(policyId)) extExpandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified - readWriteModel.NewNodeIdFourByte( - 0, 321 /* TODO: disabled till we have greater segmentation: uint16(readWriteModel.OpcuaNodeIdServices_AnonymousIdentityToken_Encoding_DefaultBinary)*/), + readWriteModel.NewNodeIdFourByte(0, uint16(anonymousIdentityToken.GetExtensionId())), nil, nil, ) - return readWriteModel.NewExtensionObject( + return readWriteModel.NewBinaryExtensionObjectWithMask( extExpandedNodeId, - readWriteModel.NewExtensionObjectEncodingMask(false, false, true), - readWriteModel.NewUserIdentityToken(readWriteModel.NewPascalString(policyId), anonymousIdentityToken), + BINARY_ENCODING_MASK, + anonymousIdentityToken, + anonymousIdentityToken.GetExtensionId(), false, ) case readWriteModel.UserTokenType_userTokenTypeUserName: @@ -1648,20 +1605,22 @@ func (s *SecureChannel) getIdentityToken(tokenType readWriteModel.UserTokenType, return nil } userNameIdentityToken := readWriteModel.NewUserNameIdentityToken( - readWriteModel.NewPascalString(s.username), + readWriteModel.NewPascalString(policyId), + readWriteModel.NewPascalString(&s.username), readWriteModel.NewPascalByteString(int32(len(encryptedPassword)), encryptedPassword), - readWriteModel.NewPascalString(PASSWORD_ENCRYPTION_ALGORITHM), + readWriteModel.NewPascalString(utils.ToPtr(PASSWORD_ENCRYPTION_ALGORITHM)), ) extExpandedNodeId := readWriteModel.NewExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified - readWriteModel.NewNodeIdFourByte(0, 324 /*TODO: disabled till we have greater segmentation: uint16(readWriteModel.OpcuaNodeIdServices_UserNameIdentityToken_Encoding_DefaultBinary)*/), + readWriteModel.NewNodeIdFourByte(0, uint16(userNameIdentityToken.GetExtensionId())), nil, nil) - return readWriteModel.NewExtensionObject( + return readWriteModel.NewBinaryExtensionObjectWithMask( extExpandedNodeId, - readWriteModel.NewExtensionObjectEncodingMask(false, false, true), - readWriteModel.NewUserIdentityToken(readWriteModel.NewPascalString(policyId), userNameIdentityToken), + BINARY_ENCODING_MASK, + userNameIdentityToken, + userNameIdentityToken.GetExtensionId(), false, ) } diff --git a/plc4go/internal/opcua/Subscriber.go b/plc4go/internal/opcua/Subscriber.go index cd6c6526a5b..fb58706cb5a 100644 --- a/plc4go/internal/opcua/Subscriber.go +++ b/plc4go/internal/opcua/Subscriber.go @@ -23,7 +23,6 @@ import ( "context" "encoding/binary" "runtime/debug" - "strconv" "sync" "time" @@ -143,21 +142,20 @@ func (s *Subscriber) onSubscribeCreateSubscription(ctx context.Context, cycleTim 0, ) - identifier, err := strconv.ParseUint(createSubscriptionRequest.GetIdentifier(), 10, 16) - if err != nil { - return nil, errors.Wrapf(err, "error parsing identifier") - } + identifier := createSubscriptionRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( - expandedNodeId, + extObject := readWriteModel.NewExtensiblePayload( nil, - createSubscriptionRequest, - false) + readWriteModel.NewRootExtensionObject( + expandedNodeId, createSubscriptionRequest, createSubscriptionRequest.GetExtensionId(), + ), + 0, + ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { @@ -168,7 +166,7 @@ func (s *Subscriber) onSubscribeCreateSubscription(ctx context.Context, cycleTim errorChan := make(chan error, 100) // TODO: bit oversized to not block anything. Discards errors /* Functional Consumer example using inner class */ consumer := func(opcuaResponse []byte) { - extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + extensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { errorChan <- errors.Wrap(err, "error Parsing") return diff --git a/plc4go/internal/opcua/SubscriptionHandle.go b/plc4go/internal/opcua/SubscriptionHandle.go index c9ea83915e7..44866f88799 100644 --- a/plc4go/internal/opcua/SubscriptionHandle.go +++ b/plc4go/internal/opcua/SubscriptionHandle.go @@ -23,7 +23,6 @@ import ( "context" "encoding/binary" "slices" - "strconv" "sync" "sync/atomic" "time" @@ -77,7 +76,7 @@ func NewSubscriptionHandle(log zerolog.Logger, subscriber *Subscriber, connectio } func (h *SubscriptionHandle) onSubscribeCreateMonitoredItemsRequest() (readWriteModel.CreateMonitoredItemsResponse, error) { - requestList := make([]readWriteModel.ExtensionObjectDefinition, len(h.tagNames)) + requestList := make([]readWriteModel.MonitoredItemCreateRequest, len(h.tagNames)) for _, tagName := range h.tagNames { tagDefaultPlcSubscription := h.subscriptionRequest.GetTag(tagName) @@ -133,39 +132,33 @@ func (h *SubscriptionHandle) onSubscribeCreateMonitoredItemsRequest() (readWrite requestHeader, h.subscriptionId, readWriteModel.TimestampsToReturn_timestampsToReturnBoth, - int32(len(requestList)), requestList, ) - identifier, err := strconv.ParseUint(createMonitoredItemsRequest.GetIdentifier(), 10, 16) - if err != nil { - return nil, errors.Wrapf(err, "error parsing identifier") - } - + identifier := createMonitoredItemsRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( expandedNodeId, - nil, createMonitoredItemsRequest, - false, + identifier, ) ctx, cancel := context.WithTimeout(context.Background(), REQUEST_TIMEOUT) defer cancel() buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err = extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { + if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { return nil, errors.Wrapf(err, "Unable to serialise the ReadRequest") } responseChan := make(chan readWriteModel.CreateMonitoredItemsResponse, 100) // TODO: bit oversized to not block anything. Discards errors errorChan := make(chan error, 100) // TODO: bit oversized to not block anything. Discards errors consumer := func(opcuaResponse []byte) { - unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { errorChan <- errors.Wrapf(err, "Unable to read the reply") return @@ -229,7 +222,7 @@ func (h *SubscriptionHandle) startSubscriber() { go func() { defer h.subscriberWg.Done() - var outstandingAcknowledgements []readWriteModel.ExtensionObjectDefinition + var outstandingAcknowledgements []readWriteModel.SubscriptionAcknowledgement var outstandingRequests []uint32 for !h.destroy.Load() { @@ -252,14 +245,14 @@ func (h *SubscriptionHandle) startSubscriber() { ackLength = -1 } { // golang version of remove all - tmpOutstandingAcknowledgements := map[readWriteModel.ExtensionObjectDefinition]bool{} + tmpOutstandingAcknowledgements := map[readWriteModel.SubscriptionAcknowledgement]bool{} for _, acknowledgement := range outstandingAcknowledgements { tmpOutstandingAcknowledgements[acknowledgement] = true } for _, ack := range acks { delete(tmpOutstandingAcknowledgements, ack) } - outstandingAcknowledgements = make([]readWriteModel.ExtensionObjectDefinition, len(tmpOutstandingAcknowledgements)) + outstandingAcknowledgements = make([]readWriteModel.SubscriptionAcknowledgement, len(tmpOutstandingAcknowledgements)) count := 0 for ack := range tmpOutstandingAcknowledgements { outstandingAcknowledgements[count] = ack @@ -269,31 +262,26 @@ func (h *SubscriptionHandle) startSubscriber() { publishRequest := readWriteModel.NewPublishRequest( requestHeader, - int32(ackLength), acks, ) - identifier, err := strconv.ParseUint(publishRequest.GetIdentifier(), 10, 16) - if err != nil { - h.log.Error().Err(err).Msg("error parsing identifier") - continue - } + identifier := publishRequest.GetExtensionId() extExpandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( extExpandedNodeId, - nil, publishRequest, - false) + identifier, + ) ctx := context.Background() buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err = extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { + if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { h.log.Error().Err(err).Msg("Unable to serialise the ReadRequest") continue } @@ -301,7 +289,7 @@ func (h *SubscriptionHandle) startSubscriber() { consumer := func(opcuaResponse []byte) { var responseMessage readWriteModel.PublishResponse var serviceFault readWriteModel.ServiceFault - unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { h.log.Error().Err(err).Msg("Unable to parse the returned Subscription response") h.plcSubscriber.onDisconnect() @@ -384,15 +372,10 @@ func (h *SubscriptionHandle) stopSubscriber() { subscriptions := []uint32{h.subscriptionId} deleteSubscriptionrequest := readWriteModel.NewDeleteSubscriptionsRequest(requestHeader, - 1, subscriptions, ) - identifier, err := strconv.ParseUint(deleteSubscriptionrequest.GetIdentifier(), 10, 16) - if err != nil { - h.log.Error().Err(err).Msg("error parsing identifier") - return - } + identifier := deleteSubscriptionrequest.GetExtensionId() extExpandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), @@ -400,24 +383,23 @@ func (h *SubscriptionHandle) stopSubscriber() { nil, ) - extObject := readWriteModel.NewExtensionObject( + extObject := readWriteModel.NewRootExtensionObject( extExpandedNodeId, - nil, deleteSubscriptionrequest, - false, + identifier, ) ctx := context.Background() buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err = extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { + if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { h.log.Error().Err(err).Msg("Unable to serialise the ReadRequest") return } consumer := func(opcuaResponse []byte) { var responseMessage readWriteModel.DeleteSubscriptionsResponse - unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + unknownExtensionObject, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { h.log.Error().Err(err).Msg("Unable to parse the returned Subscription response") h.plcSubscriber.onDisconnect() diff --git a/plc4go/internal/opcua/Writer.go b/plc4go/internal/opcua/Writer.go index 2268e24f446..ab04138775b 100644 --- a/plc4go/internal/opcua/Writer.go +++ b/plc4go/internal/opcua/Writer.go @@ -23,7 +23,6 @@ import ( "context" "encoding/binary" "runtime/debug" - "strconv" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -75,7 +74,7 @@ func (m *Writer) WriteSync(ctx context.Context, writeRequest apiModel.PlcWriteRe REQUEST_TIMEOUT_LONG, NULL_EXTENSION_OBJECT, ) - writeValueArray := make([]readWriteModel.ExtensionObjectDefinition, len(writeRequest.GetTagNames())) + writeValueArray := make([]readWriteModel.WriteValue, len(writeRequest.GetTagNames())) for i, tagName := range writeRequest.GetTagNames() { tag := writeRequest.GetTag(tagName).(Tag) @@ -112,35 +111,33 @@ func (m *Writer) WriteSync(ctx context.Context, writeRequest apiModel.PlcWriteRe opcuaWriteRequest := readWriteModel.NewWriteRequest( requestHeader, - int32(len(writeValueArray)), writeValueArray, ) - identifier, err := strconv.ParseUint(opcuaWriteRequest.GetIdentifier(), 10, 16) - if err != nil { - result <- spiModel.NewDefaultPlcWriteRequestResult(writeRequest, nil, errors.Wrapf(err, "error parsing identifier")) - return - } + identifier := opcuaWriteRequest.GetExtensionId() expandedNodeId := readWriteModel.NewExpandedNodeId(false, //Namespace Uri Specified false, //Server Index Specified readWriteModel.NewNodeIdFourByte(0, uint16(identifier)), nil, nil) - extObject := readWriteModel.NewExtensionObject( - expandedNodeId, + extObject := readWriteModel.NewExtensiblePayload( nil, - opcuaWriteRequest, - false) - + readWriteModel.NewRootExtensionObject( + expandedNodeId, + opcuaWriteRequest, + identifier, + ), + 0, + ) buffer := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian)) - if err = extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { + if err := extObject.SerializeWithWriteBuffer(ctx, buffer); err != nil { result <- spiModel.NewDefaultPlcWriteRequestResult(writeRequest, nil, errors.Wrapf(err, "Unable to serialise the ReadRequest")) return } consumer := func(opcuaResponse []byte) { - reply, err := readWriteModel.ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) + reply, err := readWriteModel.ExtensionObjectParseWithBuffer[readWriteModel.ExtensionObject](ctx, utils.NewReadBufferByteBased(opcuaResponse, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), false) if err != nil { result <- spiModel.NewDefaultPlcWriteRequestResult(writeRequest, nil, errors.Wrapf(err, "Unable to read the reply")) return @@ -409,7 +406,7 @@ func (m *Writer) fromPlcValue(tagName string, tag Tag, request apiModel.PlcWrite case apiValues.WSTRING: tmpString := make([]readWriteModel.PascalString, length) for i := uint32(0); i < length; i++ { - tmpString[i] = readWriteModel.NewPascalString(valueObject.GetIndex(i).GetString()) + tmpString[i] = readWriteModel.NewPascalString(utils.ToPtr(valueObject.GetIndex(i).GetString())) } var arrayLength *int32 if length != 1 { diff --git a/plc4go/internal/opcua/common.go b/plc4go/internal/opcua/common.go index 1e2654ebd12..a3ad7943e2e 100644 --- a/plc4go/internal/opcua/common.go +++ b/plc4go/internal/opcua/common.go @@ -31,6 +31,7 @@ import ( apiModel "github.com/apache/plc4x/plc4go/pkg/api/model" apiValues "github.com/apache/plc4x/plc4go/pkg/api/values" readWriteModel "github.com/apache/plc4x/plc4go/protocols/opcua/readwrite/model" + "github.com/apache/plc4x/plc4go/spi/utils" spiValues "github.com/apache/plc4x/plc4go/spi/values" ) @@ -59,7 +60,7 @@ func generateNodeId(tag Tag) (readWriteModel.NodeId, error) { } nodeId = readWriteModel.NewNodeId(readWriteModel.NewNodeIdGuid( /*TODO: do we want to check for overflow?*/ uint16(tag.GetNamespace()), guidBytes)) } else if tag.GetIdentifierType() == readWriteModel.OpcuaIdentifierType_STRING_IDENTIFIER { - nodeId = readWriteModel.NewNodeId(readWriteModel.NewNodeIdString( /*TODO: do we want to check for overflow?*/ uint16(tag.GetNamespace()), readWriteModel.NewPascalString(tag.GetIdentifier()))) + nodeId = readWriteModel.NewNodeId(readWriteModel.NewNodeIdString( /*TODO: do we want to check for overflow?*/ uint16(tag.GetNamespace()), readWriteModel.NewPascalString(utils.ToPtr(tag.GetIdentifier())))) } return nodeId, nil } @@ -153,7 +154,7 @@ func readResponse(localLog zerolog.Logger, readRequestIn apiModel.PlcReadRequest array := variant.GetValue() stringValues := make([]apiValues.PlcValue, len(array)) for i, t := range array { - stringValues[i] = spiValues.NewPlcSTRING(t.GetStringValue()) + stringValues[i] = spiValues.NewPlcSTRING(*t.GetStringValue()) } value = spiValues.NewPlcList(stringValues) case readWriteModel.VariantDateTime: @@ -185,7 +186,7 @@ func readResponse(localLog zerolog.Logger, readRequestIn apiModel.PlcReadRequest array := variant.GetValue() xmlElementValues := make([]apiValues.PlcValue, len(array)) for i, t := range array { - xmlElementValues[i] = spiValues.NewPlcSTRING(t.GetStringValue()) + xmlElementValues[i] = spiValues.NewPlcSTRING(*t.GetStringValue()) } value = spiValues.NewPlcList(xmlElementValues) case readWriteModel.VariantLocalizedText: @@ -194,10 +195,10 @@ func readResponse(localLog zerolog.Logger, readRequestIn apiModel.PlcReadRequest for i, t := range array { v := "" if t.GetLocaleSpecified() { - v += t.GetLocale().GetStringValue() + "|" + v += *t.GetLocale().GetStringValue() + "|" } if t.GetTextSpecified() { - v += t.GetText().GetStringValue() + v += *t.GetText().GetStringValue() } localizedTextValues[i] = spiValues.NewPlcSTRING(v) } @@ -206,7 +207,7 @@ func readResponse(localLog zerolog.Logger, readRequestIn apiModel.PlcReadRequest array := variant.GetValue() qualifiedNameValues := make([]apiValues.PlcValue, len(array)) for i, t := range array { - qualifiedNameValues[i] = spiValues.NewPlcSTRING(fmt.Sprintf("ns=%d;s=%s", t.GetNamespaceIndex(), t.GetName().GetStringValue())) + qualifiedNameValues[i] = spiValues.NewPlcSTRING(fmt.Sprintf("ns=%d;s=%s", t.GetNamespaceIndex(), *t.GetName().GetStringValue())) } value = spiValues.NewPlcList(qualifiedNameValues) case readWriteModel.VariantExtensionObject: diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go index 8f383b49057..7192d1b4cc6 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go +++ b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go @@ -737,8 +737,9 @@ const ( KnxManufacturer_M_EBELONG KnxManufacturer = 691 KnxManufacturer_M_ASTRA_LED_AG KnxManufacturer = 692 KnxManufacturer_M_WONDERFUL_HI_TECH_CO___LTD_ KnxManufacturer = 693 - KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 694 - KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 695 + KnxManufacturer_M_REXLITE_AI_INTEGRATIONS_CO__LTD KnxManufacturer = 694 + KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 695 + KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 696 ) var KnxManufacturerValues []KnxManufacturer @@ -1440,6 +1441,7 @@ func init() { KnxManufacturer_M_EBELONG, KnxManufacturer_M_ASTRA_LED_AG, KnxManufacturer_M_WONDERFUL_HI_TECH_CO___LTD_, + KnxManufacturer_M_REXLITE_AI_INTEGRATIONS_CO__LTD, KnxManufacturer_M_ABB___RESERVED, KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED, } @@ -4093,10 +4095,14 @@ func (e KnxManufacturer) Number() uint16 { } case 694: { /* '694' */ - return 43954 + return 752 } case 695: { /* '695' */ + return 43954 + } + case 696: + { /* '696' */ return 43959 } case 7: @@ -6895,10 +6901,14 @@ func (e KnxManufacturer) Name() string { } case 694: { /* '694' */ - return "ABB - reserved" + return "REXLiTE Ai Integrations CO.,LTD" } case 695: { /* '695' */ + return "ABB - reserved" + } + case 696: + { /* '696' */ return "Busch-Jaeger Elektro - reserved" } case 7: @@ -8373,8 +8383,10 @@ func KnxManufacturerByValue(value uint16) (enum KnxManufacturer, ok bool) { case 693: return KnxManufacturer_M_WONDERFUL_HI_TECH_CO___LTD_, true case 694: - return KnxManufacturer_M_ABB___RESERVED, true + return KnxManufacturer_M_REXLITE_AI_INTEGRATIONS_CO__LTD, true case 695: + return KnxManufacturer_M_ABB___RESERVED, true + case 696: return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED, true case 7: return KnxManufacturer_M_GIRA_GIERSIEPEN, true @@ -9770,6 +9782,8 @@ func KnxManufacturerByName(value string) (enum KnxManufacturer, ok bool) { return KnxManufacturer_M_ASTRA_LED_AG, true case "M_WONDERFUL_HI_TECH_CO___LTD_": return KnxManufacturer_M_WONDERFUL_HI_TECH_CO___LTD_, true + case "M_REXLITE_AI_INTEGRATIONS_CO__LTD": + return KnxManufacturer_M_REXLITE_AI_INTEGRATIONS_CO__LTD, true case "M_ABB___RESERVED": return KnxManufacturer_M_ABB___RESERVED, true case "M_BUSCH_JAEGER_ELEKTRO___RESERVED": @@ -11240,6 +11254,8 @@ func (e KnxManufacturer) PLC4XEnumName() string { return "M_ASTRA_LED_AG" case KnxManufacturer_M_WONDERFUL_HI_TECH_CO___LTD_: return "M_WONDERFUL_HI_TECH_CO___LTD_" + case KnxManufacturer_M_REXLITE_AI_INTEGRATIONS_CO__LTD: + return "M_REXLITE_AI_INTEGRATIONS_CO__LTD" case KnxManufacturer_M_ABB___RESERVED: return "M_ABB___RESERVED" case KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED: diff --git a/plc4go/protocols/opcua/readwrite/ParserHelper.go b/plc4go/protocols/opcua/readwrite/ParserHelper.go index 1044aa72f12..d69c3b5f8eb 100644 --- a/plc4go/protocols/opcua/readwrite/ParserHelper.go +++ b/plc4go/protocols/opcua/readwrite/ParserHelper.go @@ -62,7 +62,11 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R if err != nil { return nil, errors.Wrap(err, "Error parsing") } - return OpcuaAPUParseWithBuffer(context.Background(), io, response) + binaryEncoding, err := utils.StrToBool(arguments[1]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return OpcuaAPUParseWithBuffer(context.Background(), io, response, binaryEncoding) case "Index": return IndexParseWithBuffer(context.Background(), io) case "StatusCode": @@ -79,18 +83,12 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R return AudioDataTypeParseWithBuffer(context.Background(), io) case "SecurityHeader": return SecurityHeaderParseWithBuffer(context.Background(), io) - case "UserIdentityTokenDefinition": - identifier, err := utils.StrToString(arguments[0]) - if err != nil { - return nil, errors.Wrap(err, "Error parsing") - } - return UserIdentityTokenDefinitionParseWithBuffer[UserIdentityTokenDefinition](context.Background(), io, identifier) case "ContinuationPoint": return ContinuationPointParseWithBuffer(context.Background(), io) case "Variant": return VariantParseWithBuffer[Variant](context.Background(), io) case "Payload": - extensible, err := utils.StrToBool(arguments[0]) + binary, err := utils.StrToBool(arguments[0]) if err != nil { return nil, errors.Wrap(err, "Error parsing") } @@ -98,7 +96,7 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R if err != nil { return nil, errors.Wrap(err, "Error parsing") } - return PayloadParseWithBuffer[Payload](context.Background(), io, extensible, byteCount) + return PayloadParseWithBuffer[Payload](context.Background(), io, binary, byteCount) case "ExtensionObjectEncodingMask": return ExtensionObjectEncodingMaskParseWithBuffer(context.Background(), io) case "DurationString": @@ -107,8 +105,6 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R return StructureParseWithBuffer(context.Background(), io) case "OpcuaConstants": return OpcuaConstantsParseWithBuffer(context.Background(), io) - case "ExtensionHeader": - return ExtensionHeaderParseWithBuffer(context.Background(), io) case "UtcTime": return UtcTimeParseWithBuffer(context.Background(), io) case "MessagePDU": @@ -116,7 +112,11 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R if err != nil { return nil, errors.Wrap(err, "Error parsing") } - return MessagePDUParseWithBuffer[MessagePDU](context.Background(), io, response) + binary, err := utils.StrToBool(arguments[1]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return MessagePDUParseWithBuffer[MessagePDU](context.Background(), io, response, binary) case "Counter": return CounterParseWithBuffer(context.Background(), io) case "SequenceHeader": @@ -130,7 +130,7 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R if err != nil { return nil, errors.Wrap(err, "Error parsing") } - return ExtensionObjectParseWithBuffer(context.Background(), io, includeEncodingMask) + return ExtensionObjectParseWithBuffer[ExtensionObject](context.Background(), io, includeEncodingMask) case "LocalizedText": return LocalizedTextParseWithBuffer(context.Background(), io) case "IntegerId": @@ -160,11 +160,11 @@ func (m OpcuaParserHelper) Parse(typeName string, arguments []string, io utils.R case "ImageBMP": return ImageBMPParseWithBuffer(context.Background(), io) case "ExtensionObjectDefinition": - identifier, err := utils.StrToString(arguments[0]) + extensionId, err := utils.StrToInt32(arguments[0]) if err != nil { return nil, errors.Wrap(err, "Error parsing") } - return ExtensionObjectDefinitionParseWithBuffer[ExtensionObjectDefinition](context.Background(), io, identifier) + return ExtensionObjectDefinitionParseWithBuffer[ExtensionObjectDefinition](context.Background(), io, extensionId) case "ExpandedNodeId": return ExpandedNodeIdParseWithBuffer(context.Background(), io) case "OpcuaProtocolLimits": diff --git a/plc4go/protocols/opcua/readwrite/XmlParserHelper.go b/plc4go/protocols/opcua/readwrite/XmlParserHelper.go index 5e6178b5965..9fcbae91144 100644 --- a/plc4go/protocols/opcua/readwrite/XmlParserHelper.go +++ b/plc4go/protocols/opcua/readwrite/XmlParserHelper.go @@ -66,7 +66,8 @@ func (m OpcuaXmlParserHelper) Parse(typeName string, xmlString string, parserArg return TwoByteNodeIdParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "OpcuaAPU": response := parserArguments[0] == "true" - return OpcuaAPUParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response) + binaryEncoding := parserArguments[1] == "true" + return OpcuaAPUParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, binaryEncoding) case "Index": return IndexParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "StatusCode": @@ -83,22 +84,18 @@ func (m OpcuaXmlParserHelper) Parse(typeName string, xmlString string, parserArg return AudioDataTypeParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "SecurityHeader": return SecurityHeaderParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) - case "UserIdentityTokenDefinition": - // TODO: find a way to parse the sub types - var identifier string - return UserIdentityTokenDefinitionParseWithBuffer[UserIdentityTokenDefinition](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), identifier) case "ContinuationPoint": return ContinuationPointParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "Variant": return VariantParseWithBuffer[Variant](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "Payload": - extensible := parserArguments[0] == "true" + binary := parserArguments[0] == "true" parsedUint1, err := strconv.ParseUint(parserArguments[1], 10, 32) if err != nil { return nil, err } byteCount := uint32(parsedUint1) - return PayloadParseWithBuffer[Payload](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), extensible, byteCount) + return PayloadParseWithBuffer[Payload](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), binary, byteCount) case "ExtensionObjectEncodingMask": return ExtensionObjectEncodingMaskParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "DurationString": @@ -107,13 +104,12 @@ func (m OpcuaXmlParserHelper) Parse(typeName string, xmlString string, parserArg return StructureParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "OpcuaConstants": return OpcuaConstantsParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) - case "ExtensionHeader": - return ExtensionHeaderParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "UtcTime": return UtcTimeParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "MessagePDU": response := parserArguments[0] == "true" - return MessagePDUParseWithBuffer[MessagePDU](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response) + binary := parserArguments[1] == "true" + return MessagePDUParseWithBuffer[MessagePDU](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, binary) case "Counter": return CounterParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "SequenceHeader": @@ -124,7 +120,7 @@ func (m OpcuaXmlParserHelper) Parse(typeName string, xmlString string, parserArg return RsaEncryptedSecretParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "ExtensionObject": includeEncodingMask := parserArguments[0] == "true" - return ExtensionObjectParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), includeEncodingMask) + return ExtensionObjectParseWithBuffer[ExtensionObject](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), includeEncodingMask) case "LocalizedText": return LocalizedTextParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "IntegerId": @@ -154,9 +150,12 @@ func (m OpcuaXmlParserHelper) Parse(typeName string, xmlString string, parserArg case "ImageBMP": return ImageBMPParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "ExtensionObjectDefinition": - // TODO: find a way to parse the sub types - var identifier string - return ExtensionObjectDefinitionParseWithBuffer[ExtensionObjectDefinition](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), identifier) + parsedInt0, err := strconv.ParseInt(parserArguments[0], 10, 32) + if err != nil { + return nil, err + } + extensionId := int32(parsedInt0) + return ExtensionObjectDefinitionParseWithBuffer[ExtensionObjectDefinition](context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString)), extensionId) case "ExpandedNodeId": return ExpandedNodeIdParseWithBuffer(context.Background(), utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "OpcuaProtocolLimits": diff --git a/plc4go/protocols/opcua/readwrite/model/ActivateSessionRequest.go b/plc4go/protocols/opcua/readwrite/model/ActivateSessionRequest.go index f89dad530e9..0d7266bbd80 100644 --- a/plc4go/protocols/opcua/readwrite/model/ActivateSessionRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/ActivateSessionRequest.go @@ -41,21 +41,17 @@ type ActivateSessionRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetClientSignature returns ClientSignature (property field) - GetClientSignature() ExtensionObjectDefinition - // GetNoOfClientSoftwareCertificates returns NoOfClientSoftwareCertificates (property field) - GetNoOfClientSoftwareCertificates() int32 + GetClientSignature() SignatureData // GetClientSoftwareCertificates returns ClientSoftwareCertificates (property field) - GetClientSoftwareCertificates() []ExtensionObjectDefinition - // GetNoOfLocaleIds returns NoOfLocaleIds (property field) - GetNoOfLocaleIds() int32 + GetClientSoftwareCertificates() []SignedSoftwareCertificate // GetLocaleIds returns LocaleIds (property field) GetLocaleIds() []PascalString // GetUserIdentityToken returns UserIdentityToken (property field) GetUserIdentityToken() ExtensionObject // GetUserTokenSignature returns UserTokenSignature (property field) - GetUserTokenSignature() ExtensionObjectDefinition + GetUserTokenSignature() SignatureData // IsActivateSessionRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsActivateSessionRequest() // CreateBuilder creates a ActivateSessionRequestBuilder @@ -65,40 +61,36 @@ type ActivateSessionRequest interface { // _ActivateSessionRequest is the data-structure of this message type _ActivateSessionRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - ClientSignature ExtensionObjectDefinition - NoOfClientSoftwareCertificates int32 - ClientSoftwareCertificates []ExtensionObjectDefinition - NoOfLocaleIds int32 - LocaleIds []PascalString - UserIdentityToken ExtensionObject - UserTokenSignature ExtensionObjectDefinition + RequestHeader RequestHeader + ClientSignature SignatureData + ClientSoftwareCertificates []SignedSoftwareCertificate + LocaleIds []PascalString + UserIdentityToken ExtensionObject + UserTokenSignature SignatureData } var _ ActivateSessionRequest = (*_ActivateSessionRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ActivateSessionRequest)(nil) // NewActivateSessionRequest factory function for _ActivateSessionRequest -func NewActivateSessionRequest(requestHeader ExtensionObjectDefinition, clientSignature ExtensionObjectDefinition, noOfClientSoftwareCertificates int32, clientSoftwareCertificates []ExtensionObjectDefinition, noOfLocaleIds int32, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature ExtensionObjectDefinition) *_ActivateSessionRequest { +func NewActivateSessionRequest(requestHeader RequestHeader, clientSignature SignatureData, clientSoftwareCertificates []SignedSoftwareCertificate, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature SignatureData) *_ActivateSessionRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for ActivateSessionRequest must not be nil") + panic("requestHeader of type RequestHeader for ActivateSessionRequest must not be nil") } if clientSignature == nil { - panic("clientSignature of type ExtensionObjectDefinition for ActivateSessionRequest must not be nil") + panic("clientSignature of type SignatureData for ActivateSessionRequest must not be nil") } if userIdentityToken == nil { panic("userIdentityToken of type ExtensionObject for ActivateSessionRequest must not be nil") } if userTokenSignature == nil { - panic("userTokenSignature of type ExtensionObjectDefinition for ActivateSessionRequest must not be nil") + panic("userTokenSignature of type SignatureData for ActivateSessionRequest must not be nil") } _result := &_ActivateSessionRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, ClientSignature: clientSignature, - NoOfClientSoftwareCertificates: noOfClientSoftwareCertificates, ClientSoftwareCertificates: clientSoftwareCertificates, - NoOfLocaleIds: noOfLocaleIds, LocaleIds: localeIds, UserIdentityToken: userIdentityToken, UserTokenSignature: userTokenSignature, @@ -116,21 +108,17 @@ func NewActivateSessionRequest(requestHeader ExtensionObjectDefinition, clientSi type ActivateSessionRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientSignature ExtensionObjectDefinition, noOfClientSoftwareCertificates int32, clientSoftwareCertificates []ExtensionObjectDefinition, noOfLocaleIds int32, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature ExtensionObjectDefinition) ActivateSessionRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, clientSignature SignatureData, clientSoftwareCertificates []SignedSoftwareCertificate, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature SignatureData) ActivateSessionRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) ActivateSessionRequestBuilder + WithRequestHeader(RequestHeader) ActivateSessionRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) ActivateSessionRequestBuilder // WithClientSignature adds ClientSignature (property field) - WithClientSignature(ExtensionObjectDefinition) ActivateSessionRequestBuilder + WithClientSignature(SignatureData) ActivateSessionRequestBuilder // WithClientSignatureBuilder adds ClientSignature (property field) which is build by the builder - WithClientSignatureBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder - // WithNoOfClientSoftwareCertificates adds NoOfClientSoftwareCertificates (property field) - WithNoOfClientSoftwareCertificates(int32) ActivateSessionRequestBuilder + WithClientSignatureBuilder(func(SignatureDataBuilder) SignatureDataBuilder) ActivateSessionRequestBuilder // WithClientSoftwareCertificates adds ClientSoftwareCertificates (property field) - WithClientSoftwareCertificates(...ExtensionObjectDefinition) ActivateSessionRequestBuilder - // WithNoOfLocaleIds adds NoOfLocaleIds (property field) - WithNoOfLocaleIds(int32) ActivateSessionRequestBuilder + WithClientSoftwareCertificates(...SignedSoftwareCertificate) ActivateSessionRequestBuilder // WithLocaleIds adds LocaleIds (property field) WithLocaleIds(...PascalString) ActivateSessionRequestBuilder // WithUserIdentityToken adds UserIdentityToken (property field) @@ -138,9 +126,9 @@ type ActivateSessionRequestBuilder interface { // WithUserIdentityTokenBuilder adds UserIdentityToken (property field) which is build by the builder WithUserIdentityTokenBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) ActivateSessionRequestBuilder // WithUserTokenSignature adds UserTokenSignature (property field) - WithUserTokenSignature(ExtensionObjectDefinition) ActivateSessionRequestBuilder + WithUserTokenSignature(SignatureData) ActivateSessionRequestBuilder // WithUserTokenSignatureBuilder adds UserTokenSignature (property field) which is build by the builder - WithUserTokenSignatureBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder + WithUserTokenSignatureBuilder(func(SignatureDataBuilder) SignatureDataBuilder) ActivateSessionRequestBuilder // Build builds the ActivateSessionRequest or returns an error if something is wrong Build() (ActivateSessionRequest, error) // MustBuild does the same as Build but panics on error @@ -166,61 +154,51 @@ func (b *_ActivateSessionRequestBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_ActivateSessionRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientSignature ExtensionObjectDefinition, noOfClientSoftwareCertificates int32, clientSoftwareCertificates []ExtensionObjectDefinition, noOfLocaleIds int32, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature ExtensionObjectDefinition) ActivateSessionRequestBuilder { - return b.WithRequestHeader(requestHeader).WithClientSignature(clientSignature).WithNoOfClientSoftwareCertificates(noOfClientSoftwareCertificates).WithClientSoftwareCertificates(clientSoftwareCertificates...).WithNoOfLocaleIds(noOfLocaleIds).WithLocaleIds(localeIds...).WithUserIdentityToken(userIdentityToken).WithUserTokenSignature(userTokenSignature) +func (b *_ActivateSessionRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, clientSignature SignatureData, clientSoftwareCertificates []SignedSoftwareCertificate, localeIds []PascalString, userIdentityToken ExtensionObject, userTokenSignature SignatureData) ActivateSessionRequestBuilder { + return b.WithRequestHeader(requestHeader).WithClientSignature(clientSignature).WithClientSoftwareCertificates(clientSoftwareCertificates...).WithLocaleIds(localeIds...).WithUserIdentityToken(userIdentityToken).WithUserTokenSignature(userTokenSignature) } -func (b *_ActivateSessionRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) ActivateSessionRequestBuilder { +func (b *_ActivateSessionRequestBuilder) WithRequestHeader(requestHeader RequestHeader) ActivateSessionRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_ActivateSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ActivateSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) ActivateSessionRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_ActivateSessionRequestBuilder) WithClientSignature(clientSignature ExtensionObjectDefinition) ActivateSessionRequestBuilder { +func (b *_ActivateSessionRequestBuilder) WithClientSignature(clientSignature SignatureData) ActivateSessionRequestBuilder { b.ClientSignature = clientSignature return b } -func (b *_ActivateSessionRequestBuilder) WithClientSignatureBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder { - builder := builderSupplier(b.ClientSignature.CreateExtensionObjectDefinitionBuilder()) +func (b *_ActivateSessionRequestBuilder) WithClientSignatureBuilder(builderSupplier func(SignatureDataBuilder) SignatureDataBuilder) ActivateSessionRequestBuilder { + builder := builderSupplier(b.ClientSignature.CreateSignatureDataBuilder()) var err error b.ClientSignature, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "SignatureDataBuilder failed")) } return b } -func (b *_ActivateSessionRequestBuilder) WithNoOfClientSoftwareCertificates(noOfClientSoftwareCertificates int32) ActivateSessionRequestBuilder { - b.NoOfClientSoftwareCertificates = noOfClientSoftwareCertificates - return b -} - -func (b *_ActivateSessionRequestBuilder) WithClientSoftwareCertificates(clientSoftwareCertificates ...ExtensionObjectDefinition) ActivateSessionRequestBuilder { +func (b *_ActivateSessionRequestBuilder) WithClientSoftwareCertificates(clientSoftwareCertificates ...SignedSoftwareCertificate) ActivateSessionRequestBuilder { b.ClientSoftwareCertificates = clientSoftwareCertificates return b } -func (b *_ActivateSessionRequestBuilder) WithNoOfLocaleIds(noOfLocaleIds int32) ActivateSessionRequestBuilder { - b.NoOfLocaleIds = noOfLocaleIds - return b -} - func (b *_ActivateSessionRequestBuilder) WithLocaleIds(localeIds ...PascalString) ActivateSessionRequestBuilder { b.LocaleIds = localeIds return b @@ -244,20 +222,20 @@ func (b *_ActivateSessionRequestBuilder) WithUserIdentityTokenBuilder(builderSup return b } -func (b *_ActivateSessionRequestBuilder) WithUserTokenSignature(userTokenSignature ExtensionObjectDefinition) ActivateSessionRequestBuilder { +func (b *_ActivateSessionRequestBuilder) WithUserTokenSignature(userTokenSignature SignatureData) ActivateSessionRequestBuilder { b.UserTokenSignature = userTokenSignature return b } -func (b *_ActivateSessionRequestBuilder) WithUserTokenSignatureBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionRequestBuilder { - builder := builderSupplier(b.UserTokenSignature.CreateExtensionObjectDefinitionBuilder()) +func (b *_ActivateSessionRequestBuilder) WithUserTokenSignatureBuilder(builderSupplier func(SignatureDataBuilder) SignatureDataBuilder) ActivateSessionRequestBuilder { + builder := builderSupplier(b.UserTokenSignature.CreateSignatureDataBuilder()) var err error b.UserTokenSignature, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "SignatureDataBuilder failed")) } return b } @@ -336,8 +314,8 @@ func (b *_ActivateSessionRequest) CreateActivateSessionRequestBuilder() Activate /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ActivateSessionRequest) GetIdentifier() string { - return "467" +func (m *_ActivateSessionRequest) GetExtensionId() int32 { + return int32(467) } /////////////////////// @@ -354,26 +332,18 @@ func (m *_ActivateSessionRequest) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ActivateSessionRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_ActivateSessionRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_ActivateSessionRequest) GetClientSignature() ExtensionObjectDefinition { +func (m *_ActivateSessionRequest) GetClientSignature() SignatureData { return m.ClientSignature } -func (m *_ActivateSessionRequest) GetNoOfClientSoftwareCertificates() int32 { - return m.NoOfClientSoftwareCertificates -} - -func (m *_ActivateSessionRequest) GetClientSoftwareCertificates() []ExtensionObjectDefinition { +func (m *_ActivateSessionRequest) GetClientSoftwareCertificates() []SignedSoftwareCertificate { return m.ClientSoftwareCertificates } -func (m *_ActivateSessionRequest) GetNoOfLocaleIds() int32 { - return m.NoOfLocaleIds -} - func (m *_ActivateSessionRequest) GetLocaleIds() []PascalString { return m.LocaleIds } @@ -382,7 +352,7 @@ func (m *_ActivateSessionRequest) GetUserIdentityToken() ExtensionObject { return m.UserIdentityToken } -func (m *_ActivateSessionRequest) GetUserTokenSignature() ExtensionObjectDefinition { +func (m *_ActivateSessionRequest) GetUserTokenSignature() SignatureData { return m.UserTokenSignature } @@ -415,7 +385,7 @@ func (m *_ActivateSessionRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (clientSignature) lengthInBits += m.ClientSignature.GetLengthInBits(ctx) - // Simple field (noOfClientSoftwareCertificates) + // Implicit Field (noOfClientSoftwareCertificates) lengthInBits += 32 // Array field @@ -428,7 +398,7 @@ func (m *_ActivateSessionRequest) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32 // Array field @@ -454,7 +424,7 @@ func (m *_ActivateSessionRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ActivateSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__activateSessionRequest ActivateSessionRequest, err error) { +func (m *_ActivateSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__activateSessionRequest ActivateSessionRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -465,35 +435,35 @@ func (m *_ActivateSessionRequest) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - clientSignature, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "clientSignature", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("458")), readBuffer)) + clientSignature, err := ReadSimpleField[SignatureData](ctx, "clientSignature", ReadComplex[SignatureData](ExtensionObjectDefinitionParseWithBufferProducer[SignatureData]((int32)(int32(458))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'clientSignature' field")) } m.ClientSignature = clientSignature - noOfClientSoftwareCertificates, err := ReadSimpleField(ctx, "noOfClientSoftwareCertificates", ReadSignedInt(readBuffer, uint8(32))) + noOfClientSoftwareCertificates, err := ReadImplicitField[int32](ctx, "noOfClientSoftwareCertificates", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfClientSoftwareCertificates' field")) } - m.NoOfClientSoftwareCertificates = noOfClientSoftwareCertificates + _ = noOfClientSoftwareCertificates - clientSoftwareCertificates, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "clientSoftwareCertificates", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("346")), readBuffer), uint64(noOfClientSoftwareCertificates)) + clientSoftwareCertificates, err := ReadCountArrayField[SignedSoftwareCertificate](ctx, "clientSoftwareCertificates", ReadComplex[SignedSoftwareCertificate](ExtensionObjectDefinitionParseWithBufferProducer[SignedSoftwareCertificate]((int32)(int32(346))), readBuffer), uint64(noOfClientSoftwareCertificates)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'clientSoftwareCertificates' field")) } m.ClientSoftwareCertificates = clientSoftwareCertificates - noOfLocaleIds, err := ReadSimpleField(ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) } - m.NoOfLocaleIds = noOfLocaleIds + _ = noOfLocaleIds localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) if err != nil { @@ -501,13 +471,13 @@ func (m *_ActivateSessionRequest) parse(ctx context.Context, readBuffer utils.Re } m.LocaleIds = localeIds - userIdentityToken, err := ReadSimpleField[ExtensionObject](ctx, "userIdentityToken", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + userIdentityToken, err := ReadSimpleField[ExtensionObject](ctx, "userIdentityToken", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userIdentityToken' field")) } m.UserIdentityToken = userIdentityToken - userTokenSignature, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "userTokenSignature", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("458")), readBuffer)) + userTokenSignature, err := ReadSimpleField[SignatureData](ctx, "userTokenSignature", ReadComplex[SignatureData](ExtensionObjectDefinitionParseWithBufferProducer[SignatureData]((int32)(int32(458))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userTokenSignature' field")) } @@ -538,23 +508,23 @@ func (m *_ActivateSessionRequest) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for ActivateSessionRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "clientSignature", m.GetClientSignature(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[SignatureData](ctx, "clientSignature", m.GetClientSignature(), WriteComplex[SignatureData](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'clientSignature' field") } - - if err := WriteSimpleField[int32](ctx, "noOfClientSoftwareCertificates", m.GetNoOfClientSoftwareCertificates(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfClientSoftwareCertificates := int32(utils.InlineIf(bool((m.GetClientSoftwareCertificates()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetClientSoftwareCertificates()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfClientSoftwareCertificates", noOfClientSoftwareCertificates, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfClientSoftwareCertificates' field") } if err := WriteComplexTypeArrayField(ctx, "clientSoftwareCertificates", m.GetClientSoftwareCertificates(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'clientSoftwareCertificates' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLocaleIds", m.GetNoOfLocaleIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") } @@ -566,7 +536,7 @@ func (m *_ActivateSessionRequest) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(err, "Error serializing 'userIdentityToken' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "userTokenSignature", m.GetUserTokenSignature(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[SignatureData](ctx, "userTokenSignature", m.GetUserTokenSignature(), WriteComplex[SignatureData](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'userTokenSignature' field") } @@ -590,14 +560,12 @@ func (m *_ActivateSessionRequest) deepCopy() *_ActivateSessionRequest { } _ActivateSessionRequestCopy := &_ActivateSessionRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.ClientSignature.DeepCopy().(ExtensionObjectDefinition), - m.NoOfClientSoftwareCertificates, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ClientSoftwareCertificates), - m.NoOfLocaleIds, + m.RequestHeader.DeepCopy().(RequestHeader), + m.ClientSignature.DeepCopy().(SignatureData), + utils.DeepCopySlice[SignedSoftwareCertificate, SignedSoftwareCertificate](m.ClientSoftwareCertificates), utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), m.UserIdentityToken.DeepCopy().(ExtensionObject), - m.UserTokenSignature.DeepCopy().(ExtensionObjectDefinition), + m.UserTokenSignature.DeepCopy().(SignatureData), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ActivateSessionRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ActivateSessionResponse.go b/plc4go/protocols/opcua/readwrite/model/ActivateSessionResponse.go index 25c355a8bde..93503e99529 100644 --- a/plc4go/protocols/opcua/readwrite/model/ActivateSessionResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/ActivateSessionResponse.go @@ -41,15 +41,11 @@ type ActivateSessionResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetServerNonce returns ServerNonce (property field) GetServerNonce() PascalByteString - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsActivateSessionResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -61,21 +57,19 @@ type ActivateSessionResponse interface { // _ActivateSessionResponse is the data-structure of this message type _ActivateSessionResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - ServerNonce PascalByteString - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + ServerNonce PascalByteString + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ ActivateSessionResponse = (*_ActivateSessionResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ActivateSessionResponse)(nil) // NewActivateSessionResponse factory function for _ActivateSessionResponse -func NewActivateSessionResponse(responseHeader ExtensionObjectDefinition, serverNonce PascalByteString, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_ActivateSessionResponse { +func NewActivateSessionResponse(responseHeader ResponseHeader, serverNonce PascalByteString, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_ActivateSessionResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for ActivateSessionResponse must not be nil") + panic("responseHeader of type ResponseHeader for ActivateSessionResponse must not be nil") } if serverNonce == nil { panic("serverNonce of type PascalByteString for ActivateSessionResponse must not be nil") @@ -84,9 +78,7 @@ func NewActivateSessionResponse(responseHeader ExtensionObjectDefinition, server ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, ServerNonce: serverNonce, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -102,21 +94,17 @@ func NewActivateSessionResponse(responseHeader ExtensionObjectDefinition, server type ActivateSessionResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, serverNonce PascalByteString, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ActivateSessionResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, serverNonce PascalByteString, results []StatusCode, diagnosticInfos []DiagnosticInfo) ActivateSessionResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) ActivateSessionResponseBuilder + WithResponseHeader(ResponseHeader) ActivateSessionResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) ActivateSessionResponseBuilder // WithServerNonce adds ServerNonce (property field) WithServerNonce(PascalByteString) ActivateSessionResponseBuilder // WithServerNonceBuilder adds ServerNonce (property field) which is build by the builder WithServerNonceBuilder(func(PascalByteStringBuilder) PascalByteStringBuilder) ActivateSessionResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) ActivateSessionResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) ActivateSessionResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) ActivateSessionResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) ActivateSessionResponseBuilder // Build builds the ActivateSessionResponse or returns an error if something is wrong @@ -144,24 +132,24 @@ func (b *_ActivateSessionResponseBuilder) setParent(contract ExtensionObjectDefi b.ExtensionObjectDefinitionContract = contract } -func (b *_ActivateSessionResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, serverNonce PascalByteString, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ActivateSessionResponseBuilder { - return b.WithResponseHeader(responseHeader).WithServerNonce(serverNonce).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_ActivateSessionResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, serverNonce PascalByteString, results []StatusCode, diagnosticInfos []DiagnosticInfo) ActivateSessionResponseBuilder { + return b.WithResponseHeader(responseHeader).WithServerNonce(serverNonce).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_ActivateSessionResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) ActivateSessionResponseBuilder { +func (b *_ActivateSessionResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) ActivateSessionResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_ActivateSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ActivateSessionResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ActivateSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) ActivateSessionResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -184,21 +172,11 @@ func (b *_ActivateSessionResponseBuilder) WithServerNonceBuilder(builderSupplier return b } -func (b *_ActivateSessionResponseBuilder) WithNoOfResults(noOfResults int32) ActivateSessionResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_ActivateSessionResponseBuilder) WithResults(results ...StatusCode) ActivateSessionResponseBuilder { b.Results = results return b } -func (b *_ActivateSessionResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) ActivateSessionResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_ActivateSessionResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) ActivateSessionResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -266,8 +244,8 @@ func (b *_ActivateSessionResponse) CreateActivateSessionResponseBuilder() Activa /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ActivateSessionResponse) GetIdentifier() string { - return "470" +func (m *_ActivateSessionResponse) GetExtensionId() int32 { + return int32(470) } /////////////////////// @@ -284,7 +262,7 @@ func (m *_ActivateSessionResponse) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ActivateSessionResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_ActivateSessionResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -292,18 +270,10 @@ func (m *_ActivateSessionResponse) GetServerNonce() PascalByteString { return m.ServerNonce } -func (m *_ActivateSessionResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_ActivateSessionResponse) GetResults() []StatusCode { return m.Results } -func (m *_ActivateSessionResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_ActivateSessionResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -337,7 +307,7 @@ func (m *_ActivateSessionResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (serverNonce) lengthInBits += m.ServerNonce.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -350,7 +320,7 @@ func (m *_ActivateSessionResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -370,7 +340,7 @@ func (m *_ActivateSessionResponse) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_ActivateSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__activateSessionResponse ActivateSessionResponse, err error) { +func (m *_ActivateSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__activateSessionResponse ActivateSessionResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -381,7 +351,7 @@ func (m *_ActivateSessionResponse) parse(ctx context.Context, readBuffer utils.R currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -393,11 +363,11 @@ func (m *_ActivateSessionResponse) parse(ctx context.Context, readBuffer utils.R } m.ServerNonce = serverNonce - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -405,11 +375,11 @@ func (m *_ActivateSessionResponse) parse(ctx context.Context, readBuffer utils.R } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -442,23 +412,23 @@ func (m *_ActivateSessionResponse) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for ActivateSessionResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } if err := WriteSimpleField[PascalByteString](ctx, "serverNonce", m.GetServerNonce(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'serverNonce' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -486,11 +456,9 @@ func (m *_ActivateSessionResponse) deepCopy() *_ActivateSessionResponse { } _ActivateSessionResponseCopy := &_ActivateSessionResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.ServerNonce.DeepCopy().(PascalByteString), - m.NoOfResults, utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/AddNodesItem.go b/plc4go/protocols/opcua/readwrite/model/AddNodesItem.go index 1317daff945..d152e249793 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddNodesItem.go +++ b/plc4go/protocols/opcua/readwrite/model/AddNodesItem.go @@ -373,8 +373,8 @@ func (b *_AddNodesItem) CreateAddNodesItemBuilder() AddNodesItemBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddNodesItem) GetIdentifier() string { - return "378" +func (m *_AddNodesItem) GetExtensionId() int32 { + return int32(378) } /////////////////////// @@ -470,7 +470,7 @@ func (m *_AddNodesItem) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddNodesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addNodesItem AddNodesItem, err error) { +func (m *_AddNodesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addNodesItem AddNodesItem, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -511,7 +511,7 @@ func (m *_AddNodesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.NodeClass = nodeClass - nodeAttributes, err := ReadSimpleField[ExtensionObject](ctx, "nodeAttributes", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + nodeAttributes, err := ReadSimpleField[ExtensionObject](ctx, "nodeAttributes", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeAttributes' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/AddNodesRequest.go b/plc4go/protocols/opcua/readwrite/model/AddNodesRequest.go index 776d26e77a3..d85bc6fda68 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddNodesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/AddNodesRequest.go @@ -41,11 +41,9 @@ type AddNodesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfNodesToAdd returns NoOfNodesToAdd (property field) - GetNoOfNodesToAdd() int32 + GetRequestHeader() RequestHeader // GetNodesToAdd returns NodesToAdd (property field) - GetNodesToAdd() []ExtensionObjectDefinition + GetNodesToAdd() []AddNodesItem // IsAddNodesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsAddNodesRequest() // CreateBuilder creates a AddNodesRequestBuilder @@ -55,23 +53,21 @@ type AddNodesRequest interface { // _AddNodesRequest is the data-structure of this message type _AddNodesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfNodesToAdd int32 - NodesToAdd []ExtensionObjectDefinition + RequestHeader RequestHeader + NodesToAdd []AddNodesItem } var _ AddNodesRequest = (*_AddNodesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AddNodesRequest)(nil) // NewAddNodesRequest factory function for _AddNodesRequest -func NewAddNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToAdd int32, nodesToAdd []ExtensionObjectDefinition) *_AddNodesRequest { +func NewAddNodesRequest(requestHeader RequestHeader, nodesToAdd []AddNodesItem) *_AddNodesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for AddNodesRequest must not be nil") + panic("requestHeader of type RequestHeader for AddNodesRequest must not be nil") } _result := &_AddNodesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfNodesToAdd: noOfNodesToAdd, NodesToAdd: nodesToAdd, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewAddNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToAdd type AddNodesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToAdd int32, nodesToAdd []ExtensionObjectDefinition) AddNodesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, nodesToAdd []AddNodesItem) AddNodesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) AddNodesRequestBuilder + WithRequestHeader(RequestHeader) AddNodesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddNodesRequestBuilder - // WithNoOfNodesToAdd adds NoOfNodesToAdd (property field) - WithNoOfNodesToAdd(int32) AddNodesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) AddNodesRequestBuilder // WithNodesToAdd adds NodesToAdd (property field) - WithNodesToAdd(...ExtensionObjectDefinition) AddNodesRequestBuilder + WithNodesToAdd(...AddNodesItem) AddNodesRequestBuilder // Build builds the AddNodesRequest or returns an error if something is wrong Build() (AddNodesRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_AddNodesRequestBuilder) setParent(contract ExtensionObjectDefinitionCo b.ExtensionObjectDefinitionContract = contract } -func (b *_AddNodesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToAdd int32, nodesToAdd []ExtensionObjectDefinition) AddNodesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfNodesToAdd(noOfNodesToAdd).WithNodesToAdd(nodesToAdd...) +func (b *_AddNodesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, nodesToAdd []AddNodesItem) AddNodesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithNodesToAdd(nodesToAdd...) } -func (b *_AddNodesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) AddNodesRequestBuilder { +func (b *_AddNodesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) AddNodesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_AddNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddNodesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_AddNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) AddNodesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_AddNodesRequestBuilder) WithNoOfNodesToAdd(noOfNodesToAdd int32) AddNodesRequestBuilder { - b.NoOfNodesToAdd = noOfNodesToAdd - return b -} - -func (b *_AddNodesRequestBuilder) WithNodesToAdd(nodesToAdd ...ExtensionObjectDefinition) AddNodesRequestBuilder { +func (b *_AddNodesRequestBuilder) WithNodesToAdd(nodesToAdd ...AddNodesItem) AddNodesRequestBuilder { b.NodesToAdd = nodesToAdd return b } @@ -209,8 +198,8 @@ func (b *_AddNodesRequest) CreateAddNodesRequestBuilder() AddNodesRequestBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddNodesRequest) GetIdentifier() string { - return "488" +func (m *_AddNodesRequest) GetExtensionId() int32 { + return int32(488) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_AddNodesRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AddNodesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_AddNodesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_AddNodesRequest) GetNoOfNodesToAdd() int32 { - return m.NoOfNodesToAdd -} - -func (m *_AddNodesRequest) GetNodesToAdd() []ExtensionObjectDefinition { +func (m *_AddNodesRequest) GetNodesToAdd() []AddNodesItem { return m.NodesToAdd } @@ -265,7 +250,7 @@ func (m *_AddNodesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfNodesToAdd) + // Implicit Field (noOfNodesToAdd) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_AddNodesRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addNodesRequest AddNodesRequest, err error) { +func (m *_AddNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addNodesRequest AddNodesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_AddNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffe currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfNodesToAdd, err := ReadSimpleField(ctx, "noOfNodesToAdd", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToAdd, err := ReadImplicitField[int32](ctx, "noOfNodesToAdd", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToAdd' field")) } - m.NoOfNodesToAdd = noOfNodesToAdd + _ = noOfNodesToAdd - nodesToAdd, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToAdd", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("378")), readBuffer), uint64(noOfNodesToAdd)) + nodesToAdd, err := ReadCountArrayField[AddNodesItem](ctx, "nodesToAdd", ReadComplex[AddNodesItem](ExtensionObjectDefinitionParseWithBufferProducer[AddNodesItem]((int32)(int32(378))), readBuffer), uint64(noOfNodesToAdd)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToAdd' field")) } @@ -339,11 +324,11 @@ func (m *_AddNodesRequest) SerializeWithWriteBuffer(ctx context.Context, writeBu return errors.Wrap(pushErr, "Error pushing for AddNodesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToAdd", m.GetNoOfNodesToAdd(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToAdd := int32(utils.InlineIf(bool((m.GetNodesToAdd()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToAdd()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToAdd", noOfNodesToAdd, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToAdd' field") } @@ -371,9 +356,8 @@ func (m *_AddNodesRequest) deepCopy() *_AddNodesRequest { } _AddNodesRequestCopy := &_AddNodesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodesToAdd, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToAdd), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[AddNodesItem, AddNodesItem](m.NodesToAdd), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _AddNodesRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/AddNodesResponse.go b/plc4go/protocols/opcua/readwrite/model/AddNodesResponse.go index 953fef2a809..d33712d57f2 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddNodesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/AddNodesResponse.go @@ -41,13 +41,9 @@ type AddNodesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []AddNodesResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsAddNodesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type AddNodesResponse interface { // _AddNodesResponse is the data-structure of this message type _AddNodesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []AddNodesResult + DiagnosticInfos []DiagnosticInfo } var _ AddNodesResponse = (*_AddNodesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AddNodesResponse)(nil) // NewAddNodesResponse factory function for _AddNodesResponse -func NewAddNodesResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_AddNodesResponse { +func NewAddNodesResponse(responseHeader ResponseHeader, results []AddNodesResult, diagnosticInfos []DiagnosticInfo) *_AddNodesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for AddNodesResponse must not be nil") + panic("responseHeader of type ResponseHeader for AddNodesResponse must not be nil") } _result := &_AddNodesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewAddNodesResponse(responseHeader ExtensionObjectDefinition, noOfResults i type AddNodesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) AddNodesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []AddNodesResult, diagnosticInfos []DiagnosticInfo) AddNodesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) AddNodesResponseBuilder + WithResponseHeader(ResponseHeader) AddNodesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddNodesResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) AddNodesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) AddNodesResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) AddNodesResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) AddNodesResponseBuilder + WithResults(...AddNodesResult) AddNodesResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) AddNodesResponseBuilder // Build builds the AddNodesResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_AddNodesResponseBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_AddNodesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) AddNodesResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_AddNodesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []AddNodesResult, diagnosticInfos []DiagnosticInfo) AddNodesResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_AddNodesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) AddNodesResponseBuilder { +func (b *_AddNodesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) AddNodesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_AddNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddNodesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_AddNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) AddNodesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_AddNodesResponseBuilder) WithNoOfResults(noOfResults int32) AddNodesResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_AddNodesResponseBuilder) WithResults(results ...ExtensionObjectDefinition) AddNodesResponseBuilder { +func (b *_AddNodesResponseBuilder) WithResults(results ...AddNodesResult) AddNodesResponseBuilder { b.Results = results return b } -func (b *_AddNodesResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) AddNodesResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_AddNodesResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) AddNodesResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_AddNodesResponse) CreateAddNodesResponseBuilder() AddNodesResponseBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddNodesResponse) GetIdentifier() string { - return "491" +func (m *_AddNodesResponse) GetExtensionId() int32 { + return int32(491) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_AddNodesResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AddNodesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_AddNodesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_AddNodesResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_AddNodesResponse) GetResults() []ExtensionObjectDefinition { +func (m *_AddNodesResponse) GetResults() []AddNodesResult { return m.Results } -func (m *_AddNodesResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_AddNodesResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_AddNodesResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_AddNodesResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_AddNodesResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addNodesResponse AddNodesResponse, err error) { +func (m *_AddNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addNodesResponse AddNodesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_AddNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuff currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("485")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[AddNodesResult](ctx, "results", ReadComplex[AddNodesResult](ExtensionObjectDefinitionParseWithBufferProducer[AddNodesResult]((int32)(int32(485))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_AddNodesResponse) SerializeWithWriteBuffer(ctx context.Context, writeB return errors.Wrap(pushErr, "Error pushing for AddNodesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_AddNodesResponse) deepCopy() *_AddNodesResponse { } _AddNodesResponseCopy := &_AddNodesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[AddNodesResult, AddNodesResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/AddNodesResult.go b/plc4go/protocols/opcua/readwrite/model/AddNodesResult.go index 592267b8de3..00b60b7365c 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddNodesResult.go +++ b/plc4go/protocols/opcua/readwrite/model/AddNodesResult.go @@ -222,8 +222,8 @@ func (b *_AddNodesResult) CreateAddNodesResultBuilder() AddNodesResultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddNodesResult) GetIdentifier() string { - return "485" +func (m *_AddNodesResult) GetExtensionId() int32 { + return int32(485) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_AddNodesResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddNodesResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addNodesResult AddNodesResult, err error) { +func (m *_AddNodesResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addNodesResult AddNodesResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/AddReferencesItem.go b/plc4go/protocols/opcua/readwrite/model/AddReferencesItem.go index a0b89f6b5ee..cae4f8732f8 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddReferencesItem.go +++ b/plc4go/protocols/opcua/readwrite/model/AddReferencesItem.go @@ -316,8 +316,8 @@ func (b *_AddReferencesItem) CreateAddReferencesItemBuilder() AddReferencesItemB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddReferencesItem) GetIdentifier() string { - return "381" +func (m *_AddReferencesItem) GetExtensionId() int32 { + return int32(381) } /////////////////////// @@ -409,7 +409,7 @@ func (m *_AddReferencesItem) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddReferencesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addReferencesItem AddReferencesItem, err error) { +func (m *_AddReferencesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addReferencesItem AddReferencesItem, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/AddReferencesRequest.go b/plc4go/protocols/opcua/readwrite/model/AddReferencesRequest.go index ccf94d145dc..20b38651570 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddReferencesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/AddReferencesRequest.go @@ -41,11 +41,9 @@ type AddReferencesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfReferencesToAdd returns NoOfReferencesToAdd (property field) - GetNoOfReferencesToAdd() int32 + GetRequestHeader() RequestHeader // GetReferencesToAdd returns ReferencesToAdd (property field) - GetReferencesToAdd() []ExtensionObjectDefinition + GetReferencesToAdd() []AddReferencesItem // IsAddReferencesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsAddReferencesRequest() // CreateBuilder creates a AddReferencesRequestBuilder @@ -55,23 +53,21 @@ type AddReferencesRequest interface { // _AddReferencesRequest is the data-structure of this message type _AddReferencesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfReferencesToAdd int32 - ReferencesToAdd []ExtensionObjectDefinition + RequestHeader RequestHeader + ReferencesToAdd []AddReferencesItem } var _ AddReferencesRequest = (*_AddReferencesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AddReferencesRequest)(nil) // NewAddReferencesRequest factory function for _AddReferencesRequest -func NewAddReferencesRequest(requestHeader ExtensionObjectDefinition, noOfReferencesToAdd int32, referencesToAdd []ExtensionObjectDefinition) *_AddReferencesRequest { +func NewAddReferencesRequest(requestHeader RequestHeader, referencesToAdd []AddReferencesItem) *_AddReferencesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for AddReferencesRequest must not be nil") + panic("requestHeader of type RequestHeader for AddReferencesRequest must not be nil") } _result := &_AddReferencesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfReferencesToAdd: noOfReferencesToAdd, ReferencesToAdd: referencesToAdd, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewAddReferencesRequest(requestHeader ExtensionObjectDefinition, noOfRefere type AddReferencesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfReferencesToAdd int32, referencesToAdd []ExtensionObjectDefinition) AddReferencesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, referencesToAdd []AddReferencesItem) AddReferencesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) AddReferencesRequestBuilder + WithRequestHeader(RequestHeader) AddReferencesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddReferencesRequestBuilder - // WithNoOfReferencesToAdd adds NoOfReferencesToAdd (property field) - WithNoOfReferencesToAdd(int32) AddReferencesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) AddReferencesRequestBuilder // WithReferencesToAdd adds ReferencesToAdd (property field) - WithReferencesToAdd(...ExtensionObjectDefinition) AddReferencesRequestBuilder + WithReferencesToAdd(...AddReferencesItem) AddReferencesRequestBuilder // Build builds the AddReferencesRequest or returns an error if something is wrong Build() (AddReferencesRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_AddReferencesRequestBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_AddReferencesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfReferencesToAdd int32, referencesToAdd []ExtensionObjectDefinition) AddReferencesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfReferencesToAdd(noOfReferencesToAdd).WithReferencesToAdd(referencesToAdd...) +func (b *_AddReferencesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, referencesToAdd []AddReferencesItem) AddReferencesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithReferencesToAdd(referencesToAdd...) } -func (b *_AddReferencesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) AddReferencesRequestBuilder { +func (b *_AddReferencesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) AddReferencesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_AddReferencesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddReferencesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_AddReferencesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) AddReferencesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_AddReferencesRequestBuilder) WithNoOfReferencesToAdd(noOfReferencesToAdd int32) AddReferencesRequestBuilder { - b.NoOfReferencesToAdd = noOfReferencesToAdd - return b -} - -func (b *_AddReferencesRequestBuilder) WithReferencesToAdd(referencesToAdd ...ExtensionObjectDefinition) AddReferencesRequestBuilder { +func (b *_AddReferencesRequestBuilder) WithReferencesToAdd(referencesToAdd ...AddReferencesItem) AddReferencesRequestBuilder { b.ReferencesToAdd = referencesToAdd return b } @@ -209,8 +198,8 @@ func (b *_AddReferencesRequest) CreateAddReferencesRequestBuilder() AddReference /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddReferencesRequest) GetIdentifier() string { - return "494" +func (m *_AddReferencesRequest) GetExtensionId() int32 { + return int32(494) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_AddReferencesRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AddReferencesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_AddReferencesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_AddReferencesRequest) GetNoOfReferencesToAdd() int32 { - return m.NoOfReferencesToAdd -} - -func (m *_AddReferencesRequest) GetReferencesToAdd() []ExtensionObjectDefinition { +func (m *_AddReferencesRequest) GetReferencesToAdd() []AddReferencesItem { return m.ReferencesToAdd } @@ -265,7 +250,7 @@ func (m *_AddReferencesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfReferencesToAdd) + // Implicit Field (noOfReferencesToAdd) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_AddReferencesRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddReferencesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addReferencesRequest AddReferencesRequest, err error) { +func (m *_AddReferencesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addReferencesRequest AddReferencesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_AddReferencesRequest) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfReferencesToAdd, err := ReadSimpleField(ctx, "noOfReferencesToAdd", ReadSignedInt(readBuffer, uint8(32))) + noOfReferencesToAdd, err := ReadImplicitField[int32](ctx, "noOfReferencesToAdd", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReferencesToAdd' field")) } - m.NoOfReferencesToAdd = noOfReferencesToAdd + _ = noOfReferencesToAdd - referencesToAdd, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "referencesToAdd", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("381")), readBuffer), uint64(noOfReferencesToAdd)) + referencesToAdd, err := ReadCountArrayField[AddReferencesItem](ctx, "referencesToAdd", ReadComplex[AddReferencesItem](ExtensionObjectDefinitionParseWithBufferProducer[AddReferencesItem]((int32)(int32(381))), readBuffer), uint64(noOfReferencesToAdd)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'referencesToAdd' field")) } @@ -339,11 +324,11 @@ func (m *_AddReferencesRequest) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for AddReferencesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReferencesToAdd", m.GetNoOfReferencesToAdd(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReferencesToAdd := int32(utils.InlineIf(bool((m.GetReferencesToAdd()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReferencesToAdd()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReferencesToAdd", noOfReferencesToAdd, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReferencesToAdd' field") } @@ -371,9 +356,8 @@ func (m *_AddReferencesRequest) deepCopy() *_AddReferencesRequest { } _AddReferencesRequestCopy := &_AddReferencesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfReferencesToAdd, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ReferencesToAdd), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[AddReferencesItem, AddReferencesItem](m.ReferencesToAdd), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _AddReferencesRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/AddReferencesResponse.go b/plc4go/protocols/opcua/readwrite/model/AddReferencesResponse.go index b1d373c370f..b91f935d532 100644 --- a/plc4go/protocols/opcua/readwrite/model/AddReferencesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/AddReferencesResponse.go @@ -41,13 +41,9 @@ type AddReferencesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsAddReferencesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type AddReferencesResponse interface { // _AddReferencesResponse is the data-structure of this message type _AddReferencesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ AddReferencesResponse = (*_AddReferencesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AddReferencesResponse)(nil) // NewAddReferencesResponse factory function for _AddReferencesResponse -func NewAddReferencesResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_AddReferencesResponse { +func NewAddReferencesResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_AddReferencesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for AddReferencesResponse must not be nil") + panic("responseHeader of type ResponseHeader for AddReferencesResponse must not be nil") } _result := &_AddReferencesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewAddReferencesResponse(responseHeader ExtensionObjectDefinition, noOfResu type AddReferencesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) AddReferencesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) AddReferencesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) AddReferencesResponseBuilder + WithResponseHeader(ResponseHeader) AddReferencesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddReferencesResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) AddReferencesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) AddReferencesResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) AddReferencesResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) AddReferencesResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) AddReferencesResponseBuilder // Build builds the AddReferencesResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_AddReferencesResponseBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_AddReferencesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) AddReferencesResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_AddReferencesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) AddReferencesResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_AddReferencesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) AddReferencesResponseBuilder { +func (b *_AddReferencesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) AddReferencesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_AddReferencesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AddReferencesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_AddReferencesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) AddReferencesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_AddReferencesResponseBuilder) WithNoOfResults(noOfResults int32) AddReferencesResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_AddReferencesResponseBuilder) WithResults(results ...StatusCode) AddReferencesResponseBuilder { b.Results = results return b } -func (b *_AddReferencesResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) AddReferencesResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_AddReferencesResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) AddReferencesResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_AddReferencesResponse) CreateAddReferencesResponseBuilder() AddReferen /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AddReferencesResponse) GetIdentifier() string { - return "497" +func (m *_AddReferencesResponse) GetExtensionId() int32 { + return int32(497) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_AddReferencesResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AddReferencesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_AddReferencesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_AddReferencesResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_AddReferencesResponse) GetResults() []StatusCode { return m.Results } -func (m *_AddReferencesResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_AddReferencesResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_AddReferencesResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_AddReferencesResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_AddReferencesResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AddReferencesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__addReferencesResponse AddReferencesResponse, err error) { +func (m *_AddReferencesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__addReferencesResponse AddReferencesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_AddReferencesResponse) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_AddReferencesResponse) parse(ctx context.Context, readBuffer utils.Rea } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_AddReferencesResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for AddReferencesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_AddReferencesResponse) deepCopy() *_AddReferencesResponse { } _AddReferencesResponseCopy := &_AddReferencesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/AdditionalParametersType.go b/plc4go/protocols/opcua/readwrite/model/AdditionalParametersType.go index 60da881d170..7b13d8f5f86 100644 --- a/plc4go/protocols/opcua/readwrite/model/AdditionalParametersType.go +++ b/plc4go/protocols/opcua/readwrite/model/AdditionalParametersType.go @@ -40,10 +40,8 @@ type AdditionalParametersType interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfParameters returns NoOfParameters (property field) - GetNoOfParameters() int32 // GetParameters returns Parameters (property field) - GetParameters() []ExtensionObjectDefinition + GetParameters() []KeyValuePair // IsAdditionalParametersType is a marker method to prevent unintentional type checks (interfaces of same signature) IsAdditionalParametersType() // CreateBuilder creates a AdditionalParametersTypeBuilder @@ -53,18 +51,16 @@ type AdditionalParametersType interface { // _AdditionalParametersType is the data-structure of this message type _AdditionalParametersType struct { ExtensionObjectDefinitionContract - NoOfParameters int32 - Parameters []ExtensionObjectDefinition + Parameters []KeyValuePair } var _ AdditionalParametersType = (*_AdditionalParametersType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AdditionalParametersType)(nil) // NewAdditionalParametersType factory function for _AdditionalParametersType -func NewAdditionalParametersType(noOfParameters int32, parameters []ExtensionObjectDefinition) *_AdditionalParametersType { +func NewAdditionalParametersType(parameters []KeyValuePair) *_AdditionalParametersType { _result := &_AdditionalParametersType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfParameters: noOfParameters, Parameters: parameters, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,11 +76,9 @@ func NewAdditionalParametersType(noOfParameters int32, parameters []ExtensionObj type AdditionalParametersTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfParameters int32, parameters []ExtensionObjectDefinition) AdditionalParametersTypeBuilder - // WithNoOfParameters adds NoOfParameters (property field) - WithNoOfParameters(int32) AdditionalParametersTypeBuilder + WithMandatoryFields(parameters []KeyValuePair) AdditionalParametersTypeBuilder // WithParameters adds Parameters (property field) - WithParameters(...ExtensionObjectDefinition) AdditionalParametersTypeBuilder + WithParameters(...KeyValuePair) AdditionalParametersTypeBuilder // Build builds the AdditionalParametersType or returns an error if something is wrong Build() (AdditionalParametersType, error) // MustBuild does the same as Build but panics on error @@ -110,16 +104,11 @@ func (b *_AdditionalParametersTypeBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_AdditionalParametersTypeBuilder) WithMandatoryFields(noOfParameters int32, parameters []ExtensionObjectDefinition) AdditionalParametersTypeBuilder { - return b.WithNoOfParameters(noOfParameters).WithParameters(parameters...) +func (b *_AdditionalParametersTypeBuilder) WithMandatoryFields(parameters []KeyValuePair) AdditionalParametersTypeBuilder { + return b.WithParameters(parameters...) } -func (b *_AdditionalParametersTypeBuilder) WithNoOfParameters(noOfParameters int32) AdditionalParametersTypeBuilder { - b.NoOfParameters = noOfParameters - return b -} - -func (b *_AdditionalParametersTypeBuilder) WithParameters(parameters ...ExtensionObjectDefinition) AdditionalParametersTypeBuilder { +func (b *_AdditionalParametersTypeBuilder) WithParameters(parameters ...KeyValuePair) AdditionalParametersTypeBuilder { b.Parameters = parameters return b } @@ -174,8 +163,8 @@ func (b *_AdditionalParametersType) CreateAdditionalParametersTypeBuilder() Addi /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AdditionalParametersType) GetIdentifier() string { - return "16315" +func (m *_AdditionalParametersType) GetExtensionId() int32 { + return int32(16315) } /////////////////////// @@ -192,11 +181,7 @@ func (m *_AdditionalParametersType) GetParent() ExtensionObjectDefinitionContrac /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AdditionalParametersType) GetNoOfParameters() int32 { - return m.NoOfParameters -} - -func (m *_AdditionalParametersType) GetParameters() []ExtensionObjectDefinition { +func (m *_AdditionalParametersType) GetParameters() []KeyValuePair { return m.Parameters } @@ -223,7 +208,7 @@ func (m *_AdditionalParametersType) GetTypeName() string { func (m *_AdditionalParametersType) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfParameters) + // Implicit Field (noOfParameters) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_AdditionalParametersType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_AdditionalParametersType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__additionalParametersType AdditionalParametersType, err error) { +func (m *_AdditionalParametersType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__additionalParametersType AdditionalParametersType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,13 +239,13 @@ func (m *_AdditionalParametersType) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - noOfParameters, err := ReadSimpleField(ctx, "noOfParameters", ReadSignedInt(readBuffer, uint8(32))) + noOfParameters, err := ReadImplicitField[int32](ctx, "noOfParameters", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfParameters' field")) } - m.NoOfParameters = noOfParameters + _ = noOfParameters - parameters, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "parameters", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfParameters)) + parameters, err := ReadCountArrayField[KeyValuePair](ctx, "parameters", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfParameters)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'parameters' field")) } @@ -290,8 +275,8 @@ func (m *_AdditionalParametersType) SerializeWithWriteBuffer(ctx context.Context if pushErr := writeBuffer.PushContext("AdditionalParametersType"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for AdditionalParametersType") } - - if err := WriteSimpleField[int32](ctx, "noOfParameters", m.GetNoOfParameters(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfParameters := int32(utils.InlineIf(bool((m.GetParameters()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetParameters()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfParameters", noOfParameters, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfParameters' field") } @@ -319,8 +304,7 @@ func (m *_AdditionalParametersType) deepCopy() *_AdditionalParametersType { } _AdditionalParametersTypeCopy := &_AdditionalParametersType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfParameters, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Parameters), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.Parameters), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _AdditionalParametersTypeCopy diff --git a/plc4go/protocols/opcua/readwrite/model/AggregateConfiguration.go b/plc4go/protocols/opcua/readwrite/model/AggregateConfiguration.go index e808624035e..3d1f67a73cf 100644 --- a/plc4go/protocols/opcua/readwrite/model/AggregateConfiguration.go +++ b/plc4go/protocols/opcua/readwrite/model/AggregateConfiguration.go @@ -210,8 +210,8 @@ func (b *_AggregateConfiguration) CreateAggregateConfigurationBuilder() Aggregat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AggregateConfiguration) GetIdentifier() string { - return "950" +func (m *_AggregateConfiguration) GetExtensionId() int32 { + return int32(950) } /////////////////////// @@ -299,7 +299,7 @@ func (m *_AggregateConfiguration) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AggregateConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__aggregateConfiguration AggregateConfiguration, err error) { +func (m *_AggregateConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__aggregateConfiguration AggregateConfiguration, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/AggregateFilter.go b/plc4go/protocols/opcua/readwrite/model/AggregateFilter.go new file mode 100644 index 00000000000..a22e6802cd8 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/AggregateFilter.go @@ -0,0 +1,441 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// AggregateFilter is the corresponding interface of AggregateFilter +type AggregateFilter interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetAggregateType returns AggregateType (property field) + GetAggregateType() NodeId + // GetProcessingInterval returns ProcessingInterval (property field) + GetProcessingInterval() float64 + // GetAggregateConfiguration returns AggregateConfiguration (property field) + GetAggregateConfiguration() AggregateConfiguration + // IsAggregateFilter is a marker method to prevent unintentional type checks (interfaces of same signature) + IsAggregateFilter() + // CreateBuilder creates a AggregateFilterBuilder + CreateAggregateFilterBuilder() AggregateFilterBuilder +} + +// _AggregateFilter is the data-structure of this message +type _AggregateFilter struct { + ExtensionObjectDefinitionContract + StartTime int64 + AggregateType NodeId + ProcessingInterval float64 + AggregateConfiguration AggregateConfiguration +} + +var _ AggregateFilter = (*_AggregateFilter)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_AggregateFilter)(nil) + +// NewAggregateFilter factory function for _AggregateFilter +func NewAggregateFilter(startTime int64, aggregateType NodeId, processingInterval float64, aggregateConfiguration AggregateConfiguration) *_AggregateFilter { + if aggregateType == nil { + panic("aggregateType of type NodeId for AggregateFilter must not be nil") + } + if aggregateConfiguration == nil { + panic("aggregateConfiguration of type AggregateConfiguration for AggregateFilter must not be nil") + } + _result := &_AggregateFilter{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + StartTime: startTime, + AggregateType: aggregateType, + ProcessingInterval: processingInterval, + AggregateConfiguration: aggregateConfiguration, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// AggregateFilterBuilder is a builder for AggregateFilter +type AggregateFilterBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(startTime int64, aggregateType NodeId, processingInterval float64, aggregateConfiguration AggregateConfiguration) AggregateFilterBuilder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) AggregateFilterBuilder + // WithAggregateType adds AggregateType (property field) + WithAggregateType(NodeId) AggregateFilterBuilder + // WithAggregateTypeBuilder adds AggregateType (property field) which is build by the builder + WithAggregateTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) AggregateFilterBuilder + // WithProcessingInterval adds ProcessingInterval (property field) + WithProcessingInterval(float64) AggregateFilterBuilder + // WithAggregateConfiguration adds AggregateConfiguration (property field) + WithAggregateConfiguration(AggregateConfiguration) AggregateFilterBuilder + // WithAggregateConfigurationBuilder adds AggregateConfiguration (property field) which is build by the builder + WithAggregateConfigurationBuilder(func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) AggregateFilterBuilder + // Build builds the AggregateFilter or returns an error if something is wrong + Build() (AggregateFilter, error) + // MustBuild does the same as Build but panics on error + MustBuild() AggregateFilter +} + +// NewAggregateFilterBuilder() creates a AggregateFilterBuilder +func NewAggregateFilterBuilder() AggregateFilterBuilder { + return &_AggregateFilterBuilder{_AggregateFilter: new(_AggregateFilter)} +} + +type _AggregateFilterBuilder struct { + *_AggregateFilter + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (AggregateFilterBuilder) = (*_AggregateFilterBuilder)(nil) + +func (b *_AggregateFilterBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_AggregateFilterBuilder) WithMandatoryFields(startTime int64, aggregateType NodeId, processingInterval float64, aggregateConfiguration AggregateConfiguration) AggregateFilterBuilder { + return b.WithStartTime(startTime).WithAggregateType(aggregateType).WithProcessingInterval(processingInterval).WithAggregateConfiguration(aggregateConfiguration) +} + +func (b *_AggregateFilterBuilder) WithStartTime(startTime int64) AggregateFilterBuilder { + b.StartTime = startTime + return b +} + +func (b *_AggregateFilterBuilder) WithAggregateType(aggregateType NodeId) AggregateFilterBuilder { + b.AggregateType = aggregateType + return b +} + +func (b *_AggregateFilterBuilder) WithAggregateTypeBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) AggregateFilterBuilder { + builder := builderSupplier(b.AggregateType.CreateNodeIdBuilder()) + var err error + b.AggregateType, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_AggregateFilterBuilder) WithProcessingInterval(processingInterval float64) AggregateFilterBuilder { + b.ProcessingInterval = processingInterval + return b +} + +func (b *_AggregateFilterBuilder) WithAggregateConfiguration(aggregateConfiguration AggregateConfiguration) AggregateFilterBuilder { + b.AggregateConfiguration = aggregateConfiguration + return b +} + +func (b *_AggregateFilterBuilder) WithAggregateConfigurationBuilder(builderSupplier func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) AggregateFilterBuilder { + builder := builderSupplier(b.AggregateConfiguration.CreateAggregateConfigurationBuilder()) + var err error + b.AggregateConfiguration, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "AggregateConfigurationBuilder failed")) + } + return b +} + +func (b *_AggregateFilterBuilder) Build() (AggregateFilter, error) { + if b.AggregateType == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'aggregateType' not set")) + } + if b.AggregateConfiguration == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'aggregateConfiguration' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._AggregateFilter.deepCopy(), nil +} + +func (b *_AggregateFilterBuilder) MustBuild() AggregateFilter { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_AggregateFilterBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_AggregateFilterBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_AggregateFilterBuilder) DeepCopy() any { + _copy := b.CreateAggregateFilterBuilder().(*_AggregateFilterBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateAggregateFilterBuilder creates a AggregateFilterBuilder +func (b *_AggregateFilter) CreateAggregateFilterBuilder() AggregateFilterBuilder { + if b == nil { + return NewAggregateFilterBuilder() + } + return &_AggregateFilterBuilder{_AggregateFilter: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_AggregateFilter) GetExtensionId() int32 { + return int32(730) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_AggregateFilter) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_AggregateFilter) GetStartTime() int64 { + return m.StartTime +} + +func (m *_AggregateFilter) GetAggregateType() NodeId { + return m.AggregateType +} + +func (m *_AggregateFilter) GetProcessingInterval() float64 { + return m.ProcessingInterval +} + +func (m *_AggregateFilter) GetAggregateConfiguration() AggregateConfiguration { + return m.AggregateConfiguration +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastAggregateFilter(structType any) AggregateFilter { + if casted, ok := structType.(AggregateFilter); ok { + return casted + } + if casted, ok := structType.(*AggregateFilter); ok { + return *casted + } + return nil +} + +func (m *_AggregateFilter) GetTypeName() string { + return "AggregateFilter" +} + +func (m *_AggregateFilter) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (aggregateType) + lengthInBits += m.AggregateType.GetLengthInBits(ctx) + + // Simple field (processingInterval) + lengthInBits += 64 + + // Simple field (aggregateConfiguration) + lengthInBits += m.AggregateConfiguration.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_AggregateFilter) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_AggregateFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__aggregateFilter AggregateFilter, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("AggregateFilter"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for AggregateFilter") + } + currentPos := positionAware.GetPos() + _ = currentPos + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + aggregateType, err := ReadSimpleField[NodeId](ctx, "aggregateType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'aggregateType' field")) + } + m.AggregateType = aggregateType + + processingInterval, err := ReadSimpleField(ctx, "processingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'processingInterval' field")) + } + m.ProcessingInterval = processingInterval + + aggregateConfiguration, err := ReadSimpleField[AggregateConfiguration](ctx, "aggregateConfiguration", ReadComplex[AggregateConfiguration](ExtensionObjectDefinitionParseWithBufferProducer[AggregateConfiguration]((int32)(int32(950))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'aggregateConfiguration' field")) + } + m.AggregateConfiguration = aggregateConfiguration + + if closeErr := readBuffer.CloseContext("AggregateFilter"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for AggregateFilter") + } + + return m, nil +} + +func (m *_AggregateFilter) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_AggregateFilter) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("AggregateFilter"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for AggregateFilter") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[NodeId](ctx, "aggregateType", m.GetAggregateType(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'aggregateType' field") + } + + if err := WriteSimpleField[float64](ctx, "processingInterval", m.GetProcessingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'processingInterval' field") + } + + if err := WriteSimpleField[AggregateConfiguration](ctx, "aggregateConfiguration", m.GetAggregateConfiguration(), WriteComplex[AggregateConfiguration](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'aggregateConfiguration' field") + } + + if popErr := writeBuffer.PopContext("AggregateFilter"); popErr != nil { + return errors.Wrap(popErr, "Error popping for AggregateFilter") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_AggregateFilter) IsAggregateFilter() {} + +func (m *_AggregateFilter) DeepCopy() any { + return m.deepCopy() +} + +func (m *_AggregateFilter) deepCopy() *_AggregateFilter { + if m == nil { + return nil + } + _AggregateFilterCopy := &_AggregateFilter{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.StartTime, + m.AggregateType.DeepCopy().(NodeId), + m.ProcessingInterval, + m.AggregateConfiguration.DeepCopy().(AggregateConfiguration), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _AggregateFilterCopy +} + +func (m *_AggregateFilter) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/AggregateFilterResult.go b/plc4go/protocols/opcua/readwrite/model/AggregateFilterResult.go new file mode 100644 index 00000000000..af5622b56fd --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/AggregateFilterResult.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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// AggregateFilterResult is the corresponding interface of AggregateFilterResult +type AggregateFilterResult interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetRevisedStartTime returns RevisedStartTime (property field) + GetRevisedStartTime() int64 + // GetRevisedProcessingInterval returns RevisedProcessingInterval (property field) + GetRevisedProcessingInterval() float64 + // GetRevisedAggregateConfiguration returns RevisedAggregateConfiguration (property field) + GetRevisedAggregateConfiguration() AggregateConfiguration + // IsAggregateFilterResult is a marker method to prevent unintentional type checks (interfaces of same signature) + IsAggregateFilterResult() + // CreateBuilder creates a AggregateFilterResultBuilder + CreateAggregateFilterResultBuilder() AggregateFilterResultBuilder +} + +// _AggregateFilterResult is the data-structure of this message +type _AggregateFilterResult struct { + ExtensionObjectDefinitionContract + RevisedStartTime int64 + RevisedProcessingInterval float64 + RevisedAggregateConfiguration AggregateConfiguration +} + +var _ AggregateFilterResult = (*_AggregateFilterResult)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_AggregateFilterResult)(nil) + +// NewAggregateFilterResult factory function for _AggregateFilterResult +func NewAggregateFilterResult(revisedStartTime int64, revisedProcessingInterval float64, revisedAggregateConfiguration AggregateConfiguration) *_AggregateFilterResult { + if revisedAggregateConfiguration == nil { + panic("revisedAggregateConfiguration of type AggregateConfiguration for AggregateFilterResult must not be nil") + } + _result := &_AggregateFilterResult{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + RevisedStartTime: revisedStartTime, + RevisedProcessingInterval: revisedProcessingInterval, + RevisedAggregateConfiguration: revisedAggregateConfiguration, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// AggregateFilterResultBuilder is a builder for AggregateFilterResult +type AggregateFilterResultBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(revisedStartTime int64, revisedProcessingInterval float64, revisedAggregateConfiguration AggregateConfiguration) AggregateFilterResultBuilder + // WithRevisedStartTime adds RevisedStartTime (property field) + WithRevisedStartTime(int64) AggregateFilterResultBuilder + // WithRevisedProcessingInterval adds RevisedProcessingInterval (property field) + WithRevisedProcessingInterval(float64) AggregateFilterResultBuilder + // WithRevisedAggregateConfiguration adds RevisedAggregateConfiguration (property field) + WithRevisedAggregateConfiguration(AggregateConfiguration) AggregateFilterResultBuilder + // WithRevisedAggregateConfigurationBuilder adds RevisedAggregateConfiguration (property field) which is build by the builder + WithRevisedAggregateConfigurationBuilder(func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) AggregateFilterResultBuilder + // Build builds the AggregateFilterResult or returns an error if something is wrong + Build() (AggregateFilterResult, error) + // MustBuild does the same as Build but panics on error + MustBuild() AggregateFilterResult +} + +// NewAggregateFilterResultBuilder() creates a AggregateFilterResultBuilder +func NewAggregateFilterResultBuilder() AggregateFilterResultBuilder { + return &_AggregateFilterResultBuilder{_AggregateFilterResult: new(_AggregateFilterResult)} +} + +type _AggregateFilterResultBuilder struct { + *_AggregateFilterResult + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (AggregateFilterResultBuilder) = (*_AggregateFilterResultBuilder)(nil) + +func (b *_AggregateFilterResultBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_AggregateFilterResultBuilder) WithMandatoryFields(revisedStartTime int64, revisedProcessingInterval float64, revisedAggregateConfiguration AggregateConfiguration) AggregateFilterResultBuilder { + return b.WithRevisedStartTime(revisedStartTime).WithRevisedProcessingInterval(revisedProcessingInterval).WithRevisedAggregateConfiguration(revisedAggregateConfiguration) +} + +func (b *_AggregateFilterResultBuilder) WithRevisedStartTime(revisedStartTime int64) AggregateFilterResultBuilder { + b.RevisedStartTime = revisedStartTime + return b +} + +func (b *_AggregateFilterResultBuilder) WithRevisedProcessingInterval(revisedProcessingInterval float64) AggregateFilterResultBuilder { + b.RevisedProcessingInterval = revisedProcessingInterval + return b +} + +func (b *_AggregateFilterResultBuilder) WithRevisedAggregateConfiguration(revisedAggregateConfiguration AggregateConfiguration) AggregateFilterResultBuilder { + b.RevisedAggregateConfiguration = revisedAggregateConfiguration + return b +} + +func (b *_AggregateFilterResultBuilder) WithRevisedAggregateConfigurationBuilder(builderSupplier func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) AggregateFilterResultBuilder { + builder := builderSupplier(b.RevisedAggregateConfiguration.CreateAggregateConfigurationBuilder()) + var err error + b.RevisedAggregateConfiguration, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "AggregateConfigurationBuilder failed")) + } + return b +} + +func (b *_AggregateFilterResultBuilder) Build() (AggregateFilterResult, error) { + if b.RevisedAggregateConfiguration == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'revisedAggregateConfiguration' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._AggregateFilterResult.deepCopy(), nil +} + +func (b *_AggregateFilterResultBuilder) MustBuild() AggregateFilterResult { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_AggregateFilterResultBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_AggregateFilterResultBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_AggregateFilterResultBuilder) DeepCopy() any { + _copy := b.CreateAggregateFilterResultBuilder().(*_AggregateFilterResultBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateAggregateFilterResultBuilder creates a AggregateFilterResultBuilder +func (b *_AggregateFilterResult) CreateAggregateFilterResultBuilder() AggregateFilterResultBuilder { + if b == nil { + return NewAggregateFilterResultBuilder() + } + return &_AggregateFilterResultBuilder{_AggregateFilterResult: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_AggregateFilterResult) GetExtensionId() int32 { + return int32(739) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_AggregateFilterResult) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_AggregateFilterResult) GetRevisedStartTime() int64 { + return m.RevisedStartTime +} + +func (m *_AggregateFilterResult) GetRevisedProcessingInterval() float64 { + return m.RevisedProcessingInterval +} + +func (m *_AggregateFilterResult) GetRevisedAggregateConfiguration() AggregateConfiguration { + return m.RevisedAggregateConfiguration +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastAggregateFilterResult(structType any) AggregateFilterResult { + if casted, ok := structType.(AggregateFilterResult); ok { + return casted + } + if casted, ok := structType.(*AggregateFilterResult); ok { + return *casted + } + return nil +} + +func (m *_AggregateFilterResult) GetTypeName() string { + return "AggregateFilterResult" +} + +func (m *_AggregateFilterResult) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (revisedStartTime) + lengthInBits += 64 + + // Simple field (revisedProcessingInterval) + lengthInBits += 64 + + // Simple field (revisedAggregateConfiguration) + lengthInBits += m.RevisedAggregateConfiguration.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_AggregateFilterResult) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_AggregateFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__aggregateFilterResult AggregateFilterResult, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("AggregateFilterResult"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for AggregateFilterResult") + } + currentPos := positionAware.GetPos() + _ = currentPos + + revisedStartTime, err := ReadSimpleField(ctx, "revisedStartTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'revisedStartTime' field")) + } + m.RevisedStartTime = revisedStartTime + + revisedProcessingInterval, err := ReadSimpleField(ctx, "revisedProcessingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'revisedProcessingInterval' field")) + } + m.RevisedProcessingInterval = revisedProcessingInterval + + revisedAggregateConfiguration, err := ReadSimpleField[AggregateConfiguration](ctx, "revisedAggregateConfiguration", ReadComplex[AggregateConfiguration](ExtensionObjectDefinitionParseWithBufferProducer[AggregateConfiguration]((int32)(int32(950))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'revisedAggregateConfiguration' field")) + } + m.RevisedAggregateConfiguration = revisedAggregateConfiguration + + if closeErr := readBuffer.CloseContext("AggregateFilterResult"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for AggregateFilterResult") + } + + return m, nil +} + +func (m *_AggregateFilterResult) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_AggregateFilterResult) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("AggregateFilterResult"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for AggregateFilterResult") + } + + if err := WriteSimpleField[int64](ctx, "revisedStartTime", m.GetRevisedStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'revisedStartTime' field") + } + + if err := WriteSimpleField[float64](ctx, "revisedProcessingInterval", m.GetRevisedProcessingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'revisedProcessingInterval' field") + } + + if err := WriteSimpleField[AggregateConfiguration](ctx, "revisedAggregateConfiguration", m.GetRevisedAggregateConfiguration(), WriteComplex[AggregateConfiguration](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'revisedAggregateConfiguration' field") + } + + if popErr := writeBuffer.PopContext("AggregateFilterResult"); popErr != nil { + return errors.Wrap(popErr, "Error popping for AggregateFilterResult") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_AggregateFilterResult) IsAggregateFilterResult() {} + +func (m *_AggregateFilterResult) DeepCopy() any { + return m.deepCopy() +} + +func (m *_AggregateFilterResult) deepCopy() *_AggregateFilterResult { + if m == nil { + return nil + } + _AggregateFilterResultCopy := &_AggregateFilterResult{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.RevisedStartTime, + m.RevisedProcessingInterval, + m.RevisedAggregateConfiguration.DeepCopy().(AggregateConfiguration), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _AggregateFilterResultCopy +} + +func (m *_AggregateFilterResult) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/AliasNameDataType.go b/plc4go/protocols/opcua/readwrite/model/AliasNameDataType.go index 6da3e610ce8..783d8a65638 100644 --- a/plc4go/protocols/opcua/readwrite/model/AliasNameDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/AliasNameDataType.go @@ -42,8 +42,6 @@ type AliasNameDataType interface { ExtensionObjectDefinition // GetAliasName returns AliasName (property field) GetAliasName() QualifiedName - // GetNoOfReferencedNodes returns NoOfReferencedNodes (property field) - GetNoOfReferencedNodes() int32 // GetReferencedNodes returns ReferencedNodes (property field) GetReferencedNodes() []ExpandedNodeId // IsAliasNameDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type AliasNameDataType interface { // _AliasNameDataType is the data-structure of this message type _AliasNameDataType struct { ExtensionObjectDefinitionContract - AliasName QualifiedName - NoOfReferencedNodes int32 - ReferencedNodes []ExpandedNodeId + AliasName QualifiedName + ReferencedNodes []ExpandedNodeId } var _ AliasNameDataType = (*_AliasNameDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AliasNameDataType)(nil) // NewAliasNameDataType factory function for _AliasNameDataType -func NewAliasNameDataType(aliasName QualifiedName, noOfReferencedNodes int32, referencedNodes []ExpandedNodeId) *_AliasNameDataType { +func NewAliasNameDataType(aliasName QualifiedName, referencedNodes []ExpandedNodeId) *_AliasNameDataType { if aliasName == nil { panic("aliasName of type QualifiedName for AliasNameDataType must not be nil") } _result := &_AliasNameDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), AliasName: aliasName, - NoOfReferencedNodes: noOfReferencedNodes, ReferencedNodes: referencedNodes, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewAliasNameDataType(aliasName QualifiedName, noOfReferencedNodes int32, re type AliasNameDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(aliasName QualifiedName, noOfReferencedNodes int32, referencedNodes []ExpandedNodeId) AliasNameDataTypeBuilder + WithMandatoryFields(aliasName QualifiedName, referencedNodes []ExpandedNodeId) AliasNameDataTypeBuilder // WithAliasName adds AliasName (property field) WithAliasName(QualifiedName) AliasNameDataTypeBuilder // WithAliasNameBuilder adds AliasName (property field) which is build by the builder WithAliasNameBuilder(func(QualifiedNameBuilder) QualifiedNameBuilder) AliasNameDataTypeBuilder - // WithNoOfReferencedNodes adds NoOfReferencedNodes (property field) - WithNoOfReferencedNodes(int32) AliasNameDataTypeBuilder // WithReferencedNodes adds ReferencedNodes (property field) WithReferencedNodes(...ExpandedNodeId) AliasNameDataTypeBuilder // Build builds the AliasNameDataType or returns an error if something is wrong @@ -121,8 +115,8 @@ func (b *_AliasNameDataTypeBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_AliasNameDataTypeBuilder) WithMandatoryFields(aliasName QualifiedName, noOfReferencedNodes int32, referencedNodes []ExpandedNodeId) AliasNameDataTypeBuilder { - return b.WithAliasName(aliasName).WithNoOfReferencedNodes(noOfReferencedNodes).WithReferencedNodes(referencedNodes...) +func (b *_AliasNameDataTypeBuilder) WithMandatoryFields(aliasName QualifiedName, referencedNodes []ExpandedNodeId) AliasNameDataTypeBuilder { + return b.WithAliasName(aliasName).WithReferencedNodes(referencedNodes...) } func (b *_AliasNameDataTypeBuilder) WithAliasName(aliasName QualifiedName) AliasNameDataTypeBuilder { @@ -143,11 +137,6 @@ func (b *_AliasNameDataTypeBuilder) WithAliasNameBuilder(builderSupplier func(Qu return b } -func (b *_AliasNameDataTypeBuilder) WithNoOfReferencedNodes(noOfReferencedNodes int32) AliasNameDataTypeBuilder { - b.NoOfReferencedNodes = noOfReferencedNodes - return b -} - func (b *_AliasNameDataTypeBuilder) WithReferencedNodes(referencedNodes ...ExpandedNodeId) AliasNameDataTypeBuilder { b.ReferencedNodes = referencedNodes return b @@ -209,8 +198,8 @@ func (b *_AliasNameDataType) CreateAliasNameDataTypeBuilder() AliasNameDataTypeB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AliasNameDataType) GetIdentifier() string { - return "23470" +func (m *_AliasNameDataType) GetExtensionId() int32 { + return int32(23470) } /////////////////////// @@ -231,10 +220,6 @@ func (m *_AliasNameDataType) GetAliasName() QualifiedName { return m.AliasName } -func (m *_AliasNameDataType) GetNoOfReferencedNodes() int32 { - return m.NoOfReferencedNodes -} - func (m *_AliasNameDataType) GetReferencedNodes() []ExpandedNodeId { return m.ReferencedNodes } @@ -265,7 +250,7 @@ func (m *_AliasNameDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (aliasName) lengthInBits += m.AliasName.GetLengthInBits(ctx) - // Simple field (noOfReferencedNodes) + // Implicit Field (noOfReferencedNodes) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_AliasNameDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AliasNameDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__aliasNameDataType AliasNameDataType, err error) { +func (m *_AliasNameDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__aliasNameDataType AliasNameDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -302,11 +287,11 @@ func (m *_AliasNameDataType) parse(ctx context.Context, readBuffer utils.ReadBuf } m.AliasName = aliasName - noOfReferencedNodes, err := ReadSimpleField(ctx, "noOfReferencedNodes", ReadSignedInt(readBuffer, uint8(32))) + noOfReferencedNodes, err := ReadImplicitField[int32](ctx, "noOfReferencedNodes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReferencedNodes' field")) } - m.NoOfReferencedNodes = noOfReferencedNodes + _ = noOfReferencedNodes referencedNodes, err := ReadCountArrayField[ExpandedNodeId](ctx, "referencedNodes", ReadComplex[ExpandedNodeId](ExpandedNodeIdParseWithBuffer, readBuffer), uint64(noOfReferencedNodes)) if err != nil { @@ -342,8 +327,8 @@ func (m *_AliasNameDataType) SerializeWithWriteBuffer(ctx context.Context, write if err := WriteSimpleField[QualifiedName](ctx, "aliasName", m.GetAliasName(), WriteComplex[QualifiedName](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'aliasName' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReferencedNodes", m.GetNoOfReferencedNodes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReferencedNodes := int32(utils.InlineIf(bool((m.GetReferencedNodes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReferencedNodes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReferencedNodes", noOfReferencedNodes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReferencedNodes' field") } @@ -372,7 +357,6 @@ func (m *_AliasNameDataType) deepCopy() *_AliasNameDataType { _AliasNameDataTypeCopy := &_AliasNameDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.AliasName.DeepCopy().(QualifiedName), - m.NoOfReferencedNodes, utils.DeepCopySlice[ExpandedNodeId, ExpandedNodeId](m.ReferencedNodes), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/Annotation.go b/plc4go/protocols/opcua/readwrite/model/Annotation.go index 9bf22ec7aa9..88cc25b4fd2 100644 --- a/plc4go/protocols/opcua/readwrite/model/Annotation.go +++ b/plc4go/protocols/opcua/readwrite/model/Annotation.go @@ -233,8 +233,8 @@ func (b *_Annotation) CreateAnnotationBuilder() AnnotationBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Annotation) GetIdentifier() string { - return "893" +func (m *_Annotation) GetExtensionId() int32 { + return int32(893) } /////////////////////// @@ -302,7 +302,7 @@ func (m *_Annotation) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Annotation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__annotation Annotation, err error) { +func (m *_Annotation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__annotation Annotation, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/AnnotationDataType.go b/plc4go/protocols/opcua/readwrite/model/AnnotationDataType.go index cca65b7d1b1..44be615e127 100644 --- a/plc4go/protocols/opcua/readwrite/model/AnnotationDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/AnnotationDataType.go @@ -257,8 +257,8 @@ func (b *_AnnotationDataType) CreateAnnotationDataTypeBuilder() AnnotationDataTy /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AnnotationDataType) GetIdentifier() string { - return "32436" +func (m *_AnnotationDataType) GetExtensionId() int32 { + return int32(32436) } /////////////////////// @@ -326,7 +326,7 @@ func (m *_AnnotationDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AnnotationDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__annotationDataType AnnotationDataType, err error) { +func (m *_AnnotationDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__annotationDataType AnnotationDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/AnonymousIdentityToken.go b/plc4go/protocols/opcua/readwrite/model/AnonymousIdentityToken.go index 5554fac3394..ff6a91620d5 100644 --- a/plc4go/protocols/opcua/readwrite/model/AnonymousIdentityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/AnonymousIdentityToken.go @@ -26,6 +26,8 @@ import ( "github.com/pkg/errors" "github.com/rs/zerolog" + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" "github.com/apache/plc4x/plc4go/spi/utils" ) @@ -37,7 +39,9 @@ type AnonymousIdentityToken interface { utils.LengthAware utils.Serializable utils.Copyable - UserIdentityTokenDefinition + ExtensionObjectDefinition + // GetPolicyId returns PolicyId (property field) + GetPolicyId() PascalString // IsAnonymousIdentityToken is a marker method to prevent unintentional type checks (interfaces of same signature) IsAnonymousIdentityToken() // CreateBuilder creates a AnonymousIdentityTokenBuilder @@ -46,18 +50,23 @@ type AnonymousIdentityToken interface { // _AnonymousIdentityToken is the data-structure of this message type _AnonymousIdentityToken struct { - UserIdentityTokenDefinitionContract + ExtensionObjectDefinitionContract + PolicyId PascalString } var _ AnonymousIdentityToken = (*_AnonymousIdentityToken)(nil) -var _ UserIdentityTokenDefinitionRequirements = (*_AnonymousIdentityToken)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_AnonymousIdentityToken)(nil) // NewAnonymousIdentityToken factory function for _AnonymousIdentityToken -func NewAnonymousIdentityToken() *_AnonymousIdentityToken { +func NewAnonymousIdentityToken(policyId PascalString) *_AnonymousIdentityToken { + if policyId == nil { + panic("policyId of type PascalString for AnonymousIdentityToken must not be nil") + } _result := &_AnonymousIdentityToken{ - UserIdentityTokenDefinitionContract: NewUserIdentityTokenDefinition(), + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PolicyId: policyId, } - _result.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = _result + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result return _result } @@ -70,7 +79,11 @@ func NewAnonymousIdentityToken() *_AnonymousIdentityToken { type AnonymousIdentityTokenBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields() AnonymousIdentityTokenBuilder + WithMandatoryFields(policyId PascalString) AnonymousIdentityTokenBuilder + // WithPolicyId adds PolicyId (property field) + WithPolicyId(PascalString) AnonymousIdentityTokenBuilder + // WithPolicyIdBuilder adds PolicyId (property field) which is build by the builder + WithPolicyIdBuilder(func(PascalStringBuilder) PascalStringBuilder) AnonymousIdentityTokenBuilder // Build builds the AnonymousIdentityToken or returns an error if something is wrong Build() (AnonymousIdentityToken, error) // MustBuild does the same as Build but panics on error @@ -85,22 +98,46 @@ func NewAnonymousIdentityTokenBuilder() AnonymousIdentityTokenBuilder { type _AnonymousIdentityTokenBuilder struct { *_AnonymousIdentityToken - parentBuilder *_UserIdentityTokenDefinitionBuilder + parentBuilder *_ExtensionObjectDefinitionBuilder err *utils.MultiError } var _ (AnonymousIdentityTokenBuilder) = (*_AnonymousIdentityTokenBuilder)(nil) -func (b *_AnonymousIdentityTokenBuilder) setParent(contract UserIdentityTokenDefinitionContract) { - b.UserIdentityTokenDefinitionContract = contract +func (b *_AnonymousIdentityTokenBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_AnonymousIdentityTokenBuilder) WithMandatoryFields(policyId PascalString) AnonymousIdentityTokenBuilder { + return b.WithPolicyId(policyId) } -func (b *_AnonymousIdentityTokenBuilder) WithMandatoryFields() AnonymousIdentityTokenBuilder { +func (b *_AnonymousIdentityTokenBuilder) WithPolicyId(policyId PascalString) AnonymousIdentityTokenBuilder { + b.PolicyId = policyId + return b +} + +func (b *_AnonymousIdentityTokenBuilder) WithPolicyIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) AnonymousIdentityTokenBuilder { + builder := builderSupplier(b.PolicyId.CreatePascalStringBuilder()) + var err error + b.PolicyId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } return b } func (b *_AnonymousIdentityTokenBuilder) Build() (AnonymousIdentityToken, error) { + if b.PolicyId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'policyId' not set")) + } if b.err != nil { return nil, errors.Wrap(b.err, "error occurred during build") } @@ -116,11 +153,11 @@ func (b *_AnonymousIdentityTokenBuilder) MustBuild() AnonymousIdentityToken { } // Done is used to finish work on this child and return to the parent builder -func (b *_AnonymousIdentityTokenBuilder) Done() UserIdentityTokenDefinitionBuilder { +func (b *_AnonymousIdentityTokenBuilder) Done() ExtensionObjectDefinitionBuilder { return b.parentBuilder } -func (b *_AnonymousIdentityTokenBuilder) buildForUserIdentityTokenDefinition() (UserIdentityTokenDefinition, error) { +func (b *_AnonymousIdentityTokenBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { return b.Build() } @@ -150,8 +187,8 @@ func (b *_AnonymousIdentityToken) CreateAnonymousIdentityTokenBuilder() Anonymou /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AnonymousIdentityToken) GetIdentifier() string { - return "anonymous" +func (m *_AnonymousIdentityToken) GetExtensionId() int32 { + return int32(321) } /////////////////////// @@ -159,10 +196,24 @@ func (m *_AnonymousIdentityToken) GetIdentifier() string { /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// -func (m *_AnonymousIdentityToken) GetParent() UserIdentityTokenDefinitionContract { - return m.UserIdentityTokenDefinitionContract +func (m *_AnonymousIdentityToken) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_AnonymousIdentityToken) GetPolicyId() PascalString { + return m.PolicyId } +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + // Deprecated: use the interface for direct cast func CastAnonymousIdentityToken(structType any) AnonymousIdentityToken { if casted, ok := structType.(AnonymousIdentityToken); ok { @@ -179,7 +230,10 @@ func (m *_AnonymousIdentityToken) GetTypeName() string { } func (m *_AnonymousIdentityToken) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).getLengthInBits(ctx)) + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (policyId) + lengthInBits += m.PolicyId.GetLengthInBits(ctx) return lengthInBits } @@ -188,8 +242,8 @@ func (m *_AnonymousIdentityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AnonymousIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_UserIdentityTokenDefinition, identifier string) (__anonymousIdentityToken AnonymousIdentityToken, err error) { - m.UserIdentityTokenDefinitionContract = parent +func (m *_AnonymousIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__anonymousIdentityToken AnonymousIdentityToken, err error) { + m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer _ = positionAware @@ -199,6 +253,12 @@ func (m *_AnonymousIdentityToken) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos + policyId, err := ReadSimpleField[PascalString](ctx, "policyId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyId' field")) + } + m.PolicyId = policyId + if closeErr := readBuffer.CloseContext("AnonymousIdentityToken"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for AnonymousIdentityToken") } @@ -224,12 +284,16 @@ func (m *_AnonymousIdentityToken) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for AnonymousIdentityToken") } + if err := WriteSimpleField[PascalString](ctx, "policyId", m.GetPolicyId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'policyId' field") + } + if popErr := writeBuffer.PopContext("AnonymousIdentityToken"); popErr != nil { return errors.Wrap(popErr, "Error popping for AnonymousIdentityToken") } return nil } - return m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).serializeParent(ctx, writeBuffer, m, ser) + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) } func (m *_AnonymousIdentityToken) IsAnonymousIdentityToken() {} @@ -243,9 +307,10 @@ func (m *_AnonymousIdentityToken) deepCopy() *_AnonymousIdentityToken { return nil } _AnonymousIdentityTokenCopy := &_AnonymousIdentityToken{ - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).deepCopy(), + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PolicyId.DeepCopy().(PascalString), } - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = m + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _AnonymousIdentityTokenCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/ApplicationDescription.go b/plc4go/protocols/opcua/readwrite/model/ApplicationDescription.go index 9d41fa2c4b4..445dbf58b05 100644 --- a/plc4go/protocols/opcua/readwrite/model/ApplicationDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/ApplicationDescription.go @@ -52,8 +52,6 @@ type ApplicationDescription interface { GetGatewayServerUri() PascalString // GetDiscoveryProfileUri returns DiscoveryProfileUri (property field) GetDiscoveryProfileUri() PascalString - // GetNoOfDiscoveryUrls returns NoOfDiscoveryUrls (property field) - GetNoOfDiscoveryUrls() int32 // GetDiscoveryUrls returns DiscoveryUrls (property field) GetDiscoveryUrls() []PascalString // IsApplicationDescription is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -71,7 +69,6 @@ type _ApplicationDescription struct { ApplicationType ApplicationType GatewayServerUri PascalString DiscoveryProfileUri PascalString - NoOfDiscoveryUrls int32 DiscoveryUrls []PascalString } @@ -79,7 +76,7 @@ var _ ApplicationDescription = (*_ApplicationDescription)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ApplicationDescription)(nil) // NewApplicationDescription factory function for _ApplicationDescription -func NewApplicationDescription(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString) *_ApplicationDescription { +func NewApplicationDescription(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, discoveryUrls []PascalString) *_ApplicationDescription { if applicationUri == nil { panic("applicationUri of type PascalString for ApplicationDescription must not be nil") } @@ -103,7 +100,6 @@ func NewApplicationDescription(applicationUri PascalString, productUri PascalStr ApplicationType: applicationType, GatewayServerUri: gatewayServerUri, DiscoveryProfileUri: discoveryProfileUri, - NoOfDiscoveryUrls: noOfDiscoveryUrls, DiscoveryUrls: discoveryUrls, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -119,7 +115,7 @@ func NewApplicationDescription(applicationUri PascalString, productUri PascalStr type ApplicationDescriptionBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString) ApplicationDescriptionBuilder + WithMandatoryFields(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, discoveryUrls []PascalString) ApplicationDescriptionBuilder // WithApplicationUri adds ApplicationUri (property field) WithApplicationUri(PascalString) ApplicationDescriptionBuilder // WithApplicationUriBuilder adds ApplicationUri (property field) which is build by the builder @@ -142,8 +138,6 @@ type ApplicationDescriptionBuilder interface { WithDiscoveryProfileUri(PascalString) ApplicationDescriptionBuilder // WithDiscoveryProfileUriBuilder adds DiscoveryProfileUri (property field) which is build by the builder WithDiscoveryProfileUriBuilder(func(PascalStringBuilder) PascalStringBuilder) ApplicationDescriptionBuilder - // WithNoOfDiscoveryUrls adds NoOfDiscoveryUrls (property field) - WithNoOfDiscoveryUrls(int32) ApplicationDescriptionBuilder // WithDiscoveryUrls adds DiscoveryUrls (property field) WithDiscoveryUrls(...PascalString) ApplicationDescriptionBuilder // Build builds the ApplicationDescription or returns an error if something is wrong @@ -171,8 +165,8 @@ func (b *_ApplicationDescriptionBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_ApplicationDescriptionBuilder) WithMandatoryFields(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString) ApplicationDescriptionBuilder { - return b.WithApplicationUri(applicationUri).WithProductUri(productUri).WithApplicationName(applicationName).WithApplicationType(applicationType).WithGatewayServerUri(gatewayServerUri).WithDiscoveryProfileUri(discoveryProfileUri).WithNoOfDiscoveryUrls(noOfDiscoveryUrls).WithDiscoveryUrls(discoveryUrls...) +func (b *_ApplicationDescriptionBuilder) WithMandatoryFields(applicationUri PascalString, productUri PascalString, applicationName LocalizedText, applicationType ApplicationType, gatewayServerUri PascalString, discoveryProfileUri PascalString, discoveryUrls []PascalString) ApplicationDescriptionBuilder { + return b.WithApplicationUri(applicationUri).WithProductUri(productUri).WithApplicationName(applicationName).WithApplicationType(applicationType).WithGatewayServerUri(gatewayServerUri).WithDiscoveryProfileUri(discoveryProfileUri).WithDiscoveryUrls(discoveryUrls...) } func (b *_ApplicationDescriptionBuilder) WithApplicationUri(applicationUri PascalString) ApplicationDescriptionBuilder { @@ -270,11 +264,6 @@ func (b *_ApplicationDescriptionBuilder) WithDiscoveryProfileUriBuilder(builderS return b } -func (b *_ApplicationDescriptionBuilder) WithNoOfDiscoveryUrls(noOfDiscoveryUrls int32) ApplicationDescriptionBuilder { - b.NoOfDiscoveryUrls = noOfDiscoveryUrls - return b -} - func (b *_ApplicationDescriptionBuilder) WithDiscoveryUrls(discoveryUrls ...PascalString) ApplicationDescriptionBuilder { b.DiscoveryUrls = discoveryUrls return b @@ -360,8 +349,8 @@ func (b *_ApplicationDescription) CreateApplicationDescriptionBuilder() Applicat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ApplicationDescription) GetIdentifier() string { - return "310" +func (m *_ApplicationDescription) GetExtensionId() int32 { + return int32(310) } /////////////////////// @@ -402,10 +391,6 @@ func (m *_ApplicationDescription) GetDiscoveryProfileUri() PascalString { return m.DiscoveryProfileUri } -func (m *_ApplicationDescription) GetNoOfDiscoveryUrls() int32 { - return m.NoOfDiscoveryUrls -} - func (m *_ApplicationDescription) GetDiscoveryUrls() []PascalString { return m.DiscoveryUrls } @@ -451,7 +436,7 @@ func (m *_ApplicationDescription) GetLengthInBits(ctx context.Context) uint16 { // Simple field (discoveryProfileUri) lengthInBits += m.DiscoveryProfileUri.GetLengthInBits(ctx) - // Simple field (noOfDiscoveryUrls) + // Implicit Field (noOfDiscoveryUrls) lengthInBits += 32 // Array field @@ -471,7 +456,7 @@ func (m *_ApplicationDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ApplicationDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__applicationDescription ApplicationDescription, err error) { +func (m *_ApplicationDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__applicationDescription ApplicationDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -518,11 +503,11 @@ func (m *_ApplicationDescription) parse(ctx context.Context, readBuffer utils.Re } m.DiscoveryProfileUri = discoveryProfileUri - noOfDiscoveryUrls, err := ReadSimpleField(ctx, "noOfDiscoveryUrls", ReadSignedInt(readBuffer, uint8(32))) + noOfDiscoveryUrls, err := ReadImplicitField[int32](ctx, "noOfDiscoveryUrls", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiscoveryUrls' field")) } - m.NoOfDiscoveryUrls = noOfDiscoveryUrls + _ = noOfDiscoveryUrls discoveryUrls, err := ReadCountArrayField[PascalString](ctx, "discoveryUrls", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfDiscoveryUrls)) if err != nil { @@ -578,8 +563,8 @@ func (m *_ApplicationDescription) SerializeWithWriteBuffer(ctx context.Context, if err := WriteSimpleField[PascalString](ctx, "discoveryProfileUri", m.GetDiscoveryProfileUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'discoveryProfileUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiscoveryUrls", m.GetNoOfDiscoveryUrls(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiscoveryUrls := int32(utils.InlineIf(bool((m.GetDiscoveryUrls()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiscoveryUrls()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiscoveryUrls", noOfDiscoveryUrls, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiscoveryUrls' field") } @@ -613,7 +598,6 @@ func (m *_ApplicationDescription) deepCopy() *_ApplicationDescription { m.ApplicationType, m.GatewayServerUri.DeepCopy().(PascalString), m.DiscoveryProfileUri.DeepCopy().(PascalString), - m.NoOfDiscoveryUrls, utils.DeepCopySlice[PascalString, PascalString](m.DiscoveryUrls), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/Argument.go b/plc4go/protocols/opcua/readwrite/model/Argument.go index 42997a55f39..fce5ed362c7 100644 --- a/plc4go/protocols/opcua/readwrite/model/Argument.go +++ b/plc4go/protocols/opcua/readwrite/model/Argument.go @@ -46,8 +46,6 @@ type Argument interface { GetDataType() NodeId // GetValueRank returns ValueRank (property field) GetValueRank() int32 - // GetNoOfArrayDimensions returns NoOfArrayDimensions (property field) - GetNoOfArrayDimensions() int32 // GetArrayDimensions returns ArrayDimensions (property field) GetArrayDimensions() []uint32 // GetDescription returns Description (property field) @@ -61,19 +59,18 @@ type Argument interface { // _Argument is the data-structure of this message type _Argument struct { ExtensionObjectDefinitionContract - Name PascalString - DataType NodeId - ValueRank int32 - NoOfArrayDimensions int32 - ArrayDimensions []uint32 - Description LocalizedText + Name PascalString + DataType NodeId + ValueRank int32 + ArrayDimensions []uint32 + Description LocalizedText } var _ Argument = (*_Argument)(nil) var _ ExtensionObjectDefinitionRequirements = (*_Argument)(nil) // NewArgument factory function for _Argument -func NewArgument(name PascalString, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, description LocalizedText) *_Argument { +func NewArgument(name PascalString, dataType NodeId, valueRank int32, arrayDimensions []uint32, description LocalizedText) *_Argument { if name == nil { panic("name of type PascalString for Argument must not be nil") } @@ -88,7 +85,6 @@ func NewArgument(name PascalString, dataType NodeId, valueRank int32, noOfArrayD Name: name, DataType: dataType, ValueRank: valueRank, - NoOfArrayDimensions: noOfArrayDimensions, ArrayDimensions: arrayDimensions, Description: description, } @@ -105,7 +101,7 @@ func NewArgument(name PascalString, dataType NodeId, valueRank int32, noOfArrayD type ArgumentBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, description LocalizedText) ArgumentBuilder + WithMandatoryFields(name PascalString, dataType NodeId, valueRank int32, arrayDimensions []uint32, description LocalizedText) ArgumentBuilder // WithName adds Name (property field) WithName(PascalString) ArgumentBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -116,8 +112,6 @@ type ArgumentBuilder interface { WithDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) ArgumentBuilder // WithValueRank adds ValueRank (property field) WithValueRank(int32) ArgumentBuilder - // WithNoOfArrayDimensions adds NoOfArrayDimensions (property field) - WithNoOfArrayDimensions(int32) ArgumentBuilder // WithArrayDimensions adds ArrayDimensions (property field) WithArrayDimensions(...uint32) ArgumentBuilder // WithDescription adds Description (property field) @@ -149,8 +143,8 @@ func (b *_ArgumentBuilder) setParent(contract ExtensionObjectDefinitionContract) b.ExtensionObjectDefinitionContract = contract } -func (b *_ArgumentBuilder) WithMandatoryFields(name PascalString, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, description LocalizedText) ArgumentBuilder { - return b.WithName(name).WithDataType(dataType).WithValueRank(valueRank).WithNoOfArrayDimensions(noOfArrayDimensions).WithArrayDimensions(arrayDimensions...).WithDescription(description) +func (b *_ArgumentBuilder) WithMandatoryFields(name PascalString, dataType NodeId, valueRank int32, arrayDimensions []uint32, description LocalizedText) ArgumentBuilder { + return b.WithName(name).WithDataType(dataType).WithValueRank(valueRank).WithArrayDimensions(arrayDimensions...).WithDescription(description) } func (b *_ArgumentBuilder) WithName(name PascalString) ArgumentBuilder { @@ -194,11 +188,6 @@ func (b *_ArgumentBuilder) WithValueRank(valueRank int32) ArgumentBuilder { return b } -func (b *_ArgumentBuilder) WithNoOfArrayDimensions(noOfArrayDimensions int32) ArgumentBuilder { - b.NoOfArrayDimensions = noOfArrayDimensions - return b -} - func (b *_ArgumentBuilder) WithArrayDimensions(arrayDimensions ...uint32) ArgumentBuilder { b.ArrayDimensions = arrayDimensions return b @@ -290,8 +279,8 @@ func (b *_Argument) CreateArgumentBuilder() ArgumentBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Argument) GetIdentifier() string { - return "298" +func (m *_Argument) GetExtensionId() int32 { + return int32(298) } /////////////////////// @@ -320,10 +309,6 @@ func (m *_Argument) GetValueRank() int32 { return m.ValueRank } -func (m *_Argument) GetNoOfArrayDimensions() int32 { - return m.NoOfArrayDimensions -} - func (m *_Argument) GetArrayDimensions() []uint32 { return m.ArrayDimensions } @@ -364,7 +349,7 @@ func (m *_Argument) GetLengthInBits(ctx context.Context) uint16 { // Simple field (valueRank) lengthInBits += 32 - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32 // Array field @@ -382,7 +367,7 @@ func (m *_Argument) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Argument) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__argument Argument, err error) { +func (m *_Argument) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__argument Argument, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -411,11 +396,11 @@ func (m *_Argument) parse(ctx context.Context, readBuffer utils.ReadBuffer, pare } m.ValueRank = valueRank - noOfArrayDimensions, err := ReadSimpleField(ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) + noOfArrayDimensions, err := ReadImplicitField[int32](ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfArrayDimensions' field")) } - m.NoOfArrayDimensions = noOfArrayDimensions + _ = noOfArrayDimensions arrayDimensions, err := ReadCountArrayField[uint32](ctx, "arrayDimensions", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfArrayDimensions)) if err != nil { @@ -465,8 +450,8 @@ func (m *_Argument) SerializeWithWriteBuffer(ctx context.Context, writeBuffer ut if err := WriteSimpleField[int32](ctx, "valueRank", m.GetValueRank(), WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'valueRank' field") } - - if err := WriteSimpleField[int32](ctx, "noOfArrayDimensions", m.GetNoOfArrayDimensions(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfArrayDimensions := int32(utils.InlineIf(bool((m.GetArrayDimensions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetArrayDimensions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfArrayDimensions", noOfArrayDimensions, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfArrayDimensions' field") } @@ -501,7 +486,6 @@ func (m *_Argument) deepCopy() *_Argument { m.Name.DeepCopy().(PascalString), m.DataType.DeepCopy().(NodeId), m.ValueRank, - m.NoOfArrayDimensions, utils.DeepCopySlice[uint32, uint32](m.ArrayDimensions), m.Description.DeepCopy().(LocalizedText), } diff --git a/plc4go/protocols/opcua/readwrite/model/AttributeId.go b/plc4go/protocols/opcua/readwrite/model/AttributeId.go new file mode 100644 index 00000000000..96ea5c7e118 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/AttributeId.go @@ -0,0 +1,355 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// AttributeId is an enum +type AttributeId uint32 + +type IAttributeId interface { + fmt.Stringer + utils.LengthAware + utils.Serializable +} + +const ( + AttributeId_NodeId AttributeId = 1 + AttributeId_NodeClass AttributeId = 2 + AttributeId_BrowseName AttributeId = 3 + AttributeId_DisplayName AttributeId = 4 + AttributeId_Description AttributeId = 5 + AttributeId_WriteMask AttributeId = 6 + AttributeId_UserWriteMask AttributeId = 7 + AttributeId_IsAbstract AttributeId = 8 + AttributeId_Symmetric AttributeId = 9 + AttributeId_InverseName AttributeId = 10 + AttributeId_ContainsNoLoops AttributeId = 11 + AttributeId_EventNotifier AttributeId = 12 + AttributeId_Value AttributeId = 13 + AttributeId_DataType AttributeId = 14 + AttributeId_ValueRank AttributeId = 15 + AttributeId_ArrayDimensions AttributeId = 16 + AttributeId_AccessLevel AttributeId = 17 + AttributeId_UserAccessLevel AttributeId = 18 + AttributeId_MinimumSamplingInterval AttributeId = 19 + AttributeId_Historizing AttributeId = 20 + AttributeId_Executable AttributeId = 21 + AttributeId_UserExecutable AttributeId = 22 + AttributeId_DataTypeDefinition AttributeId = 23 + AttributeId_RolePermissions AttributeId = 24 + AttributeId_UserRolePermissions AttributeId = 25 + AttributeId_AccessRestrictions AttributeId = 26 + AttributeId_AccessLevelEx AttributeId = 27 +) + +var AttributeIdValues []AttributeId + +func init() { + _ = errors.New + AttributeIdValues = []AttributeId{ + AttributeId_NodeId, + AttributeId_NodeClass, + AttributeId_BrowseName, + AttributeId_DisplayName, + AttributeId_Description, + AttributeId_WriteMask, + AttributeId_UserWriteMask, + AttributeId_IsAbstract, + AttributeId_Symmetric, + AttributeId_InverseName, + AttributeId_ContainsNoLoops, + AttributeId_EventNotifier, + AttributeId_Value, + AttributeId_DataType, + AttributeId_ValueRank, + AttributeId_ArrayDimensions, + AttributeId_AccessLevel, + AttributeId_UserAccessLevel, + AttributeId_MinimumSamplingInterval, + AttributeId_Historizing, + AttributeId_Executable, + AttributeId_UserExecutable, + AttributeId_DataTypeDefinition, + AttributeId_RolePermissions, + AttributeId_UserRolePermissions, + AttributeId_AccessRestrictions, + AttributeId_AccessLevelEx, + } +} + +func AttributeIdByValue(value uint32) (enum AttributeId, ok bool) { + switch value { + case 1: + return AttributeId_NodeId, true + case 10: + return AttributeId_InverseName, true + case 11: + return AttributeId_ContainsNoLoops, true + case 12: + return AttributeId_EventNotifier, true + case 13: + return AttributeId_Value, true + case 14: + return AttributeId_DataType, true + case 15: + return AttributeId_ValueRank, true + case 16: + return AttributeId_ArrayDimensions, true + case 17: + return AttributeId_AccessLevel, true + case 18: + return AttributeId_UserAccessLevel, true + case 19: + return AttributeId_MinimumSamplingInterval, true + case 2: + return AttributeId_NodeClass, true + case 20: + return AttributeId_Historizing, true + case 21: + return AttributeId_Executable, true + case 22: + return AttributeId_UserExecutable, true + case 23: + return AttributeId_DataTypeDefinition, true + case 24: + return AttributeId_RolePermissions, true + case 25: + return AttributeId_UserRolePermissions, true + case 26: + return AttributeId_AccessRestrictions, true + case 27: + return AttributeId_AccessLevelEx, true + case 3: + return AttributeId_BrowseName, true + case 4: + return AttributeId_DisplayName, true + case 5: + return AttributeId_Description, true + case 6: + return AttributeId_WriteMask, true + case 7: + return AttributeId_UserWriteMask, true + case 8: + return AttributeId_IsAbstract, true + case 9: + return AttributeId_Symmetric, true + } + return 0, false +} + +func AttributeIdByName(value string) (enum AttributeId, ok bool) { + switch value { + case "NodeId": + return AttributeId_NodeId, true + case "InverseName": + return AttributeId_InverseName, true + case "ContainsNoLoops": + return AttributeId_ContainsNoLoops, true + case "EventNotifier": + return AttributeId_EventNotifier, true + case "Value": + return AttributeId_Value, true + case "DataType": + return AttributeId_DataType, true + case "ValueRank": + return AttributeId_ValueRank, true + case "ArrayDimensions": + return AttributeId_ArrayDimensions, true + case "AccessLevel": + return AttributeId_AccessLevel, true + case "UserAccessLevel": + return AttributeId_UserAccessLevel, true + case "MinimumSamplingInterval": + return AttributeId_MinimumSamplingInterval, true + case "NodeClass": + return AttributeId_NodeClass, true + case "Historizing": + return AttributeId_Historizing, true + case "Executable": + return AttributeId_Executable, true + case "UserExecutable": + return AttributeId_UserExecutable, true + case "DataTypeDefinition": + return AttributeId_DataTypeDefinition, true + case "RolePermissions": + return AttributeId_RolePermissions, true + case "UserRolePermissions": + return AttributeId_UserRolePermissions, true + case "AccessRestrictions": + return AttributeId_AccessRestrictions, true + case "AccessLevelEx": + return AttributeId_AccessLevelEx, true + case "BrowseName": + return AttributeId_BrowseName, true + case "DisplayName": + return AttributeId_DisplayName, true + case "Description": + return AttributeId_Description, true + case "WriteMask": + return AttributeId_WriteMask, true + case "UserWriteMask": + return AttributeId_UserWriteMask, true + case "IsAbstract": + return AttributeId_IsAbstract, true + case "Symmetric": + return AttributeId_Symmetric, true + } + return 0, false +} + +func AttributeIdKnows(value uint32) bool { + for _, typeValue := range AttributeIdValues { + if uint32(typeValue) == value { + return true + } + } + return false +} + +func CastAttributeId(structType any) AttributeId { + castFunc := func(typ any) AttributeId { + if sAttributeId, ok := typ.(AttributeId); ok { + return sAttributeId + } + return 0 + } + return castFunc(structType) +} + +func (m AttributeId) GetLengthInBits(ctx context.Context) uint16 { + return 32 +} + +func (m AttributeId) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func AttributeIdParse(ctx context.Context, theBytes []byte) (AttributeId, error) { + return AttributeIdParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) +} + +func AttributeIdParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (AttributeId, error) { + log := zerolog.Ctx(ctx) + _ = log + val, err := /*TODO: migrate me*/ /*TODO: migrate me*/ readBuffer.ReadUint32("AttributeId", 32) + if err != nil { + return 0, errors.Wrap(err, "error reading AttributeId") + } + if enum, ok := AttributeIdByValue(val); !ok { + log.Debug().Interface("val", val).Msg("no value val found for AttributeId") + return AttributeId(val), nil + } else { + return enum, nil + } +} + +func (e AttributeId) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased() + if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (e AttributeId) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + log := zerolog.Ctx(ctx) + _ = log + return /*TODO: migrate me*/ writeBuffer.WriteUint32("AttributeId", 32, uint32(uint32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) +} + +func (e AttributeId) GetValue() uint32 { + return uint32(e) +} + +// PLC4XEnumName returns the name that is used in code to identify this enum +func (e AttributeId) PLC4XEnumName() string { + switch e { + case AttributeId_NodeId: + return "NodeId" + case AttributeId_InverseName: + return "InverseName" + case AttributeId_ContainsNoLoops: + return "ContainsNoLoops" + case AttributeId_EventNotifier: + return "EventNotifier" + case AttributeId_Value: + return "Value" + case AttributeId_DataType: + return "DataType" + case AttributeId_ValueRank: + return "ValueRank" + case AttributeId_ArrayDimensions: + return "ArrayDimensions" + case AttributeId_AccessLevel: + return "AccessLevel" + case AttributeId_UserAccessLevel: + return "UserAccessLevel" + case AttributeId_MinimumSamplingInterval: + return "MinimumSamplingInterval" + case AttributeId_NodeClass: + return "NodeClass" + case AttributeId_Historizing: + return "Historizing" + case AttributeId_Executable: + return "Executable" + case AttributeId_UserExecutable: + return "UserExecutable" + case AttributeId_DataTypeDefinition: + return "DataTypeDefinition" + case AttributeId_RolePermissions: + return "RolePermissions" + case AttributeId_UserRolePermissions: + return "UserRolePermissions" + case AttributeId_AccessRestrictions: + return "AccessRestrictions" + case AttributeId_AccessLevelEx: + return "AccessLevelEx" + case AttributeId_BrowseName: + return "BrowseName" + case AttributeId_DisplayName: + return "DisplayName" + case AttributeId_Description: + return "Description" + case AttributeId_WriteMask: + return "WriteMask" + case AttributeId_UserWriteMask: + return "UserWriteMask" + case AttributeId_IsAbstract: + return "IsAbstract" + case AttributeId_Symmetric: + return "Symmetric" + } + return fmt.Sprintf("Unknown(%v)", uint32(e)) +} + +func (e AttributeId) String() string { + return e.PLC4XEnumName() +} diff --git a/plc4go/protocols/opcua/readwrite/model/AttributeOperand.go b/plc4go/protocols/opcua/readwrite/model/AttributeOperand.go new file mode 100644 index 00000000000..db6af105210 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/AttributeOperand.go @@ -0,0 +1,518 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// AttributeOperand is the corresponding interface of AttributeOperand +type AttributeOperand interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetAlias returns Alias (property field) + GetAlias() PascalString + // GetBrowsePath returns BrowsePath (property field) + GetBrowsePath() RelativePath + // GetAttributeId returns AttributeId (property field) + GetAttributeId() uint32 + // GetIndexRange returns IndexRange (property field) + GetIndexRange() PascalString + // IsAttributeOperand is a marker method to prevent unintentional type checks (interfaces of same signature) + IsAttributeOperand() + // CreateBuilder creates a AttributeOperandBuilder + CreateAttributeOperandBuilder() AttributeOperandBuilder +} + +// _AttributeOperand is the data-structure of this message +type _AttributeOperand struct { + ExtensionObjectDefinitionContract + NodeId NodeId + Alias PascalString + BrowsePath RelativePath + AttributeId uint32 + IndexRange PascalString +} + +var _ AttributeOperand = (*_AttributeOperand)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_AttributeOperand)(nil) + +// NewAttributeOperand factory function for _AttributeOperand +func NewAttributeOperand(nodeId NodeId, alias PascalString, browsePath RelativePath, attributeId uint32, indexRange PascalString) *_AttributeOperand { + if nodeId == nil { + panic("nodeId of type NodeId for AttributeOperand must not be nil") + } + if alias == nil { + panic("alias of type PascalString for AttributeOperand must not be nil") + } + if browsePath == nil { + panic("browsePath of type RelativePath for AttributeOperand must not be nil") + } + if indexRange == nil { + panic("indexRange of type PascalString for AttributeOperand must not be nil") + } + _result := &_AttributeOperand{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + Alias: alias, + BrowsePath: browsePath, + AttributeId: attributeId, + IndexRange: indexRange, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// AttributeOperandBuilder is a builder for AttributeOperand +type AttributeOperandBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, alias PascalString, browsePath RelativePath, attributeId uint32, indexRange PascalString) AttributeOperandBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) AttributeOperandBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) AttributeOperandBuilder + // WithAlias adds Alias (property field) + WithAlias(PascalString) AttributeOperandBuilder + // WithAliasBuilder adds Alias (property field) which is build by the builder + WithAliasBuilder(func(PascalStringBuilder) PascalStringBuilder) AttributeOperandBuilder + // WithBrowsePath adds BrowsePath (property field) + WithBrowsePath(RelativePath) AttributeOperandBuilder + // WithBrowsePathBuilder adds BrowsePath (property field) which is build by the builder + WithBrowsePathBuilder(func(RelativePathBuilder) RelativePathBuilder) AttributeOperandBuilder + // WithAttributeId adds AttributeId (property field) + WithAttributeId(uint32) AttributeOperandBuilder + // WithIndexRange adds IndexRange (property field) + WithIndexRange(PascalString) AttributeOperandBuilder + // WithIndexRangeBuilder adds IndexRange (property field) which is build by the builder + WithIndexRangeBuilder(func(PascalStringBuilder) PascalStringBuilder) AttributeOperandBuilder + // Build builds the AttributeOperand or returns an error if something is wrong + Build() (AttributeOperand, error) + // MustBuild does the same as Build but panics on error + MustBuild() AttributeOperand +} + +// NewAttributeOperandBuilder() creates a AttributeOperandBuilder +func NewAttributeOperandBuilder() AttributeOperandBuilder { + return &_AttributeOperandBuilder{_AttributeOperand: new(_AttributeOperand)} +} + +type _AttributeOperandBuilder struct { + *_AttributeOperand + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (AttributeOperandBuilder) = (*_AttributeOperandBuilder)(nil) + +func (b *_AttributeOperandBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_AttributeOperandBuilder) WithMandatoryFields(nodeId NodeId, alias PascalString, browsePath RelativePath, attributeId uint32, indexRange PascalString) AttributeOperandBuilder { + return b.WithNodeId(nodeId).WithAlias(alias).WithBrowsePath(browsePath).WithAttributeId(attributeId).WithIndexRange(indexRange) +} + +func (b *_AttributeOperandBuilder) WithNodeId(nodeId NodeId) AttributeOperandBuilder { + b.NodeId = nodeId + return b +} + +func (b *_AttributeOperandBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) AttributeOperandBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_AttributeOperandBuilder) WithAlias(alias PascalString) AttributeOperandBuilder { + b.Alias = alias + return b +} + +func (b *_AttributeOperandBuilder) WithAliasBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) AttributeOperandBuilder { + builder := builderSupplier(b.Alias.CreatePascalStringBuilder()) + var err error + b.Alias, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_AttributeOperandBuilder) WithBrowsePath(browsePath RelativePath) AttributeOperandBuilder { + b.BrowsePath = browsePath + return b +} + +func (b *_AttributeOperandBuilder) WithBrowsePathBuilder(builderSupplier func(RelativePathBuilder) RelativePathBuilder) AttributeOperandBuilder { + builder := builderSupplier(b.BrowsePath.CreateRelativePathBuilder()) + var err error + b.BrowsePath, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "RelativePathBuilder failed")) + } + return b +} + +func (b *_AttributeOperandBuilder) WithAttributeId(attributeId uint32) AttributeOperandBuilder { + b.AttributeId = attributeId + return b +} + +func (b *_AttributeOperandBuilder) WithIndexRange(indexRange PascalString) AttributeOperandBuilder { + b.IndexRange = indexRange + return b +} + +func (b *_AttributeOperandBuilder) WithIndexRangeBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) AttributeOperandBuilder { + builder := builderSupplier(b.IndexRange.CreatePascalStringBuilder()) + var err error + b.IndexRange, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_AttributeOperandBuilder) Build() (AttributeOperand, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.Alias == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'alias' not set")) + } + if b.BrowsePath == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'browsePath' not set")) + } + if b.IndexRange == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'indexRange' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._AttributeOperand.deepCopy(), nil +} + +func (b *_AttributeOperandBuilder) MustBuild() AttributeOperand { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_AttributeOperandBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_AttributeOperandBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_AttributeOperandBuilder) DeepCopy() any { + _copy := b.CreateAttributeOperandBuilder().(*_AttributeOperandBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateAttributeOperandBuilder creates a AttributeOperandBuilder +func (b *_AttributeOperand) CreateAttributeOperandBuilder() AttributeOperandBuilder { + if b == nil { + return NewAttributeOperandBuilder() + } + return &_AttributeOperandBuilder{_AttributeOperand: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_AttributeOperand) GetExtensionId() int32 { + return int32(600) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_AttributeOperand) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_AttributeOperand) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_AttributeOperand) GetAlias() PascalString { + return m.Alias +} + +func (m *_AttributeOperand) GetBrowsePath() RelativePath { + return m.BrowsePath +} + +func (m *_AttributeOperand) GetAttributeId() uint32 { + return m.AttributeId +} + +func (m *_AttributeOperand) GetIndexRange() PascalString { + return m.IndexRange +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastAttributeOperand(structType any) AttributeOperand { + if casted, ok := structType.(AttributeOperand); ok { + return casted + } + if casted, ok := structType.(*AttributeOperand); ok { + return *casted + } + return nil +} + +func (m *_AttributeOperand) GetTypeName() string { + return "AttributeOperand" +} + +func (m *_AttributeOperand) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Simple field (alias) + lengthInBits += m.Alias.GetLengthInBits(ctx) + + // Simple field (browsePath) + lengthInBits += m.BrowsePath.GetLengthInBits(ctx) + + // Simple field (attributeId) + lengthInBits += 32 + + // Simple field (indexRange) + lengthInBits += m.IndexRange.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_AttributeOperand) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_AttributeOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__attributeOperand AttributeOperand, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("AttributeOperand"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for AttributeOperand") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + alias, err := ReadSimpleField[PascalString](ctx, "alias", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'alias' field")) + } + m.Alias = alias + + browsePath, err := ReadSimpleField[RelativePath](ctx, "browsePath", ReadComplex[RelativePath](ExtensionObjectDefinitionParseWithBufferProducer[RelativePath]((int32)(int32(542))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'browsePath' field")) + } + m.BrowsePath = browsePath + + attributeId, err := ReadSimpleField(ctx, "attributeId", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'attributeId' field")) + } + m.AttributeId = attributeId + + indexRange, err := ReadSimpleField[PascalString](ctx, "indexRange", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'indexRange' field")) + } + m.IndexRange = indexRange + + if closeErr := readBuffer.CloseContext("AttributeOperand"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for AttributeOperand") + } + + return m, nil +} + +func (m *_AttributeOperand) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_AttributeOperand) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("AttributeOperand"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for AttributeOperand") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + + if err := WriteSimpleField[PascalString](ctx, "alias", m.GetAlias(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'alias' field") + } + + if err := WriteSimpleField[RelativePath](ctx, "browsePath", m.GetBrowsePath(), WriteComplex[RelativePath](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'browsePath' field") + } + + if err := WriteSimpleField[uint32](ctx, "attributeId", m.GetAttributeId(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'attributeId' field") + } + + if err := WriteSimpleField[PascalString](ctx, "indexRange", m.GetIndexRange(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'indexRange' field") + } + + if popErr := writeBuffer.PopContext("AttributeOperand"); popErr != nil { + return errors.Wrap(popErr, "Error popping for AttributeOperand") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_AttributeOperand) IsAttributeOperand() {} + +func (m *_AttributeOperand) DeepCopy() any { + return m.deepCopy() +} + +func (m *_AttributeOperand) deepCopy() *_AttributeOperand { + if m == nil { + return nil + } + _AttributeOperandCopy := &_AttributeOperand{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + m.Alias.DeepCopy().(PascalString), + m.BrowsePath.DeepCopy().(RelativePath), + m.AttributeId, + m.IndexRange.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _AttributeOperandCopy +} + +func (m *_AttributeOperand) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/AxisInformation.go b/plc4go/protocols/opcua/readwrite/model/AxisInformation.go index e3479de260e..1db6ddc9807 100644 --- a/plc4go/protocols/opcua/readwrite/model/AxisInformation.go +++ b/plc4go/protocols/opcua/readwrite/model/AxisInformation.go @@ -41,15 +41,13 @@ type AxisInformation interface { utils.Copyable ExtensionObjectDefinition // GetEngineeringUnits returns EngineeringUnits (property field) - GetEngineeringUnits() ExtensionObjectDefinition + GetEngineeringUnits() EUInformation // GetEURange returns EURange (property field) - GetEURange() ExtensionObjectDefinition + GetEURange() Range // GetTitle returns Title (property field) GetTitle() LocalizedText // GetAxisScaleType returns AxisScaleType (property field) GetAxisScaleType() AxisScaleEnumeration - // GetNoOfAxisSteps returns NoOfAxisSteps (property field) - GetNoOfAxisSteps() int32 // GetAxisSteps returns AxisSteps (property field) GetAxisSteps() []float64 // IsAxisInformation is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -61,11 +59,10 @@ type AxisInformation interface { // _AxisInformation is the data-structure of this message type _AxisInformation struct { ExtensionObjectDefinitionContract - EngineeringUnits ExtensionObjectDefinition - EURange ExtensionObjectDefinition + EngineeringUnits EUInformation + EURange Range Title LocalizedText AxisScaleType AxisScaleEnumeration - NoOfAxisSteps int32 AxisSteps []float64 } @@ -73,12 +70,12 @@ var _ AxisInformation = (*_AxisInformation)(nil) var _ ExtensionObjectDefinitionRequirements = (*_AxisInformation)(nil) // NewAxisInformation factory function for _AxisInformation -func NewAxisInformation(engineeringUnits ExtensionObjectDefinition, eURange ExtensionObjectDefinition, title LocalizedText, axisScaleType AxisScaleEnumeration, noOfAxisSteps int32, axisSteps []float64) *_AxisInformation { +func NewAxisInformation(engineeringUnits EUInformation, eURange Range, title LocalizedText, axisScaleType AxisScaleEnumeration, axisSteps []float64) *_AxisInformation { if engineeringUnits == nil { - panic("engineeringUnits of type ExtensionObjectDefinition for AxisInformation must not be nil") + panic("engineeringUnits of type EUInformation for AxisInformation must not be nil") } if eURange == nil { - panic("eURange of type ExtensionObjectDefinition for AxisInformation must not be nil") + panic("eURange of type Range for AxisInformation must not be nil") } if title == nil { panic("title of type LocalizedText for AxisInformation must not be nil") @@ -89,7 +86,6 @@ func NewAxisInformation(engineeringUnits ExtensionObjectDefinition, eURange Exte EURange: eURange, Title: title, AxisScaleType: axisScaleType, - NoOfAxisSteps: noOfAxisSteps, AxisSteps: axisSteps, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -105,23 +101,21 @@ func NewAxisInformation(engineeringUnits ExtensionObjectDefinition, eURange Exte type AxisInformationBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(engineeringUnits ExtensionObjectDefinition, eURange ExtensionObjectDefinition, title LocalizedText, axisScaleType AxisScaleEnumeration, noOfAxisSteps int32, axisSteps []float64) AxisInformationBuilder + WithMandatoryFields(engineeringUnits EUInformation, eURange Range, title LocalizedText, axisScaleType AxisScaleEnumeration, axisSteps []float64) AxisInformationBuilder // WithEngineeringUnits adds EngineeringUnits (property field) - WithEngineeringUnits(ExtensionObjectDefinition) AxisInformationBuilder + WithEngineeringUnits(EUInformation) AxisInformationBuilder // WithEngineeringUnitsBuilder adds EngineeringUnits (property field) which is build by the builder - WithEngineeringUnitsBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AxisInformationBuilder + WithEngineeringUnitsBuilder(func(EUInformationBuilder) EUInformationBuilder) AxisInformationBuilder // WithEURange adds EURange (property field) - WithEURange(ExtensionObjectDefinition) AxisInformationBuilder + WithEURange(Range) AxisInformationBuilder // WithEURangeBuilder adds EURange (property field) which is build by the builder - WithEURangeBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AxisInformationBuilder + WithEURangeBuilder(func(RangeBuilder) RangeBuilder) AxisInformationBuilder // WithTitle adds Title (property field) WithTitle(LocalizedText) AxisInformationBuilder // WithTitleBuilder adds Title (property field) which is build by the builder WithTitleBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) AxisInformationBuilder // WithAxisScaleType adds AxisScaleType (property field) WithAxisScaleType(AxisScaleEnumeration) AxisInformationBuilder - // WithNoOfAxisSteps adds NoOfAxisSteps (property field) - WithNoOfAxisSteps(int32) AxisInformationBuilder // WithAxisSteps adds AxisSteps (property field) WithAxisSteps(...float64) AxisInformationBuilder // Build builds the AxisInformation or returns an error if something is wrong @@ -149,42 +143,42 @@ func (b *_AxisInformationBuilder) setParent(contract ExtensionObjectDefinitionCo b.ExtensionObjectDefinitionContract = contract } -func (b *_AxisInformationBuilder) WithMandatoryFields(engineeringUnits ExtensionObjectDefinition, eURange ExtensionObjectDefinition, title LocalizedText, axisScaleType AxisScaleEnumeration, noOfAxisSteps int32, axisSteps []float64) AxisInformationBuilder { - return b.WithEngineeringUnits(engineeringUnits).WithEURange(eURange).WithTitle(title).WithAxisScaleType(axisScaleType).WithNoOfAxisSteps(noOfAxisSteps).WithAxisSteps(axisSteps...) +func (b *_AxisInformationBuilder) WithMandatoryFields(engineeringUnits EUInformation, eURange Range, title LocalizedText, axisScaleType AxisScaleEnumeration, axisSteps []float64) AxisInformationBuilder { + return b.WithEngineeringUnits(engineeringUnits).WithEURange(eURange).WithTitle(title).WithAxisScaleType(axisScaleType).WithAxisSteps(axisSteps...) } -func (b *_AxisInformationBuilder) WithEngineeringUnits(engineeringUnits ExtensionObjectDefinition) AxisInformationBuilder { +func (b *_AxisInformationBuilder) WithEngineeringUnits(engineeringUnits EUInformation) AxisInformationBuilder { b.EngineeringUnits = engineeringUnits return b } -func (b *_AxisInformationBuilder) WithEngineeringUnitsBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AxisInformationBuilder { - builder := builderSupplier(b.EngineeringUnits.CreateExtensionObjectDefinitionBuilder()) +func (b *_AxisInformationBuilder) WithEngineeringUnitsBuilder(builderSupplier func(EUInformationBuilder) EUInformationBuilder) AxisInformationBuilder { + builder := builderSupplier(b.EngineeringUnits.CreateEUInformationBuilder()) var err error b.EngineeringUnits, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "EUInformationBuilder failed")) } return b } -func (b *_AxisInformationBuilder) WithEURange(eURange ExtensionObjectDefinition) AxisInformationBuilder { +func (b *_AxisInformationBuilder) WithEURange(eURange Range) AxisInformationBuilder { b.EURange = eURange return b } -func (b *_AxisInformationBuilder) WithEURangeBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) AxisInformationBuilder { - builder := builderSupplier(b.EURange.CreateExtensionObjectDefinitionBuilder()) +func (b *_AxisInformationBuilder) WithEURangeBuilder(builderSupplier func(RangeBuilder) RangeBuilder) AxisInformationBuilder { + builder := builderSupplier(b.EURange.CreateRangeBuilder()) var err error b.EURange, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RangeBuilder failed")) } return b } @@ -212,11 +206,6 @@ func (b *_AxisInformationBuilder) WithAxisScaleType(axisScaleType AxisScaleEnume return b } -func (b *_AxisInformationBuilder) WithNoOfAxisSteps(noOfAxisSteps int32) AxisInformationBuilder { - b.NoOfAxisSteps = noOfAxisSteps - return b -} - func (b *_AxisInformationBuilder) WithAxisSteps(axisSteps ...float64) AxisInformationBuilder { b.AxisSteps = axisSteps return b @@ -290,8 +279,8 @@ func (b *_AxisInformation) CreateAxisInformationBuilder() AxisInformationBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_AxisInformation) GetIdentifier() string { - return "12081" +func (m *_AxisInformation) GetExtensionId() int32 { + return int32(12081) } /////////////////////// @@ -308,11 +297,11 @@ func (m *_AxisInformation) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_AxisInformation) GetEngineeringUnits() ExtensionObjectDefinition { +func (m *_AxisInformation) GetEngineeringUnits() EUInformation { return m.EngineeringUnits } -func (m *_AxisInformation) GetEURange() ExtensionObjectDefinition { +func (m *_AxisInformation) GetEURange() Range { return m.EURange } @@ -324,10 +313,6 @@ func (m *_AxisInformation) GetAxisScaleType() AxisScaleEnumeration { return m.AxisScaleType } -func (m *_AxisInformation) GetNoOfAxisSteps() int32 { - return m.NoOfAxisSteps -} - func (m *_AxisInformation) GetAxisSteps() []float64 { return m.AxisSteps } @@ -367,7 +352,7 @@ func (m *_AxisInformation) GetLengthInBits(ctx context.Context) uint16 { // Simple field (axisScaleType) lengthInBits += 32 - // Simple field (noOfAxisSteps) + // Implicit Field (noOfAxisSteps) lengthInBits += 32 // Array field @@ -382,7 +367,7 @@ func (m *_AxisInformation) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_AxisInformation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__axisInformation AxisInformation, err error) { +func (m *_AxisInformation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__axisInformation AxisInformation, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -393,13 +378,13 @@ func (m *_AxisInformation) parse(ctx context.Context, readBuffer utils.ReadBuffe currentPos := positionAware.GetPos() _ = currentPos - engineeringUnits, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "engineeringUnits", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("889")), readBuffer)) + engineeringUnits, err := ReadSimpleField[EUInformation](ctx, "engineeringUnits", ReadComplex[EUInformation](ExtensionObjectDefinitionParseWithBufferProducer[EUInformation]((int32)(int32(889))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'engineeringUnits' field")) } m.EngineeringUnits = engineeringUnits - eURange, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "eURange", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("886")), readBuffer)) + eURange, err := ReadSimpleField[Range](ctx, "eURange", ReadComplex[Range](ExtensionObjectDefinitionParseWithBufferProducer[Range]((int32)(int32(886))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eURange' field")) } @@ -417,11 +402,11 @@ func (m *_AxisInformation) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.AxisScaleType = axisScaleType - noOfAxisSteps, err := ReadSimpleField(ctx, "noOfAxisSteps", ReadSignedInt(readBuffer, uint8(32))) + noOfAxisSteps, err := ReadImplicitField[int32](ctx, "noOfAxisSteps", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAxisSteps' field")) } - m.NoOfAxisSteps = noOfAxisSteps + _ = noOfAxisSteps axisSteps, err := ReadCountArrayField[float64](ctx, "axisSteps", ReadDouble(readBuffer, uint8(64)), uint64(noOfAxisSteps)) if err != nil { @@ -454,11 +439,11 @@ func (m *_AxisInformation) SerializeWithWriteBuffer(ctx context.Context, writeBu return errors.Wrap(pushErr, "Error pushing for AxisInformation") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "engineeringUnits", m.GetEngineeringUnits(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[EUInformation](ctx, "engineeringUnits", m.GetEngineeringUnits(), WriteComplex[EUInformation](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'engineeringUnits' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "eURange", m.GetEURange(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[Range](ctx, "eURange", m.GetEURange(), WriteComplex[Range](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'eURange' field") } @@ -469,8 +454,8 @@ func (m *_AxisInformation) SerializeWithWriteBuffer(ctx context.Context, writeBu if err := WriteSimpleEnumField[AxisScaleEnumeration](ctx, "axisScaleType", "AxisScaleEnumeration", m.GetAxisScaleType(), WriteEnum[AxisScaleEnumeration, uint32](AxisScaleEnumeration.GetValue, AxisScaleEnumeration.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'axisScaleType' field") } - - if err := WriteSimpleField[int32](ctx, "noOfAxisSteps", m.GetNoOfAxisSteps(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfAxisSteps := int32(utils.InlineIf(bool((m.GetAxisSteps()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAxisSteps()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAxisSteps", noOfAxisSteps, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfAxisSteps' field") } @@ -498,11 +483,10 @@ func (m *_AxisInformation) deepCopy() *_AxisInformation { } _AxisInformationCopy := &_AxisInformation{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.EngineeringUnits.DeepCopy().(ExtensionObjectDefinition), - m.EURange.DeepCopy().(ExtensionObjectDefinition), + m.EngineeringUnits.DeepCopy().(EUInformation), + m.EURange.DeepCopy().(Range), m.Title.DeepCopy().(LocalizedText), m.AxisScaleType, - m.NoOfAxisSteps, utils.DeepCopySlice[float64, float64](m.AxisSteps), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/BinaryExtensionObjectWithMask.go b/plc4go/protocols/opcua/readwrite/model/BinaryExtensionObjectWithMask.go new file mode 100644 index 00000000000..2c244e2603d --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/BinaryExtensionObjectWithMask.go @@ -0,0 +1,347 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BinaryExtensionObjectWithMask is the corresponding interface of BinaryExtensionObjectWithMask +type BinaryExtensionObjectWithMask interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectWithMask + // GetBody returns Body (property field) + GetBody() ExtensionObjectDefinition + // IsBinaryExtensionObjectWithMask is a marker method to prevent unintentional type checks (interfaces of same signature) + IsBinaryExtensionObjectWithMask() + // CreateBuilder creates a BinaryExtensionObjectWithMaskBuilder + CreateBinaryExtensionObjectWithMaskBuilder() BinaryExtensionObjectWithMaskBuilder +} + +// _BinaryExtensionObjectWithMask is the data-structure of this message +type _BinaryExtensionObjectWithMask struct { + ExtensionObjectWithMaskContract + Body ExtensionObjectDefinition +} + +var _ BinaryExtensionObjectWithMask = (*_BinaryExtensionObjectWithMask)(nil) +var _ ExtensionObjectWithMaskRequirements = (*_BinaryExtensionObjectWithMask)(nil) + +// NewBinaryExtensionObjectWithMask factory function for _BinaryExtensionObjectWithMask +func NewBinaryExtensionObjectWithMask(typeId ExpandedNodeId, encodingMask ExtensionObjectEncodingMask, body ExtensionObjectDefinition, extensionId int32, includeEncodingMask bool) *_BinaryExtensionObjectWithMask { + if body == nil { + panic("body of type ExtensionObjectDefinition for BinaryExtensionObjectWithMask must not be nil") + } + _result := &_BinaryExtensionObjectWithMask{ + ExtensionObjectWithMaskContract: NewExtensionObjectWithMask(typeId, encodingMask, extensionId), + Body: body, + } + _result.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// BinaryExtensionObjectWithMaskBuilder is a builder for BinaryExtensionObjectWithMask +type BinaryExtensionObjectWithMaskBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(body ExtensionObjectDefinition) BinaryExtensionObjectWithMaskBuilder + // WithBody adds Body (property field) + WithBody(ExtensionObjectDefinition) BinaryExtensionObjectWithMaskBuilder + // WithBodyBuilder adds Body (property field) which is build by the builder + WithBodyBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BinaryExtensionObjectWithMaskBuilder + // Build builds the BinaryExtensionObjectWithMask or returns an error if something is wrong + Build() (BinaryExtensionObjectWithMask, error) + // MustBuild does the same as Build but panics on error + MustBuild() BinaryExtensionObjectWithMask +} + +// NewBinaryExtensionObjectWithMaskBuilder() creates a BinaryExtensionObjectWithMaskBuilder +func NewBinaryExtensionObjectWithMaskBuilder() BinaryExtensionObjectWithMaskBuilder { + return &_BinaryExtensionObjectWithMaskBuilder{_BinaryExtensionObjectWithMask: new(_BinaryExtensionObjectWithMask)} +} + +type _BinaryExtensionObjectWithMaskBuilder struct { + *_BinaryExtensionObjectWithMask + + parentBuilder *_ExtensionObjectWithMaskBuilder + + err *utils.MultiError +} + +var _ (BinaryExtensionObjectWithMaskBuilder) = (*_BinaryExtensionObjectWithMaskBuilder)(nil) + +func (b *_BinaryExtensionObjectWithMaskBuilder) setParent(contract ExtensionObjectWithMaskContract) { + b.ExtensionObjectWithMaskContract = contract +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) WithMandatoryFields(body ExtensionObjectDefinition) BinaryExtensionObjectWithMaskBuilder { + return b.WithBody(body) +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) WithBody(body ExtensionObjectDefinition) BinaryExtensionObjectWithMaskBuilder { + b.Body = body + return b +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) WithBodyBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BinaryExtensionObjectWithMaskBuilder { + builder := builderSupplier(b.Body.CreateExtensionObjectDefinitionBuilder()) + var err error + b.Body, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + } + return b +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) Build() (BinaryExtensionObjectWithMask, error) { + if b.Body == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'body' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._BinaryExtensionObjectWithMask.deepCopy(), nil +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) MustBuild() BinaryExtensionObjectWithMask { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_BinaryExtensionObjectWithMaskBuilder) Done() ExtensionObjectWithMaskBuilder { + return b.parentBuilder +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) buildForExtensionObjectWithMask() (ExtensionObjectWithMask, error) { + return b.Build() +} + +func (b *_BinaryExtensionObjectWithMaskBuilder) DeepCopy() any { + _copy := b.CreateBinaryExtensionObjectWithMaskBuilder().(*_BinaryExtensionObjectWithMaskBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateBinaryExtensionObjectWithMaskBuilder creates a BinaryExtensionObjectWithMaskBuilder +func (b *_BinaryExtensionObjectWithMask) CreateBinaryExtensionObjectWithMaskBuilder() BinaryExtensionObjectWithMaskBuilder { + if b == nil { + return NewBinaryExtensionObjectWithMaskBuilder() + } + return &_BinaryExtensionObjectWithMaskBuilder{_BinaryExtensionObjectWithMask: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_BinaryExtensionObjectWithMask) GetEncodingMaskXmlBody() bool { + return bool(false) +} + +func (m *_BinaryExtensionObjectWithMask) GetEncodingMaskBinaryBody() bool { + return bool(true) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_BinaryExtensionObjectWithMask) GetParent() ExtensionObjectWithMaskContract { + return m.ExtensionObjectWithMaskContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BinaryExtensionObjectWithMask) GetBody() ExtensionObjectDefinition { + return m.Body +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastBinaryExtensionObjectWithMask(structType any) BinaryExtensionObjectWithMask { + if casted, ok := structType.(BinaryExtensionObjectWithMask); ok { + return casted + } + if casted, ok := structType.(*BinaryExtensionObjectWithMask); ok { + return *casted + } + return nil +} + +func (m *_BinaryExtensionObjectWithMask) GetTypeName() string { + return "BinaryExtensionObjectWithMask" +} + +func (m *_BinaryExtensionObjectWithMask) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).getLengthInBits(ctx)) + + // Implicit Field (bodyLength) + lengthInBits += 32 + + // Simple field (body) + lengthInBits += m.Body.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_BinaryExtensionObjectWithMask) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_BinaryExtensionObjectWithMask) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectWithMask, extensionId int32, includeEncodingMask bool) (__binaryExtensionObjectWithMask BinaryExtensionObjectWithMask, err error) { + m.ExtensionObjectWithMaskContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BinaryExtensionObjectWithMask"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BinaryExtensionObjectWithMask") + } + currentPos := positionAware.GetPos() + _ = currentPos + + bodyLength, err := ReadImplicitField[int32](ctx, "bodyLength", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'bodyLength' field")) + } + _ = bodyLength + + body, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "body", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((int32)(extensionId)), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'body' field")) + } + m.Body = body + + if closeErr := readBuffer.CloseContext("BinaryExtensionObjectWithMask"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BinaryExtensionObjectWithMask") + } + + return m, nil +} + +func (m *_BinaryExtensionObjectWithMask) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_BinaryExtensionObjectWithMask) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("BinaryExtensionObjectWithMask"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BinaryExtensionObjectWithMask") + } + bodyLength := int32(utils.InlineIf(bool((m.GetBody()) == (nil)), func() any { return int32(int32(0)) }, func() any { return int32(m.GetBody().GetLengthInBytes(ctx)) }).(int32)) + if err := WriteImplicitField(ctx, "bodyLength", bodyLength, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'bodyLength' field") + } + + if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "body", m.GetBody(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'body' field") + } + + if popErr := writeBuffer.PopContext("BinaryExtensionObjectWithMask"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BinaryExtensionObjectWithMask") + } + return nil + } + return m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_BinaryExtensionObjectWithMask) IsBinaryExtensionObjectWithMask() {} + +func (m *_BinaryExtensionObjectWithMask) DeepCopy() any { + return m.deepCopy() +} + +func (m *_BinaryExtensionObjectWithMask) deepCopy() *_BinaryExtensionObjectWithMask { + if m == nil { + return nil + } + _BinaryExtensionObjectWithMaskCopy := &_BinaryExtensionObjectWithMask{ + m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).deepCopy(), + m.Body.DeepCopy().(ExtensionObjectDefinition), + } + m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask)._SubType = m + return _BinaryExtensionObjectWithMaskCopy +} + +func (m *_BinaryExtensionObjectWithMask) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/BinaryPayload.go b/plc4go/protocols/opcua/readwrite/model/BinaryPayload.go index 4efa66a7904..2c33f852c08 100644 --- a/plc4go/protocols/opcua/readwrite/model/BinaryPayload.go +++ b/plc4go/protocols/opcua/readwrite/model/BinaryPayload.go @@ -163,8 +163,8 @@ func (b *_BinaryPayload) CreateBinaryPayloadBuilder() BinaryPayloadBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BinaryPayload) GetExtensible() bool { - return bool(false) +func (m *_BinaryPayload) GetBinary() bool { + return bool(true) } /////////////////////// @@ -220,7 +220,7 @@ func (m *_BinaryPayload) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BinaryPayload) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_Payload, extensible bool, byteCount uint32) (__binaryPayload BinaryPayload, err error) { +func (m *_BinaryPayload) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_Payload, binary bool, byteCount uint32) (__binaryPayload BinaryPayload, err error) { m.PayloadContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/BitFieldDefinition.go b/plc4go/protocols/opcua/readwrite/model/BitFieldDefinition.go index 9daff3365a8..0eb360fc50b 100644 --- a/plc4go/protocols/opcua/readwrite/model/BitFieldDefinition.go +++ b/plc4go/protocols/opcua/readwrite/model/BitFieldDefinition.go @@ -247,8 +247,8 @@ func (b *_BitFieldDefinition) CreateBitFieldDefinitionBuilder() BitFieldDefiniti /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BitFieldDefinition) GetIdentifier() string { - return "32423" +func (m *_BitFieldDefinition) GetExtensionId() int32 { + return int32(32423) } /////////////////////// @@ -329,7 +329,7 @@ func (m *_BitFieldDefinition) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BitFieldDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__bitFieldDefinition BitFieldDefinition, err error) { +func (m *_BitFieldDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__bitFieldDefinition BitFieldDefinition, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/BrokerConnectionTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/BrokerConnectionTransportDataType.go new file mode 100644 index 00000000000..1e1c91cb9e3 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/BrokerConnectionTransportDataType.go @@ -0,0 +1,383 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BrokerConnectionTransportDataType is the corresponding interface of BrokerConnectionTransportDataType +type BrokerConnectionTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetResourceUri returns ResourceUri (property field) + GetResourceUri() PascalString + // GetAuthenticationProfileUri returns AuthenticationProfileUri (property field) + GetAuthenticationProfileUri() PascalString + // IsBrokerConnectionTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsBrokerConnectionTransportDataType() + // CreateBuilder creates a BrokerConnectionTransportDataTypeBuilder + CreateBrokerConnectionTransportDataTypeBuilder() BrokerConnectionTransportDataTypeBuilder +} + +// _BrokerConnectionTransportDataType is the data-structure of this message +type _BrokerConnectionTransportDataType struct { + ExtensionObjectDefinitionContract + ResourceUri PascalString + AuthenticationProfileUri PascalString +} + +var _ BrokerConnectionTransportDataType = (*_BrokerConnectionTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_BrokerConnectionTransportDataType)(nil) + +// NewBrokerConnectionTransportDataType factory function for _BrokerConnectionTransportDataType +func NewBrokerConnectionTransportDataType(resourceUri PascalString, authenticationProfileUri PascalString) *_BrokerConnectionTransportDataType { + if resourceUri == nil { + panic("resourceUri of type PascalString for BrokerConnectionTransportDataType must not be nil") + } + if authenticationProfileUri == nil { + panic("authenticationProfileUri of type PascalString for BrokerConnectionTransportDataType must not be nil") + } + _result := &_BrokerConnectionTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + ResourceUri: resourceUri, + AuthenticationProfileUri: authenticationProfileUri, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// BrokerConnectionTransportDataTypeBuilder is a builder for BrokerConnectionTransportDataType +type BrokerConnectionTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(resourceUri PascalString, authenticationProfileUri PascalString) BrokerConnectionTransportDataTypeBuilder + // WithResourceUri adds ResourceUri (property field) + WithResourceUri(PascalString) BrokerConnectionTransportDataTypeBuilder + // WithResourceUriBuilder adds ResourceUri (property field) which is build by the builder + WithResourceUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerConnectionTransportDataTypeBuilder + // WithAuthenticationProfileUri adds AuthenticationProfileUri (property field) + WithAuthenticationProfileUri(PascalString) BrokerConnectionTransportDataTypeBuilder + // WithAuthenticationProfileUriBuilder adds AuthenticationProfileUri (property field) which is build by the builder + WithAuthenticationProfileUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerConnectionTransportDataTypeBuilder + // Build builds the BrokerConnectionTransportDataType or returns an error if something is wrong + Build() (BrokerConnectionTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() BrokerConnectionTransportDataType +} + +// NewBrokerConnectionTransportDataTypeBuilder() creates a BrokerConnectionTransportDataTypeBuilder +func NewBrokerConnectionTransportDataTypeBuilder() BrokerConnectionTransportDataTypeBuilder { + return &_BrokerConnectionTransportDataTypeBuilder{_BrokerConnectionTransportDataType: new(_BrokerConnectionTransportDataType)} +} + +type _BrokerConnectionTransportDataTypeBuilder struct { + *_BrokerConnectionTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (BrokerConnectionTransportDataTypeBuilder) = (*_BrokerConnectionTransportDataTypeBuilder)(nil) + +func (b *_BrokerConnectionTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) WithMandatoryFields(resourceUri PascalString, authenticationProfileUri PascalString) BrokerConnectionTransportDataTypeBuilder { + return b.WithResourceUri(resourceUri).WithAuthenticationProfileUri(authenticationProfileUri) +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) WithResourceUri(resourceUri PascalString) BrokerConnectionTransportDataTypeBuilder { + b.ResourceUri = resourceUri + return b +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) WithResourceUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerConnectionTransportDataTypeBuilder { + builder := builderSupplier(b.ResourceUri.CreatePascalStringBuilder()) + var err error + b.ResourceUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) WithAuthenticationProfileUri(authenticationProfileUri PascalString) BrokerConnectionTransportDataTypeBuilder { + b.AuthenticationProfileUri = authenticationProfileUri + return b +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) WithAuthenticationProfileUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerConnectionTransportDataTypeBuilder { + builder := builderSupplier(b.AuthenticationProfileUri.CreatePascalStringBuilder()) + var err error + b.AuthenticationProfileUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) Build() (BrokerConnectionTransportDataType, error) { + if b.ResourceUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'resourceUri' not set")) + } + if b.AuthenticationProfileUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'authenticationProfileUri' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._BrokerConnectionTransportDataType.deepCopy(), nil +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) MustBuild() BrokerConnectionTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_BrokerConnectionTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_BrokerConnectionTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateBrokerConnectionTransportDataTypeBuilder().(*_BrokerConnectionTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateBrokerConnectionTransportDataTypeBuilder creates a BrokerConnectionTransportDataTypeBuilder +func (b *_BrokerConnectionTransportDataType) CreateBrokerConnectionTransportDataTypeBuilder() BrokerConnectionTransportDataTypeBuilder { + if b == nil { + return NewBrokerConnectionTransportDataTypeBuilder() + } + return &_BrokerConnectionTransportDataTypeBuilder{_BrokerConnectionTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_BrokerConnectionTransportDataType) GetExtensionId() int32 { + return int32(15009) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_BrokerConnectionTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BrokerConnectionTransportDataType) GetResourceUri() PascalString { + return m.ResourceUri +} + +func (m *_BrokerConnectionTransportDataType) GetAuthenticationProfileUri() PascalString { + return m.AuthenticationProfileUri +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastBrokerConnectionTransportDataType(structType any) BrokerConnectionTransportDataType { + if casted, ok := structType.(BrokerConnectionTransportDataType); ok { + return casted + } + if casted, ok := structType.(*BrokerConnectionTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_BrokerConnectionTransportDataType) GetTypeName() string { + return "BrokerConnectionTransportDataType" +} + +func (m *_BrokerConnectionTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (resourceUri) + lengthInBits += m.ResourceUri.GetLengthInBits(ctx) + + // Simple field (authenticationProfileUri) + lengthInBits += m.AuthenticationProfileUri.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_BrokerConnectionTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_BrokerConnectionTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__brokerConnectionTransportDataType BrokerConnectionTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BrokerConnectionTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BrokerConnectionTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + resourceUri, err := ReadSimpleField[PascalString](ctx, "resourceUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'resourceUri' field")) + } + m.ResourceUri = resourceUri + + authenticationProfileUri, err := ReadSimpleField[PascalString](ctx, "authenticationProfileUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'authenticationProfileUri' field")) + } + m.AuthenticationProfileUri = authenticationProfileUri + + if closeErr := readBuffer.CloseContext("BrokerConnectionTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BrokerConnectionTransportDataType") + } + + return m, nil +} + +func (m *_BrokerConnectionTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_BrokerConnectionTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("BrokerConnectionTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BrokerConnectionTransportDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "resourceUri", m.GetResourceUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'resourceUri' field") + } + + if err := WriteSimpleField[PascalString](ctx, "authenticationProfileUri", m.GetAuthenticationProfileUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'authenticationProfileUri' field") + } + + if popErr := writeBuffer.PopContext("BrokerConnectionTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BrokerConnectionTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_BrokerConnectionTransportDataType) IsBrokerConnectionTransportDataType() {} + +func (m *_BrokerConnectionTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_BrokerConnectionTransportDataType) deepCopy() *_BrokerConnectionTransportDataType { + if m == nil { + return nil + } + _BrokerConnectionTransportDataTypeCopy := &_BrokerConnectionTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.ResourceUri.DeepCopy().(PascalString), + m.AuthenticationProfileUri.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _BrokerConnectionTransportDataTypeCopy +} + +func (m *_BrokerConnectionTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/BrokerDataSetReaderTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/BrokerDataSetReaderTransportDataType.go new file mode 100644 index 00000000000..db4601d3748 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/BrokerDataSetReaderTransportDataType.go @@ -0,0 +1,518 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BrokerDataSetReaderTransportDataType is the corresponding interface of BrokerDataSetReaderTransportDataType +type BrokerDataSetReaderTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetQueueName returns QueueName (property field) + GetQueueName() PascalString + // GetResourceUri returns ResourceUri (property field) + GetResourceUri() PascalString + // GetAuthenticationProfileUri returns AuthenticationProfileUri (property field) + GetAuthenticationProfileUri() PascalString + // GetRequestedDeliveryGuarantee returns RequestedDeliveryGuarantee (property field) + GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService + // GetMetaDataQueueName returns MetaDataQueueName (property field) + GetMetaDataQueueName() PascalString + // IsBrokerDataSetReaderTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsBrokerDataSetReaderTransportDataType() + // CreateBuilder creates a BrokerDataSetReaderTransportDataTypeBuilder + CreateBrokerDataSetReaderTransportDataTypeBuilder() BrokerDataSetReaderTransportDataTypeBuilder +} + +// _BrokerDataSetReaderTransportDataType is the data-structure of this message +type _BrokerDataSetReaderTransportDataType struct { + ExtensionObjectDefinitionContract + QueueName PascalString + ResourceUri PascalString + AuthenticationProfileUri PascalString + RequestedDeliveryGuarantee BrokerTransportQualityOfService + MetaDataQueueName PascalString +} + +var _ BrokerDataSetReaderTransportDataType = (*_BrokerDataSetReaderTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_BrokerDataSetReaderTransportDataType)(nil) + +// NewBrokerDataSetReaderTransportDataType factory function for _BrokerDataSetReaderTransportDataType +func NewBrokerDataSetReaderTransportDataType(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString) *_BrokerDataSetReaderTransportDataType { + if queueName == nil { + panic("queueName of type PascalString for BrokerDataSetReaderTransportDataType must not be nil") + } + if resourceUri == nil { + panic("resourceUri of type PascalString for BrokerDataSetReaderTransportDataType must not be nil") + } + if authenticationProfileUri == nil { + panic("authenticationProfileUri of type PascalString for BrokerDataSetReaderTransportDataType must not be nil") + } + if metaDataQueueName == nil { + panic("metaDataQueueName of type PascalString for BrokerDataSetReaderTransportDataType must not be nil") + } + _result := &_BrokerDataSetReaderTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + QueueName: queueName, + ResourceUri: resourceUri, + AuthenticationProfileUri: authenticationProfileUri, + RequestedDeliveryGuarantee: requestedDeliveryGuarantee, + MetaDataQueueName: metaDataQueueName, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// BrokerDataSetReaderTransportDataTypeBuilder is a builder for BrokerDataSetReaderTransportDataType +type BrokerDataSetReaderTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString) BrokerDataSetReaderTransportDataTypeBuilder + // WithQueueName adds QueueName (property field) + WithQueueName(PascalString) BrokerDataSetReaderTransportDataTypeBuilder + // WithQueueNameBuilder adds QueueName (property field) which is build by the builder + WithQueueNameBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder + // WithResourceUri adds ResourceUri (property field) + WithResourceUri(PascalString) BrokerDataSetReaderTransportDataTypeBuilder + // WithResourceUriBuilder adds ResourceUri (property field) which is build by the builder + WithResourceUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder + // WithAuthenticationProfileUri adds AuthenticationProfileUri (property field) + WithAuthenticationProfileUri(PascalString) BrokerDataSetReaderTransportDataTypeBuilder + // WithAuthenticationProfileUriBuilder adds AuthenticationProfileUri (property field) which is build by the builder + WithAuthenticationProfileUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder + // WithRequestedDeliveryGuarantee adds RequestedDeliveryGuarantee (property field) + WithRequestedDeliveryGuarantee(BrokerTransportQualityOfService) BrokerDataSetReaderTransportDataTypeBuilder + // WithMetaDataQueueName adds MetaDataQueueName (property field) + WithMetaDataQueueName(PascalString) BrokerDataSetReaderTransportDataTypeBuilder + // WithMetaDataQueueNameBuilder adds MetaDataQueueName (property field) which is build by the builder + WithMetaDataQueueNameBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder + // Build builds the BrokerDataSetReaderTransportDataType or returns an error if something is wrong + Build() (BrokerDataSetReaderTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() BrokerDataSetReaderTransportDataType +} + +// NewBrokerDataSetReaderTransportDataTypeBuilder() creates a BrokerDataSetReaderTransportDataTypeBuilder +func NewBrokerDataSetReaderTransportDataTypeBuilder() BrokerDataSetReaderTransportDataTypeBuilder { + return &_BrokerDataSetReaderTransportDataTypeBuilder{_BrokerDataSetReaderTransportDataType: new(_BrokerDataSetReaderTransportDataType)} +} + +type _BrokerDataSetReaderTransportDataTypeBuilder struct { + *_BrokerDataSetReaderTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (BrokerDataSetReaderTransportDataTypeBuilder) = (*_BrokerDataSetReaderTransportDataTypeBuilder)(nil) + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString) BrokerDataSetReaderTransportDataTypeBuilder { + return b.WithQueueName(queueName).WithResourceUri(resourceUri).WithAuthenticationProfileUri(authenticationProfileUri).WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee).WithMetaDataQueueName(metaDataQueueName) +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithQueueName(queueName PascalString) BrokerDataSetReaderTransportDataTypeBuilder { + b.QueueName = queueName + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithQueueNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.QueueName.CreatePascalStringBuilder()) + var err error + b.QueueName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithResourceUri(resourceUri PascalString) BrokerDataSetReaderTransportDataTypeBuilder { + b.ResourceUri = resourceUri + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithResourceUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.ResourceUri.CreatePascalStringBuilder()) + var err error + b.ResourceUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithAuthenticationProfileUri(authenticationProfileUri PascalString) BrokerDataSetReaderTransportDataTypeBuilder { + b.AuthenticationProfileUri = authenticationProfileUri + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithAuthenticationProfileUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.AuthenticationProfileUri.CreatePascalStringBuilder()) + var err error + b.AuthenticationProfileUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee BrokerTransportQualityOfService) BrokerDataSetReaderTransportDataTypeBuilder { + b.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithMetaDataQueueName(metaDataQueueName PascalString) BrokerDataSetReaderTransportDataTypeBuilder { + b.MetaDataQueueName = metaDataQueueName + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) WithMetaDataQueueNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.MetaDataQueueName.CreatePascalStringBuilder()) + var err error + b.MetaDataQueueName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) Build() (BrokerDataSetReaderTransportDataType, error) { + if b.QueueName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'queueName' not set")) + } + if b.ResourceUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'resourceUri' not set")) + } + if b.AuthenticationProfileUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'authenticationProfileUri' not set")) + } + if b.MetaDataQueueName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'metaDataQueueName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._BrokerDataSetReaderTransportDataType.deepCopy(), nil +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) MustBuild() BrokerDataSetReaderTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_BrokerDataSetReaderTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateBrokerDataSetReaderTransportDataTypeBuilder().(*_BrokerDataSetReaderTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateBrokerDataSetReaderTransportDataTypeBuilder creates a BrokerDataSetReaderTransportDataTypeBuilder +func (b *_BrokerDataSetReaderTransportDataType) CreateBrokerDataSetReaderTransportDataTypeBuilder() BrokerDataSetReaderTransportDataTypeBuilder { + if b == nil { + return NewBrokerDataSetReaderTransportDataTypeBuilder() + } + return &_BrokerDataSetReaderTransportDataTypeBuilder{_BrokerDataSetReaderTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_BrokerDataSetReaderTransportDataType) GetExtensionId() int32 { + return int32(15672) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_BrokerDataSetReaderTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BrokerDataSetReaderTransportDataType) GetQueueName() PascalString { + return m.QueueName +} + +func (m *_BrokerDataSetReaderTransportDataType) GetResourceUri() PascalString { + return m.ResourceUri +} + +func (m *_BrokerDataSetReaderTransportDataType) GetAuthenticationProfileUri() PascalString { + return m.AuthenticationProfileUri +} + +func (m *_BrokerDataSetReaderTransportDataType) GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService { + return m.RequestedDeliveryGuarantee +} + +func (m *_BrokerDataSetReaderTransportDataType) GetMetaDataQueueName() PascalString { + return m.MetaDataQueueName +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastBrokerDataSetReaderTransportDataType(structType any) BrokerDataSetReaderTransportDataType { + if casted, ok := structType.(BrokerDataSetReaderTransportDataType); ok { + return casted + } + if casted, ok := structType.(*BrokerDataSetReaderTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_BrokerDataSetReaderTransportDataType) GetTypeName() string { + return "BrokerDataSetReaderTransportDataType" +} + +func (m *_BrokerDataSetReaderTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (queueName) + lengthInBits += m.QueueName.GetLengthInBits(ctx) + + // Simple field (resourceUri) + lengthInBits += m.ResourceUri.GetLengthInBits(ctx) + + // Simple field (authenticationProfileUri) + lengthInBits += m.AuthenticationProfileUri.GetLengthInBits(ctx) + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32 + + // Simple field (metaDataQueueName) + lengthInBits += m.MetaDataQueueName.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_BrokerDataSetReaderTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_BrokerDataSetReaderTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__brokerDataSetReaderTransportDataType BrokerDataSetReaderTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BrokerDataSetReaderTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BrokerDataSetReaderTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + queueName, err := ReadSimpleField[PascalString](ctx, "queueName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queueName' field")) + } + m.QueueName = queueName + + resourceUri, err := ReadSimpleField[PascalString](ctx, "resourceUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'resourceUri' field")) + } + m.ResourceUri = resourceUri + + authenticationProfileUri, err := ReadSimpleField[PascalString](ctx, "authenticationProfileUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'authenticationProfileUri' field")) + } + m.AuthenticationProfileUri = authenticationProfileUri + + requestedDeliveryGuarantee, err := ReadEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", ReadEnum(BrokerTransportQualityOfServiceByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestedDeliveryGuarantee' field")) + } + m.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + + metaDataQueueName, err := ReadSimpleField[PascalString](ctx, "metaDataQueueName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'metaDataQueueName' field")) + } + m.MetaDataQueueName = metaDataQueueName + + if closeErr := readBuffer.CloseContext("BrokerDataSetReaderTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BrokerDataSetReaderTransportDataType") + } + + return m, nil +} + +func (m *_BrokerDataSetReaderTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_BrokerDataSetReaderTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("BrokerDataSetReaderTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BrokerDataSetReaderTransportDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "queueName", m.GetQueueName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'queueName' field") + } + + if err := WriteSimpleField[PascalString](ctx, "resourceUri", m.GetResourceUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'resourceUri' field") + } + + if err := WriteSimpleField[PascalString](ctx, "authenticationProfileUri", m.GetAuthenticationProfileUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'authenticationProfileUri' field") + } + + if err := WriteSimpleEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", m.GetRequestedDeliveryGuarantee(), WriteEnum[BrokerTransportQualityOfService, uint32](BrokerTransportQualityOfService.GetValue, BrokerTransportQualityOfService.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'requestedDeliveryGuarantee' field") + } + + if err := WriteSimpleField[PascalString](ctx, "metaDataQueueName", m.GetMetaDataQueueName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'metaDataQueueName' field") + } + + if popErr := writeBuffer.PopContext("BrokerDataSetReaderTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BrokerDataSetReaderTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_BrokerDataSetReaderTransportDataType) IsBrokerDataSetReaderTransportDataType() {} + +func (m *_BrokerDataSetReaderTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_BrokerDataSetReaderTransportDataType) deepCopy() *_BrokerDataSetReaderTransportDataType { + if m == nil { + return nil + } + _BrokerDataSetReaderTransportDataTypeCopy := &_BrokerDataSetReaderTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.QueueName.DeepCopy().(PascalString), + m.ResourceUri.DeepCopy().(PascalString), + m.AuthenticationProfileUri.DeepCopy().(PascalString), + m.RequestedDeliveryGuarantee, + m.MetaDataQueueName.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _BrokerDataSetReaderTransportDataTypeCopy +} + +func (m *_BrokerDataSetReaderTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/BrokerDataSetWriterTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/BrokerDataSetWriterTransportDataType.go new file mode 100644 index 00000000000..4e0a0c636aa --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/BrokerDataSetWriterTransportDataType.go @@ -0,0 +1,547 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BrokerDataSetWriterTransportDataType is the corresponding interface of BrokerDataSetWriterTransportDataType +type BrokerDataSetWriterTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetQueueName returns QueueName (property field) + GetQueueName() PascalString + // GetResourceUri returns ResourceUri (property field) + GetResourceUri() PascalString + // GetAuthenticationProfileUri returns AuthenticationProfileUri (property field) + GetAuthenticationProfileUri() PascalString + // GetRequestedDeliveryGuarantee returns RequestedDeliveryGuarantee (property field) + GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService + // GetMetaDataQueueName returns MetaDataQueueName (property field) + GetMetaDataQueueName() PascalString + // GetMetaDataUpdateTime returns MetaDataUpdateTime (property field) + GetMetaDataUpdateTime() float64 + // IsBrokerDataSetWriterTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsBrokerDataSetWriterTransportDataType() + // CreateBuilder creates a BrokerDataSetWriterTransportDataTypeBuilder + CreateBrokerDataSetWriterTransportDataTypeBuilder() BrokerDataSetWriterTransportDataTypeBuilder +} + +// _BrokerDataSetWriterTransportDataType is the data-structure of this message +type _BrokerDataSetWriterTransportDataType struct { + ExtensionObjectDefinitionContract + QueueName PascalString + ResourceUri PascalString + AuthenticationProfileUri PascalString + RequestedDeliveryGuarantee BrokerTransportQualityOfService + MetaDataQueueName PascalString + MetaDataUpdateTime float64 +} + +var _ BrokerDataSetWriterTransportDataType = (*_BrokerDataSetWriterTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_BrokerDataSetWriterTransportDataType)(nil) + +// NewBrokerDataSetWriterTransportDataType factory function for _BrokerDataSetWriterTransportDataType +func NewBrokerDataSetWriterTransportDataType(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString, metaDataUpdateTime float64) *_BrokerDataSetWriterTransportDataType { + if queueName == nil { + panic("queueName of type PascalString for BrokerDataSetWriterTransportDataType must not be nil") + } + if resourceUri == nil { + panic("resourceUri of type PascalString for BrokerDataSetWriterTransportDataType must not be nil") + } + if authenticationProfileUri == nil { + panic("authenticationProfileUri of type PascalString for BrokerDataSetWriterTransportDataType must not be nil") + } + if metaDataQueueName == nil { + panic("metaDataQueueName of type PascalString for BrokerDataSetWriterTransportDataType must not be nil") + } + _result := &_BrokerDataSetWriterTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + QueueName: queueName, + ResourceUri: resourceUri, + AuthenticationProfileUri: authenticationProfileUri, + RequestedDeliveryGuarantee: requestedDeliveryGuarantee, + MetaDataQueueName: metaDataQueueName, + MetaDataUpdateTime: metaDataUpdateTime, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// BrokerDataSetWriterTransportDataTypeBuilder is a builder for BrokerDataSetWriterTransportDataType +type BrokerDataSetWriterTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString, metaDataUpdateTime float64) BrokerDataSetWriterTransportDataTypeBuilder + // WithQueueName adds QueueName (property field) + WithQueueName(PascalString) BrokerDataSetWriterTransportDataTypeBuilder + // WithQueueNameBuilder adds QueueName (property field) which is build by the builder + WithQueueNameBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder + // WithResourceUri adds ResourceUri (property field) + WithResourceUri(PascalString) BrokerDataSetWriterTransportDataTypeBuilder + // WithResourceUriBuilder adds ResourceUri (property field) which is build by the builder + WithResourceUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder + // WithAuthenticationProfileUri adds AuthenticationProfileUri (property field) + WithAuthenticationProfileUri(PascalString) BrokerDataSetWriterTransportDataTypeBuilder + // WithAuthenticationProfileUriBuilder adds AuthenticationProfileUri (property field) which is build by the builder + WithAuthenticationProfileUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder + // WithRequestedDeliveryGuarantee adds RequestedDeliveryGuarantee (property field) + WithRequestedDeliveryGuarantee(BrokerTransportQualityOfService) BrokerDataSetWriterTransportDataTypeBuilder + // WithMetaDataQueueName adds MetaDataQueueName (property field) + WithMetaDataQueueName(PascalString) BrokerDataSetWriterTransportDataTypeBuilder + // WithMetaDataQueueNameBuilder adds MetaDataQueueName (property field) which is build by the builder + WithMetaDataQueueNameBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder + // WithMetaDataUpdateTime adds MetaDataUpdateTime (property field) + WithMetaDataUpdateTime(float64) BrokerDataSetWriterTransportDataTypeBuilder + // Build builds the BrokerDataSetWriterTransportDataType or returns an error if something is wrong + Build() (BrokerDataSetWriterTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() BrokerDataSetWriterTransportDataType +} + +// NewBrokerDataSetWriterTransportDataTypeBuilder() creates a BrokerDataSetWriterTransportDataTypeBuilder +func NewBrokerDataSetWriterTransportDataTypeBuilder() BrokerDataSetWriterTransportDataTypeBuilder { + return &_BrokerDataSetWriterTransportDataTypeBuilder{_BrokerDataSetWriterTransportDataType: new(_BrokerDataSetWriterTransportDataType)} +} + +type _BrokerDataSetWriterTransportDataTypeBuilder struct { + *_BrokerDataSetWriterTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (BrokerDataSetWriterTransportDataTypeBuilder) = (*_BrokerDataSetWriterTransportDataTypeBuilder)(nil) + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService, metaDataQueueName PascalString, metaDataUpdateTime float64) BrokerDataSetWriterTransportDataTypeBuilder { + return b.WithQueueName(queueName).WithResourceUri(resourceUri).WithAuthenticationProfileUri(authenticationProfileUri).WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee).WithMetaDataQueueName(metaDataQueueName).WithMetaDataUpdateTime(metaDataUpdateTime) +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithQueueName(queueName PascalString) BrokerDataSetWriterTransportDataTypeBuilder { + b.QueueName = queueName + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithQueueNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder { + builder := builderSupplier(b.QueueName.CreatePascalStringBuilder()) + var err error + b.QueueName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithResourceUri(resourceUri PascalString) BrokerDataSetWriterTransportDataTypeBuilder { + b.ResourceUri = resourceUri + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithResourceUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder { + builder := builderSupplier(b.ResourceUri.CreatePascalStringBuilder()) + var err error + b.ResourceUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithAuthenticationProfileUri(authenticationProfileUri PascalString) BrokerDataSetWriterTransportDataTypeBuilder { + b.AuthenticationProfileUri = authenticationProfileUri + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithAuthenticationProfileUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder { + builder := builderSupplier(b.AuthenticationProfileUri.CreatePascalStringBuilder()) + var err error + b.AuthenticationProfileUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee BrokerTransportQualityOfService) BrokerDataSetWriterTransportDataTypeBuilder { + b.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithMetaDataQueueName(metaDataQueueName PascalString) BrokerDataSetWriterTransportDataTypeBuilder { + b.MetaDataQueueName = metaDataQueueName + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithMetaDataQueueNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerDataSetWriterTransportDataTypeBuilder { + builder := builderSupplier(b.MetaDataQueueName.CreatePascalStringBuilder()) + var err error + b.MetaDataQueueName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) WithMetaDataUpdateTime(metaDataUpdateTime float64) BrokerDataSetWriterTransportDataTypeBuilder { + b.MetaDataUpdateTime = metaDataUpdateTime + return b +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) Build() (BrokerDataSetWriterTransportDataType, error) { + if b.QueueName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'queueName' not set")) + } + if b.ResourceUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'resourceUri' not set")) + } + if b.AuthenticationProfileUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'authenticationProfileUri' not set")) + } + if b.MetaDataQueueName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'metaDataQueueName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._BrokerDataSetWriterTransportDataType.deepCopy(), nil +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) MustBuild() BrokerDataSetWriterTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_BrokerDataSetWriterTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateBrokerDataSetWriterTransportDataTypeBuilder().(*_BrokerDataSetWriterTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateBrokerDataSetWriterTransportDataTypeBuilder creates a BrokerDataSetWriterTransportDataTypeBuilder +func (b *_BrokerDataSetWriterTransportDataType) CreateBrokerDataSetWriterTransportDataTypeBuilder() BrokerDataSetWriterTransportDataTypeBuilder { + if b == nil { + return NewBrokerDataSetWriterTransportDataTypeBuilder() + } + return &_BrokerDataSetWriterTransportDataTypeBuilder{_BrokerDataSetWriterTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_BrokerDataSetWriterTransportDataType) GetExtensionId() int32 { + return int32(15671) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_BrokerDataSetWriterTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BrokerDataSetWriterTransportDataType) GetQueueName() PascalString { + return m.QueueName +} + +func (m *_BrokerDataSetWriterTransportDataType) GetResourceUri() PascalString { + return m.ResourceUri +} + +func (m *_BrokerDataSetWriterTransportDataType) GetAuthenticationProfileUri() PascalString { + return m.AuthenticationProfileUri +} + +func (m *_BrokerDataSetWriterTransportDataType) GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService { + return m.RequestedDeliveryGuarantee +} + +func (m *_BrokerDataSetWriterTransportDataType) GetMetaDataQueueName() PascalString { + return m.MetaDataQueueName +} + +func (m *_BrokerDataSetWriterTransportDataType) GetMetaDataUpdateTime() float64 { + return m.MetaDataUpdateTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastBrokerDataSetWriterTransportDataType(structType any) BrokerDataSetWriterTransportDataType { + if casted, ok := structType.(BrokerDataSetWriterTransportDataType); ok { + return casted + } + if casted, ok := structType.(*BrokerDataSetWriterTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_BrokerDataSetWriterTransportDataType) GetTypeName() string { + return "BrokerDataSetWriterTransportDataType" +} + +func (m *_BrokerDataSetWriterTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (queueName) + lengthInBits += m.QueueName.GetLengthInBits(ctx) + + // Simple field (resourceUri) + lengthInBits += m.ResourceUri.GetLengthInBits(ctx) + + // Simple field (authenticationProfileUri) + lengthInBits += m.AuthenticationProfileUri.GetLengthInBits(ctx) + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32 + + // Simple field (metaDataQueueName) + lengthInBits += m.MetaDataQueueName.GetLengthInBits(ctx) + + // Simple field (metaDataUpdateTime) + lengthInBits += 64 + + return lengthInBits +} + +func (m *_BrokerDataSetWriterTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_BrokerDataSetWriterTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__brokerDataSetWriterTransportDataType BrokerDataSetWriterTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BrokerDataSetWriterTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BrokerDataSetWriterTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + queueName, err := ReadSimpleField[PascalString](ctx, "queueName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queueName' field")) + } + m.QueueName = queueName + + resourceUri, err := ReadSimpleField[PascalString](ctx, "resourceUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'resourceUri' field")) + } + m.ResourceUri = resourceUri + + authenticationProfileUri, err := ReadSimpleField[PascalString](ctx, "authenticationProfileUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'authenticationProfileUri' field")) + } + m.AuthenticationProfileUri = authenticationProfileUri + + requestedDeliveryGuarantee, err := ReadEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", ReadEnum(BrokerTransportQualityOfServiceByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestedDeliveryGuarantee' field")) + } + m.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + + metaDataQueueName, err := ReadSimpleField[PascalString](ctx, "metaDataQueueName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'metaDataQueueName' field")) + } + m.MetaDataQueueName = metaDataQueueName + + metaDataUpdateTime, err := ReadSimpleField(ctx, "metaDataUpdateTime", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'metaDataUpdateTime' field")) + } + m.MetaDataUpdateTime = metaDataUpdateTime + + if closeErr := readBuffer.CloseContext("BrokerDataSetWriterTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BrokerDataSetWriterTransportDataType") + } + + return m, nil +} + +func (m *_BrokerDataSetWriterTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_BrokerDataSetWriterTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("BrokerDataSetWriterTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BrokerDataSetWriterTransportDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "queueName", m.GetQueueName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'queueName' field") + } + + if err := WriteSimpleField[PascalString](ctx, "resourceUri", m.GetResourceUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'resourceUri' field") + } + + if err := WriteSimpleField[PascalString](ctx, "authenticationProfileUri", m.GetAuthenticationProfileUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'authenticationProfileUri' field") + } + + if err := WriteSimpleEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", m.GetRequestedDeliveryGuarantee(), WriteEnum[BrokerTransportQualityOfService, uint32](BrokerTransportQualityOfService.GetValue, BrokerTransportQualityOfService.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'requestedDeliveryGuarantee' field") + } + + if err := WriteSimpleField[PascalString](ctx, "metaDataQueueName", m.GetMetaDataQueueName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'metaDataQueueName' field") + } + + if err := WriteSimpleField[float64](ctx, "metaDataUpdateTime", m.GetMetaDataUpdateTime(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'metaDataUpdateTime' field") + } + + if popErr := writeBuffer.PopContext("BrokerDataSetWriterTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BrokerDataSetWriterTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_BrokerDataSetWriterTransportDataType) IsBrokerDataSetWriterTransportDataType() {} + +func (m *_BrokerDataSetWriterTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_BrokerDataSetWriterTransportDataType) deepCopy() *_BrokerDataSetWriterTransportDataType { + if m == nil { + return nil + } + _BrokerDataSetWriterTransportDataTypeCopy := &_BrokerDataSetWriterTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.QueueName.DeepCopy().(PascalString), + m.ResourceUri.DeepCopy().(PascalString), + m.AuthenticationProfileUri.DeepCopy().(PascalString), + m.RequestedDeliveryGuarantee, + m.MetaDataQueueName.DeepCopy().(PascalString), + m.MetaDataUpdateTime, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _BrokerDataSetWriterTransportDataTypeCopy +} + +func (m *_BrokerDataSetWriterTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/BrokerWriterGroupTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/BrokerWriterGroupTransportDataType.go new file mode 100644 index 00000000000..1d6cab8de37 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/BrokerWriterGroupTransportDataType.go @@ -0,0 +1,465 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BrokerWriterGroupTransportDataType is the corresponding interface of BrokerWriterGroupTransportDataType +type BrokerWriterGroupTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetQueueName returns QueueName (property field) + GetQueueName() PascalString + // GetResourceUri returns ResourceUri (property field) + GetResourceUri() PascalString + // GetAuthenticationProfileUri returns AuthenticationProfileUri (property field) + GetAuthenticationProfileUri() PascalString + // GetRequestedDeliveryGuarantee returns RequestedDeliveryGuarantee (property field) + GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService + // IsBrokerWriterGroupTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsBrokerWriterGroupTransportDataType() + // CreateBuilder creates a BrokerWriterGroupTransportDataTypeBuilder + CreateBrokerWriterGroupTransportDataTypeBuilder() BrokerWriterGroupTransportDataTypeBuilder +} + +// _BrokerWriterGroupTransportDataType is the data-structure of this message +type _BrokerWriterGroupTransportDataType struct { + ExtensionObjectDefinitionContract + QueueName PascalString + ResourceUri PascalString + AuthenticationProfileUri PascalString + RequestedDeliveryGuarantee BrokerTransportQualityOfService +} + +var _ BrokerWriterGroupTransportDataType = (*_BrokerWriterGroupTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_BrokerWriterGroupTransportDataType)(nil) + +// NewBrokerWriterGroupTransportDataType factory function for _BrokerWriterGroupTransportDataType +func NewBrokerWriterGroupTransportDataType(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService) *_BrokerWriterGroupTransportDataType { + if queueName == nil { + panic("queueName of type PascalString for BrokerWriterGroupTransportDataType must not be nil") + } + if resourceUri == nil { + panic("resourceUri of type PascalString for BrokerWriterGroupTransportDataType must not be nil") + } + if authenticationProfileUri == nil { + panic("authenticationProfileUri of type PascalString for BrokerWriterGroupTransportDataType must not be nil") + } + _result := &_BrokerWriterGroupTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + QueueName: queueName, + ResourceUri: resourceUri, + AuthenticationProfileUri: authenticationProfileUri, + RequestedDeliveryGuarantee: requestedDeliveryGuarantee, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// BrokerWriterGroupTransportDataTypeBuilder is a builder for BrokerWriterGroupTransportDataType +type BrokerWriterGroupTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService) BrokerWriterGroupTransportDataTypeBuilder + // WithQueueName adds QueueName (property field) + WithQueueName(PascalString) BrokerWriterGroupTransportDataTypeBuilder + // WithQueueNameBuilder adds QueueName (property field) which is build by the builder + WithQueueNameBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder + // WithResourceUri adds ResourceUri (property field) + WithResourceUri(PascalString) BrokerWriterGroupTransportDataTypeBuilder + // WithResourceUriBuilder adds ResourceUri (property field) which is build by the builder + WithResourceUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder + // WithAuthenticationProfileUri adds AuthenticationProfileUri (property field) + WithAuthenticationProfileUri(PascalString) BrokerWriterGroupTransportDataTypeBuilder + // WithAuthenticationProfileUriBuilder adds AuthenticationProfileUri (property field) which is build by the builder + WithAuthenticationProfileUriBuilder(func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder + // WithRequestedDeliveryGuarantee adds RequestedDeliveryGuarantee (property field) + WithRequestedDeliveryGuarantee(BrokerTransportQualityOfService) BrokerWriterGroupTransportDataTypeBuilder + // Build builds the BrokerWriterGroupTransportDataType or returns an error if something is wrong + Build() (BrokerWriterGroupTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() BrokerWriterGroupTransportDataType +} + +// NewBrokerWriterGroupTransportDataTypeBuilder() creates a BrokerWriterGroupTransportDataTypeBuilder +func NewBrokerWriterGroupTransportDataTypeBuilder() BrokerWriterGroupTransportDataTypeBuilder { + return &_BrokerWriterGroupTransportDataTypeBuilder{_BrokerWriterGroupTransportDataType: new(_BrokerWriterGroupTransportDataType)} +} + +type _BrokerWriterGroupTransportDataTypeBuilder struct { + *_BrokerWriterGroupTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (BrokerWriterGroupTransportDataTypeBuilder) = (*_BrokerWriterGroupTransportDataTypeBuilder)(nil) + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithMandatoryFields(queueName PascalString, resourceUri PascalString, authenticationProfileUri PascalString, requestedDeliveryGuarantee BrokerTransportQualityOfService) BrokerWriterGroupTransportDataTypeBuilder { + return b.WithQueueName(queueName).WithResourceUri(resourceUri).WithAuthenticationProfileUri(authenticationProfileUri).WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee) +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithQueueName(queueName PascalString) BrokerWriterGroupTransportDataTypeBuilder { + b.QueueName = queueName + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithQueueNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder { + builder := builderSupplier(b.QueueName.CreatePascalStringBuilder()) + var err error + b.QueueName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithResourceUri(resourceUri PascalString) BrokerWriterGroupTransportDataTypeBuilder { + b.ResourceUri = resourceUri + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithResourceUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder { + builder := builderSupplier(b.ResourceUri.CreatePascalStringBuilder()) + var err error + b.ResourceUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithAuthenticationProfileUri(authenticationProfileUri PascalString) BrokerWriterGroupTransportDataTypeBuilder { + b.AuthenticationProfileUri = authenticationProfileUri + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithAuthenticationProfileUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) BrokerWriterGroupTransportDataTypeBuilder { + builder := builderSupplier(b.AuthenticationProfileUri.CreatePascalStringBuilder()) + var err error + b.AuthenticationProfileUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) WithRequestedDeliveryGuarantee(requestedDeliveryGuarantee BrokerTransportQualityOfService) BrokerWriterGroupTransportDataTypeBuilder { + b.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + return b +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) Build() (BrokerWriterGroupTransportDataType, error) { + if b.QueueName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'queueName' not set")) + } + if b.ResourceUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'resourceUri' not set")) + } + if b.AuthenticationProfileUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'authenticationProfileUri' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._BrokerWriterGroupTransportDataType.deepCopy(), nil +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) MustBuild() BrokerWriterGroupTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_BrokerWriterGroupTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_BrokerWriterGroupTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateBrokerWriterGroupTransportDataTypeBuilder().(*_BrokerWriterGroupTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateBrokerWriterGroupTransportDataTypeBuilder creates a BrokerWriterGroupTransportDataTypeBuilder +func (b *_BrokerWriterGroupTransportDataType) CreateBrokerWriterGroupTransportDataTypeBuilder() BrokerWriterGroupTransportDataTypeBuilder { + if b == nil { + return NewBrokerWriterGroupTransportDataTypeBuilder() + } + return &_BrokerWriterGroupTransportDataTypeBuilder{_BrokerWriterGroupTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_BrokerWriterGroupTransportDataType) GetExtensionId() int32 { + return int32(15669) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_BrokerWriterGroupTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BrokerWriterGroupTransportDataType) GetQueueName() PascalString { + return m.QueueName +} + +func (m *_BrokerWriterGroupTransportDataType) GetResourceUri() PascalString { + return m.ResourceUri +} + +func (m *_BrokerWriterGroupTransportDataType) GetAuthenticationProfileUri() PascalString { + return m.AuthenticationProfileUri +} + +func (m *_BrokerWriterGroupTransportDataType) GetRequestedDeliveryGuarantee() BrokerTransportQualityOfService { + return m.RequestedDeliveryGuarantee +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastBrokerWriterGroupTransportDataType(structType any) BrokerWriterGroupTransportDataType { + if casted, ok := structType.(BrokerWriterGroupTransportDataType); ok { + return casted + } + if casted, ok := structType.(*BrokerWriterGroupTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_BrokerWriterGroupTransportDataType) GetTypeName() string { + return "BrokerWriterGroupTransportDataType" +} + +func (m *_BrokerWriterGroupTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (queueName) + lengthInBits += m.QueueName.GetLengthInBits(ctx) + + // Simple field (resourceUri) + lengthInBits += m.ResourceUri.GetLengthInBits(ctx) + + // Simple field (authenticationProfileUri) + lengthInBits += m.AuthenticationProfileUri.GetLengthInBits(ctx) + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32 + + return lengthInBits +} + +func (m *_BrokerWriterGroupTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_BrokerWriterGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__brokerWriterGroupTransportDataType BrokerWriterGroupTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BrokerWriterGroupTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BrokerWriterGroupTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + queueName, err := ReadSimpleField[PascalString](ctx, "queueName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queueName' field")) + } + m.QueueName = queueName + + resourceUri, err := ReadSimpleField[PascalString](ctx, "resourceUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'resourceUri' field")) + } + m.ResourceUri = resourceUri + + authenticationProfileUri, err := ReadSimpleField[PascalString](ctx, "authenticationProfileUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'authenticationProfileUri' field")) + } + m.AuthenticationProfileUri = authenticationProfileUri + + requestedDeliveryGuarantee, err := ReadEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", ReadEnum(BrokerTransportQualityOfServiceByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestedDeliveryGuarantee' field")) + } + m.RequestedDeliveryGuarantee = requestedDeliveryGuarantee + + if closeErr := readBuffer.CloseContext("BrokerWriterGroupTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BrokerWriterGroupTransportDataType") + } + + return m, nil +} + +func (m *_BrokerWriterGroupTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_BrokerWriterGroupTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("BrokerWriterGroupTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BrokerWriterGroupTransportDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "queueName", m.GetQueueName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'queueName' field") + } + + if err := WriteSimpleField[PascalString](ctx, "resourceUri", m.GetResourceUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'resourceUri' field") + } + + if err := WriteSimpleField[PascalString](ctx, "authenticationProfileUri", m.GetAuthenticationProfileUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'authenticationProfileUri' field") + } + + if err := WriteSimpleEnumField[BrokerTransportQualityOfService](ctx, "requestedDeliveryGuarantee", "BrokerTransportQualityOfService", m.GetRequestedDeliveryGuarantee(), WriteEnum[BrokerTransportQualityOfService, uint32](BrokerTransportQualityOfService.GetValue, BrokerTransportQualityOfService.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'requestedDeliveryGuarantee' field") + } + + if popErr := writeBuffer.PopContext("BrokerWriterGroupTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BrokerWriterGroupTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_BrokerWriterGroupTransportDataType) IsBrokerWriterGroupTransportDataType() {} + +func (m *_BrokerWriterGroupTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_BrokerWriterGroupTransportDataType) deepCopy() *_BrokerWriterGroupTransportDataType { + if m == nil { + return nil + } + _BrokerWriterGroupTransportDataTypeCopy := &_BrokerWriterGroupTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.QueueName.DeepCopy().(PascalString), + m.ResourceUri.DeepCopy().(PascalString), + m.AuthenticationProfileUri.DeepCopy().(PascalString), + m.RequestedDeliveryGuarantee, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _BrokerWriterGroupTransportDataTypeCopy +} + +func (m *_BrokerWriterGroupTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseDescription.go b/plc4go/protocols/opcua/readwrite/model/BrowseDescription.go index f811f6f1fbc..ff8065c5b8f 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseDescription.go @@ -268,8 +268,8 @@ func (b *_BrowseDescription) CreateBrowseDescriptionBuilder() BrowseDescriptionB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseDescription) GetIdentifier() string { - return "516" +func (m *_BrowseDescription) GetExtensionId() int32 { + return int32(516) } /////////////////////// @@ -361,7 +361,7 @@ func (m *_BrowseDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseDescription BrowseDescription, err error) { +func (m *_BrowseDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseDescription BrowseDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseNextRequest.go b/plc4go/protocols/opcua/readwrite/model/BrowseNextRequest.go index 1af802df57d..d2b3a71e2a6 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseNextRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseNextRequest.go @@ -41,11 +41,9 @@ type BrowseNextRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetReleaseContinuationPoints returns ReleaseContinuationPoints (property field) GetReleaseContinuationPoints() bool - // GetNoOfContinuationPoints returns NoOfContinuationPoints (property field) - GetNoOfContinuationPoints() int32 // GetContinuationPoints returns ContinuationPoints (property field) GetContinuationPoints() []PascalByteString // IsBrowseNextRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,9 +55,8 @@ type BrowseNextRequest interface { // _BrowseNextRequest is the data-structure of this message type _BrowseNextRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader ReleaseContinuationPoints bool - NoOfContinuationPoints int32 ContinuationPoints []PascalByteString // Reserved Fields reservedField0 *uint8 @@ -69,15 +66,14 @@ var _ BrowseNextRequest = (*_BrowseNextRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowseNextRequest)(nil) // NewBrowseNextRequest factory function for _BrowseNextRequest -func NewBrowseNextRequest(requestHeader ExtensionObjectDefinition, releaseContinuationPoints bool, noOfContinuationPoints int32, continuationPoints []PascalByteString) *_BrowseNextRequest { +func NewBrowseNextRequest(requestHeader RequestHeader, releaseContinuationPoints bool, continuationPoints []PascalByteString) *_BrowseNextRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for BrowseNextRequest must not be nil") + panic("requestHeader of type RequestHeader for BrowseNextRequest must not be nil") } _result := &_BrowseNextRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, ReleaseContinuationPoints: releaseContinuationPoints, - NoOfContinuationPoints: noOfContinuationPoints, ContinuationPoints: continuationPoints, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -93,15 +89,13 @@ func NewBrowseNextRequest(requestHeader ExtensionObjectDefinition, releaseContin type BrowseNextRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, releaseContinuationPoints bool, noOfContinuationPoints int32, continuationPoints []PascalByteString) BrowseNextRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, releaseContinuationPoints bool, continuationPoints []PascalByteString) BrowseNextRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) BrowseNextRequestBuilder + WithRequestHeader(RequestHeader) BrowseNextRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseNextRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) BrowseNextRequestBuilder // WithReleaseContinuationPoints adds ReleaseContinuationPoints (property field) WithReleaseContinuationPoints(bool) BrowseNextRequestBuilder - // WithNoOfContinuationPoints adds NoOfContinuationPoints (property field) - WithNoOfContinuationPoints(int32) BrowseNextRequestBuilder // WithContinuationPoints adds ContinuationPoints (property field) WithContinuationPoints(...PascalByteString) BrowseNextRequestBuilder // Build builds the BrowseNextRequest or returns an error if something is wrong @@ -129,24 +123,24 @@ func (b *_BrowseNextRequestBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowseNextRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, releaseContinuationPoints bool, noOfContinuationPoints int32, continuationPoints []PascalByteString) BrowseNextRequestBuilder { - return b.WithRequestHeader(requestHeader).WithReleaseContinuationPoints(releaseContinuationPoints).WithNoOfContinuationPoints(noOfContinuationPoints).WithContinuationPoints(continuationPoints...) +func (b *_BrowseNextRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, releaseContinuationPoints bool, continuationPoints []PascalByteString) BrowseNextRequestBuilder { + return b.WithRequestHeader(requestHeader).WithReleaseContinuationPoints(releaseContinuationPoints).WithContinuationPoints(continuationPoints...) } -func (b *_BrowseNextRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) BrowseNextRequestBuilder { +func (b *_BrowseNextRequestBuilder) WithRequestHeader(requestHeader RequestHeader) BrowseNextRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_BrowseNextRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseNextRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowseNextRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) BrowseNextRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -156,11 +150,6 @@ func (b *_BrowseNextRequestBuilder) WithReleaseContinuationPoints(releaseContinu return b } -func (b *_BrowseNextRequestBuilder) WithNoOfContinuationPoints(noOfContinuationPoints int32) BrowseNextRequestBuilder { - b.NoOfContinuationPoints = noOfContinuationPoints - return b -} - func (b *_BrowseNextRequestBuilder) WithContinuationPoints(continuationPoints ...PascalByteString) BrowseNextRequestBuilder { b.ContinuationPoints = continuationPoints return b @@ -222,8 +211,8 @@ func (b *_BrowseNextRequest) CreateBrowseNextRequestBuilder() BrowseNextRequestB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseNextRequest) GetIdentifier() string { - return "533" +func (m *_BrowseNextRequest) GetExtensionId() int32 { + return int32(533) } /////////////////////// @@ -240,7 +229,7 @@ func (m *_BrowseNextRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_BrowseNextRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_BrowseNextRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -248,10 +237,6 @@ func (m *_BrowseNextRequest) GetReleaseContinuationPoints() bool { return m.ReleaseContinuationPoints } -func (m *_BrowseNextRequest) GetNoOfContinuationPoints() int32 { - return m.NoOfContinuationPoints -} - func (m *_BrowseNextRequest) GetContinuationPoints() []PascalByteString { return m.ContinuationPoints } @@ -288,7 +273,7 @@ func (m *_BrowseNextRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (releaseContinuationPoints) lengthInBits += 1 - // Simple field (noOfContinuationPoints) + // Implicit Field (noOfContinuationPoints) lengthInBits += 32 // Array field @@ -308,7 +293,7 @@ func (m *_BrowseNextRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseNextRequest BrowseNextRequest, err error) { +func (m *_BrowseNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseNextRequest BrowseNextRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -319,7 +304,7 @@ func (m *_BrowseNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -337,11 +322,11 @@ func (m *_BrowseNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuf } m.ReleaseContinuationPoints = releaseContinuationPoints - noOfContinuationPoints, err := ReadSimpleField(ctx, "noOfContinuationPoints", ReadSignedInt(readBuffer, uint8(32))) + noOfContinuationPoints, err := ReadImplicitField[int32](ctx, "noOfContinuationPoints", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfContinuationPoints' field")) } - m.NoOfContinuationPoints = noOfContinuationPoints + _ = noOfContinuationPoints continuationPoints, err := ReadCountArrayField[PascalByteString](ctx, "continuationPoints", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfContinuationPoints)) if err != nil { @@ -374,7 +359,7 @@ func (m *_BrowseNextRequest) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for BrowseNextRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -385,8 +370,8 @@ func (m *_BrowseNextRequest) SerializeWithWriteBuffer(ctx context.Context, write if err := WriteSimpleField[bool](ctx, "releaseContinuationPoints", m.GetReleaseContinuationPoints(), WriteBoolean(writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'releaseContinuationPoints' field") } - - if err := WriteSimpleField[int32](ctx, "noOfContinuationPoints", m.GetNoOfContinuationPoints(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfContinuationPoints := int32(utils.InlineIf(bool((m.GetContinuationPoints()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetContinuationPoints()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfContinuationPoints", noOfContinuationPoints, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfContinuationPoints' field") } @@ -414,9 +399,8 @@ func (m *_BrowseNextRequest) deepCopy() *_BrowseNextRequest { } _BrowseNextRequestCopy := &_BrowseNextRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.ReleaseContinuationPoints, - m.NoOfContinuationPoints, utils.DeepCopySlice[PascalByteString, PascalByteString](m.ContinuationPoints), m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseNextResponse.go b/plc4go/protocols/opcua/readwrite/model/BrowseNextResponse.go index 77d7819cbb4..5201af40165 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseNextResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseNextResponse.go @@ -41,13 +41,9 @@ type BrowseNextResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []BrowseResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsBrowseNextResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type BrowseNextResponse interface { // _BrowseNextResponse is the data-structure of this message type _BrowseNextResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []BrowseResult + DiagnosticInfos []DiagnosticInfo } var _ BrowseNextResponse = (*_BrowseNextResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowseNextResponse)(nil) // NewBrowseNextResponse factory function for _BrowseNextResponse -func NewBrowseNextResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_BrowseNextResponse { +func NewBrowseNextResponse(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) *_BrowseNextResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for BrowseNextResponse must not be nil") + panic("responseHeader of type ResponseHeader for BrowseNextResponse must not be nil") } _result := &_BrowseNextResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewBrowseNextResponse(responseHeader ExtensionObjectDefinition, noOfResults type BrowseNextResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) BrowseNextResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) BrowseNextResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) BrowseNextResponseBuilder + WithResponseHeader(ResponseHeader) BrowseNextResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseNextResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) BrowseNextResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) BrowseNextResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) BrowseNextResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) BrowseNextResponseBuilder + WithResults(...BrowseResult) BrowseNextResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) BrowseNextResponseBuilder // Build builds the BrowseNextResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_BrowseNextResponseBuilder) setParent(contract ExtensionObjectDefinitio b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowseNextResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) BrowseNextResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_BrowseNextResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) BrowseNextResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_BrowseNextResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) BrowseNextResponseBuilder { +func (b *_BrowseNextResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) BrowseNextResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_BrowseNextResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseNextResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowseNextResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) BrowseNextResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_BrowseNextResponseBuilder) WithNoOfResults(noOfResults int32) BrowseNextResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_BrowseNextResponseBuilder) WithResults(results ...ExtensionObjectDefinition) BrowseNextResponseBuilder { +func (b *_BrowseNextResponseBuilder) WithResults(results ...BrowseResult) BrowseNextResponseBuilder { b.Results = results return b } -func (b *_BrowseNextResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) BrowseNextResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_BrowseNextResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) BrowseNextResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_BrowseNextResponse) CreateBrowseNextResponseBuilder() BrowseNextRespon /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseNextResponse) GetIdentifier() string { - return "536" +func (m *_BrowseNextResponse) GetExtensionId() int32 { + return int32(536) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_BrowseNextResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_BrowseNextResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_BrowseNextResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_BrowseNextResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_BrowseNextResponse) GetResults() []ExtensionObjectDefinition { +func (m *_BrowseNextResponse) GetResults() []BrowseResult { return m.Results } -func (m *_BrowseNextResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_BrowseNextResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_BrowseNextResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_BrowseNextResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_BrowseNextResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseNextResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseNextResponse BrowseNextResponse, err error) { +func (m *_BrowseNextResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseNextResponse BrowseNextResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_BrowseNextResponse) parse(ctx context.Context, readBuffer utils.ReadBu currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("524")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[BrowseResult](ctx, "results", ReadComplex[BrowseResult](ExtensionObjectDefinitionParseWithBufferProducer[BrowseResult]((int32)(int32(524))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_BrowseNextResponse) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(pushErr, "Error pushing for BrowseNextResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_BrowseNextResponse) deepCopy() *_BrowseNextResponse { } _BrowseNextResponseCopy := &_BrowseNextResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[BrowseResult, BrowseResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/BrowsePath.go b/plc4go/protocols/opcua/readwrite/model/BrowsePath.go index 4c38ac43872..4bb2e5f419f 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowsePath.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowsePath.go @@ -43,7 +43,7 @@ type BrowsePath interface { // GetStartingNode returns StartingNode (property field) GetStartingNode() NodeId // GetRelativePath returns RelativePath (property field) - GetRelativePath() ExtensionObjectDefinition + GetRelativePath() RelativePath // IsBrowsePath is a marker method to prevent unintentional type checks (interfaces of same signature) IsBrowsePath() // CreateBuilder creates a BrowsePathBuilder @@ -54,19 +54,19 @@ type BrowsePath interface { type _BrowsePath struct { ExtensionObjectDefinitionContract StartingNode NodeId - RelativePath ExtensionObjectDefinition + RelativePath RelativePath } var _ BrowsePath = (*_BrowsePath)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowsePath)(nil) // NewBrowsePath factory function for _BrowsePath -func NewBrowsePath(startingNode NodeId, relativePath ExtensionObjectDefinition) *_BrowsePath { +func NewBrowsePath(startingNode NodeId, relativePath RelativePath) *_BrowsePath { if startingNode == nil { panic("startingNode of type NodeId for BrowsePath must not be nil") } if relativePath == nil { - panic("relativePath of type ExtensionObjectDefinition for BrowsePath must not be nil") + panic("relativePath of type RelativePath for BrowsePath must not be nil") } _result := &_BrowsePath{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -86,15 +86,15 @@ func NewBrowsePath(startingNode NodeId, relativePath ExtensionObjectDefinition) type BrowsePathBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(startingNode NodeId, relativePath ExtensionObjectDefinition) BrowsePathBuilder + WithMandatoryFields(startingNode NodeId, relativePath RelativePath) BrowsePathBuilder // WithStartingNode adds StartingNode (property field) WithStartingNode(NodeId) BrowsePathBuilder // WithStartingNodeBuilder adds StartingNode (property field) which is build by the builder WithStartingNodeBuilder(func(NodeIdBuilder) NodeIdBuilder) BrowsePathBuilder // WithRelativePath adds RelativePath (property field) - WithRelativePath(ExtensionObjectDefinition) BrowsePathBuilder + WithRelativePath(RelativePath) BrowsePathBuilder // WithRelativePathBuilder adds RelativePath (property field) which is build by the builder - WithRelativePathBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowsePathBuilder + WithRelativePathBuilder(func(RelativePathBuilder) RelativePathBuilder) BrowsePathBuilder // Build builds the BrowsePath or returns an error if something is wrong Build() (BrowsePath, error) // MustBuild does the same as Build but panics on error @@ -120,7 +120,7 @@ func (b *_BrowsePathBuilder) setParent(contract ExtensionObjectDefinitionContrac b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowsePathBuilder) WithMandatoryFields(startingNode NodeId, relativePath ExtensionObjectDefinition) BrowsePathBuilder { +func (b *_BrowsePathBuilder) WithMandatoryFields(startingNode NodeId, relativePath RelativePath) BrowsePathBuilder { return b.WithStartingNode(startingNode).WithRelativePath(relativePath) } @@ -142,20 +142,20 @@ func (b *_BrowsePathBuilder) WithStartingNodeBuilder(builderSupplier func(NodeId return b } -func (b *_BrowsePathBuilder) WithRelativePath(relativePath ExtensionObjectDefinition) BrowsePathBuilder { +func (b *_BrowsePathBuilder) WithRelativePath(relativePath RelativePath) BrowsePathBuilder { b.RelativePath = relativePath return b } -func (b *_BrowsePathBuilder) WithRelativePathBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowsePathBuilder { - builder := builderSupplier(b.RelativePath.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowsePathBuilder) WithRelativePathBuilder(builderSupplier func(RelativePathBuilder) RelativePathBuilder) BrowsePathBuilder { + builder := builderSupplier(b.RelativePath.CreateRelativePathBuilder()) var err error b.RelativePath, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RelativePathBuilder failed")) } return b } @@ -222,8 +222,8 @@ func (b *_BrowsePath) CreateBrowsePathBuilder() BrowsePathBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowsePath) GetIdentifier() string { - return "545" +func (m *_BrowsePath) GetExtensionId() int32 { + return int32(545) } /////////////////////// @@ -244,7 +244,7 @@ func (m *_BrowsePath) GetStartingNode() NodeId { return m.StartingNode } -func (m *_BrowsePath) GetRelativePath() ExtensionObjectDefinition { +func (m *_BrowsePath) GetRelativePath() RelativePath { return m.RelativePath } @@ -284,7 +284,7 @@ func (m *_BrowsePath) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowsePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browsePath BrowsePath, err error) { +func (m *_BrowsePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browsePath BrowsePath, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -301,7 +301,7 @@ func (m *_BrowsePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, pa } m.StartingNode = startingNode - relativePath, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "relativePath", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("542")), readBuffer)) + relativePath, err := ReadSimpleField[RelativePath](ctx, "relativePath", ReadComplex[RelativePath](ExtensionObjectDefinitionParseWithBufferProducer[RelativePath]((int32)(int32(542))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'relativePath' field")) } @@ -336,7 +336,7 @@ func (m *_BrowsePath) SerializeWithWriteBuffer(ctx context.Context, writeBuffer return errors.Wrap(err, "Error serializing 'startingNode' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "relativePath", m.GetRelativePath(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RelativePath](ctx, "relativePath", m.GetRelativePath(), WriteComplex[RelativePath](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'relativePath' field") } @@ -361,7 +361,7 @@ func (m *_BrowsePath) deepCopy() *_BrowsePath { _BrowsePathCopy := &_BrowsePath{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StartingNode.DeepCopy().(NodeId), - m.RelativePath.DeepCopy().(ExtensionObjectDefinition), + m.RelativePath.DeepCopy().(RelativePath), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _BrowsePathCopy diff --git a/plc4go/protocols/opcua/readwrite/model/BrowsePathResult.go b/plc4go/protocols/opcua/readwrite/model/BrowsePathResult.go index 41868f3b73e..53283613926 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowsePathResult.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowsePathResult.go @@ -42,10 +42,8 @@ type BrowsePathResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfTargets returns NoOfTargets (property field) - GetNoOfTargets() int32 // GetTargets returns Targets (property field) - GetTargets() []ExtensionObjectDefinition + GetTargets() []BrowsePathTarget // IsBrowsePathResult is a marker method to prevent unintentional type checks (interfaces of same signature) IsBrowsePathResult() // CreateBuilder creates a BrowsePathResultBuilder @@ -55,23 +53,21 @@ type BrowsePathResult interface { // _BrowsePathResult is the data-structure of this message type _BrowsePathResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfTargets int32 - Targets []ExtensionObjectDefinition + StatusCode StatusCode + Targets []BrowsePathTarget } var _ BrowsePathResult = (*_BrowsePathResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowsePathResult)(nil) // NewBrowsePathResult factory function for _BrowsePathResult -func NewBrowsePathResult(statusCode StatusCode, noOfTargets int32, targets []ExtensionObjectDefinition) *_BrowsePathResult { +func NewBrowsePathResult(statusCode StatusCode, targets []BrowsePathTarget) *_BrowsePathResult { if statusCode == nil { panic("statusCode of type StatusCode for BrowsePathResult must not be nil") } _result := &_BrowsePathResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfTargets: noOfTargets, Targets: targets, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewBrowsePathResult(statusCode StatusCode, noOfTargets int32, targets []Ext type BrowsePathResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfTargets int32, targets []ExtensionObjectDefinition) BrowsePathResultBuilder + WithMandatoryFields(statusCode StatusCode, targets []BrowsePathTarget) BrowsePathResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) BrowsePathResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) BrowsePathResultBuilder - // WithNoOfTargets adds NoOfTargets (property field) - WithNoOfTargets(int32) BrowsePathResultBuilder // WithTargets adds Targets (property field) - WithTargets(...ExtensionObjectDefinition) BrowsePathResultBuilder + WithTargets(...BrowsePathTarget) BrowsePathResultBuilder // Build builds the BrowsePathResult or returns an error if something is wrong Build() (BrowsePathResult, error) // MustBuild does the same as Build but panics on error @@ -121,8 +115,8 @@ func (b *_BrowsePathResultBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowsePathResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfTargets int32, targets []ExtensionObjectDefinition) BrowsePathResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfTargets(noOfTargets).WithTargets(targets...) +func (b *_BrowsePathResultBuilder) WithMandatoryFields(statusCode StatusCode, targets []BrowsePathTarget) BrowsePathResultBuilder { + return b.WithStatusCode(statusCode).WithTargets(targets...) } func (b *_BrowsePathResultBuilder) WithStatusCode(statusCode StatusCode) BrowsePathResultBuilder { @@ -143,12 +137,7 @@ func (b *_BrowsePathResultBuilder) WithStatusCodeBuilder(builderSupplier func(St return b } -func (b *_BrowsePathResultBuilder) WithNoOfTargets(noOfTargets int32) BrowsePathResultBuilder { - b.NoOfTargets = noOfTargets - return b -} - -func (b *_BrowsePathResultBuilder) WithTargets(targets ...ExtensionObjectDefinition) BrowsePathResultBuilder { +func (b *_BrowsePathResultBuilder) WithTargets(targets ...BrowsePathTarget) BrowsePathResultBuilder { b.Targets = targets return b } @@ -209,8 +198,8 @@ func (b *_BrowsePathResult) CreateBrowsePathResultBuilder() BrowsePathResultBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowsePathResult) GetIdentifier() string { - return "551" +func (m *_BrowsePathResult) GetExtensionId() int32 { + return int32(551) } /////////////////////// @@ -231,11 +220,7 @@ func (m *_BrowsePathResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_BrowsePathResult) GetNoOfTargets() int32 { - return m.NoOfTargets -} - -func (m *_BrowsePathResult) GetTargets() []ExtensionObjectDefinition { +func (m *_BrowsePathResult) GetTargets() []BrowsePathTarget { return m.Targets } @@ -265,7 +250,7 @@ func (m *_BrowsePathResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfTargets) + // Implicit Field (noOfTargets) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_BrowsePathResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowsePathResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browsePathResult BrowsePathResult, err error) { +func (m *_BrowsePathResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browsePathResult BrowsePathResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -302,13 +287,13 @@ func (m *_BrowsePathResult) parse(ctx context.Context, readBuffer utils.ReadBuff } m.StatusCode = statusCode - noOfTargets, err := ReadSimpleField(ctx, "noOfTargets", ReadSignedInt(readBuffer, uint8(32))) + noOfTargets, err := ReadImplicitField[int32](ctx, "noOfTargets", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfTargets' field")) } - m.NoOfTargets = noOfTargets + _ = noOfTargets - targets, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "targets", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("548")), readBuffer), uint64(noOfTargets)) + targets, err := ReadCountArrayField[BrowsePathTarget](ctx, "targets", ReadComplex[BrowsePathTarget](ExtensionObjectDefinitionParseWithBufferProducer[BrowsePathTarget]((int32)(int32(548))), readBuffer), uint64(noOfTargets)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'targets' field")) } @@ -342,8 +327,8 @@ func (m *_BrowsePathResult) SerializeWithWriteBuffer(ctx context.Context, writeB if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfTargets", m.GetNoOfTargets(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfTargets := int32(utils.InlineIf(bool((m.GetTargets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetTargets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfTargets", noOfTargets, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfTargets' field") } @@ -372,8 +357,7 @@ func (m *_BrowsePathResult) deepCopy() *_BrowsePathResult { _BrowsePathResultCopy := &_BrowsePathResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfTargets, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Targets), + utils.DeepCopySlice[BrowsePathTarget, BrowsePathTarget](m.Targets), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _BrowsePathResultCopy diff --git a/plc4go/protocols/opcua/readwrite/model/BrowsePathTarget.go b/plc4go/protocols/opcua/readwrite/model/BrowsePathTarget.go index afcf5b934d9..7e5e7157c61 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowsePathTarget.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowsePathTarget.go @@ -198,8 +198,8 @@ func (b *_BrowsePathTarget) CreateBrowsePathTargetBuilder() BrowsePathTargetBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowsePathTarget) GetIdentifier() string { - return "548" +func (m *_BrowsePathTarget) GetExtensionId() int32 { + return int32(548) } /////////////////////// @@ -260,7 +260,7 @@ func (m *_BrowsePathTarget) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowsePathTarget) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browsePathTarget BrowsePathTarget, err error) { +func (m *_BrowsePathTarget) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browsePathTarget BrowsePathTarget, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseRequest.go b/plc4go/protocols/opcua/readwrite/model/BrowseRequest.go index 915e3b85068..914a24cf771 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseRequest.go @@ -41,15 +41,13 @@ type BrowseRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetView returns View (property field) - GetView() ExtensionObjectDefinition + GetView() ViewDescription // GetRequestedMaxReferencesPerNode returns RequestedMaxReferencesPerNode (property field) GetRequestedMaxReferencesPerNode() uint32 - // GetNoOfNodesToBrowse returns NoOfNodesToBrowse (property field) - GetNoOfNodesToBrowse() int32 // GetNodesToBrowse returns NodesToBrowse (property field) - GetNodesToBrowse() []ExtensionObjectDefinition + GetNodesToBrowse() []BrowseDescription // IsBrowseRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsBrowseRequest() // CreateBuilder creates a BrowseRequestBuilder @@ -59,30 +57,28 @@ type BrowseRequest interface { // _BrowseRequest is the data-structure of this message type _BrowseRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - View ExtensionObjectDefinition + RequestHeader RequestHeader + View ViewDescription RequestedMaxReferencesPerNode uint32 - NoOfNodesToBrowse int32 - NodesToBrowse []ExtensionObjectDefinition + NodesToBrowse []BrowseDescription } var _ BrowseRequest = (*_BrowseRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowseRequest)(nil) // NewBrowseRequest factory function for _BrowseRequest -func NewBrowseRequest(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, requestedMaxReferencesPerNode uint32, noOfNodesToBrowse int32, nodesToBrowse []ExtensionObjectDefinition) *_BrowseRequest { +func NewBrowseRequest(requestHeader RequestHeader, view ViewDescription, requestedMaxReferencesPerNode uint32, nodesToBrowse []BrowseDescription) *_BrowseRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for BrowseRequest must not be nil") + panic("requestHeader of type RequestHeader for BrowseRequest must not be nil") } if view == nil { - panic("view of type ExtensionObjectDefinition for BrowseRequest must not be nil") + panic("view of type ViewDescription for BrowseRequest must not be nil") } _result := &_BrowseRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, View: view, RequestedMaxReferencesPerNode: requestedMaxReferencesPerNode, - NoOfNodesToBrowse: noOfNodesToBrowse, NodesToBrowse: nodesToBrowse, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -98,21 +94,19 @@ func NewBrowseRequest(requestHeader ExtensionObjectDefinition, view ExtensionObj type BrowseRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, requestedMaxReferencesPerNode uint32, noOfNodesToBrowse int32, nodesToBrowse []ExtensionObjectDefinition) BrowseRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, view ViewDescription, requestedMaxReferencesPerNode uint32, nodesToBrowse []BrowseDescription) BrowseRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) BrowseRequestBuilder + WithRequestHeader(RequestHeader) BrowseRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) BrowseRequestBuilder // WithView adds View (property field) - WithView(ExtensionObjectDefinition) BrowseRequestBuilder + WithView(ViewDescription) BrowseRequestBuilder // WithViewBuilder adds View (property field) which is build by the builder - WithViewBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseRequestBuilder + WithViewBuilder(func(ViewDescriptionBuilder) ViewDescriptionBuilder) BrowseRequestBuilder // WithRequestedMaxReferencesPerNode adds RequestedMaxReferencesPerNode (property field) WithRequestedMaxReferencesPerNode(uint32) BrowseRequestBuilder - // WithNoOfNodesToBrowse adds NoOfNodesToBrowse (property field) - WithNoOfNodesToBrowse(int32) BrowseRequestBuilder // WithNodesToBrowse adds NodesToBrowse (property field) - WithNodesToBrowse(...ExtensionObjectDefinition) BrowseRequestBuilder + WithNodesToBrowse(...BrowseDescription) BrowseRequestBuilder // Build builds the BrowseRequest or returns an error if something is wrong Build() (BrowseRequest, error) // MustBuild does the same as Build but panics on error @@ -138,42 +132,42 @@ func (b *_BrowseRequestBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowseRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, requestedMaxReferencesPerNode uint32, noOfNodesToBrowse int32, nodesToBrowse []ExtensionObjectDefinition) BrowseRequestBuilder { - return b.WithRequestHeader(requestHeader).WithView(view).WithRequestedMaxReferencesPerNode(requestedMaxReferencesPerNode).WithNoOfNodesToBrowse(noOfNodesToBrowse).WithNodesToBrowse(nodesToBrowse...) +func (b *_BrowseRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, view ViewDescription, requestedMaxReferencesPerNode uint32, nodesToBrowse []BrowseDescription) BrowseRequestBuilder { + return b.WithRequestHeader(requestHeader).WithView(view).WithRequestedMaxReferencesPerNode(requestedMaxReferencesPerNode).WithNodesToBrowse(nodesToBrowse...) } -func (b *_BrowseRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) BrowseRequestBuilder { +func (b *_BrowseRequestBuilder) WithRequestHeader(requestHeader RequestHeader) BrowseRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_BrowseRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowseRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) BrowseRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_BrowseRequestBuilder) WithView(view ExtensionObjectDefinition) BrowseRequestBuilder { +func (b *_BrowseRequestBuilder) WithView(view ViewDescription) BrowseRequestBuilder { b.View = view return b } -func (b *_BrowseRequestBuilder) WithViewBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseRequestBuilder { - builder := builderSupplier(b.View.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowseRequestBuilder) WithViewBuilder(builderSupplier func(ViewDescriptionBuilder) ViewDescriptionBuilder) BrowseRequestBuilder { + builder := builderSupplier(b.View.CreateViewDescriptionBuilder()) var err error b.View, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ViewDescriptionBuilder failed")) } return b } @@ -183,12 +177,7 @@ func (b *_BrowseRequestBuilder) WithRequestedMaxReferencesPerNode(requestedMaxRe return b } -func (b *_BrowseRequestBuilder) WithNoOfNodesToBrowse(noOfNodesToBrowse int32) BrowseRequestBuilder { - b.NoOfNodesToBrowse = noOfNodesToBrowse - return b -} - -func (b *_BrowseRequestBuilder) WithNodesToBrowse(nodesToBrowse ...ExtensionObjectDefinition) BrowseRequestBuilder { +func (b *_BrowseRequestBuilder) WithNodesToBrowse(nodesToBrowse ...BrowseDescription) BrowseRequestBuilder { b.NodesToBrowse = nodesToBrowse return b } @@ -255,8 +244,8 @@ func (b *_BrowseRequest) CreateBrowseRequestBuilder() BrowseRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseRequest) GetIdentifier() string { - return "527" +func (m *_BrowseRequest) GetExtensionId() int32 { + return int32(527) } /////////////////////// @@ -273,11 +262,11 @@ func (m *_BrowseRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_BrowseRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_BrowseRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_BrowseRequest) GetView() ExtensionObjectDefinition { +func (m *_BrowseRequest) GetView() ViewDescription { return m.View } @@ -285,11 +274,7 @@ func (m *_BrowseRequest) GetRequestedMaxReferencesPerNode() uint32 { return m.RequestedMaxReferencesPerNode } -func (m *_BrowseRequest) GetNoOfNodesToBrowse() int32 { - return m.NoOfNodesToBrowse -} - -func (m *_BrowseRequest) GetNodesToBrowse() []ExtensionObjectDefinition { +func (m *_BrowseRequest) GetNodesToBrowse() []BrowseDescription { return m.NodesToBrowse } @@ -325,7 +310,7 @@ func (m *_BrowseRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestedMaxReferencesPerNode) lengthInBits += 32 - // Simple field (noOfNodesToBrowse) + // Implicit Field (noOfNodesToBrowse) lengthInBits += 32 // Array field @@ -345,7 +330,7 @@ func (m *_BrowseRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseRequest BrowseRequest, err error) { +func (m *_BrowseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseRequest BrowseRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -356,13 +341,13 @@ func (m *_BrowseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - view, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "view", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("513")), readBuffer)) + view, err := ReadSimpleField[ViewDescription](ctx, "view", ReadComplex[ViewDescription](ExtensionObjectDefinitionParseWithBufferProducer[ViewDescription]((int32)(int32(513))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'view' field")) } @@ -374,13 +359,13 @@ func (m *_BrowseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.RequestedMaxReferencesPerNode = requestedMaxReferencesPerNode - noOfNodesToBrowse, err := ReadSimpleField(ctx, "noOfNodesToBrowse", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToBrowse, err := ReadImplicitField[int32](ctx, "noOfNodesToBrowse", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToBrowse' field")) } - m.NoOfNodesToBrowse = noOfNodesToBrowse + _ = noOfNodesToBrowse - nodesToBrowse, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToBrowse", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("516")), readBuffer), uint64(noOfNodesToBrowse)) + nodesToBrowse, err := ReadCountArrayField[BrowseDescription](ctx, "nodesToBrowse", ReadComplex[BrowseDescription](ExtensionObjectDefinitionParseWithBufferProducer[BrowseDescription]((int32)(int32(516))), readBuffer), uint64(noOfNodesToBrowse)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToBrowse' field")) } @@ -411,19 +396,19 @@ func (m *_BrowseRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuff return errors.Wrap(pushErr, "Error pushing for BrowseRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "view", m.GetView(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ViewDescription](ctx, "view", m.GetView(), WriteComplex[ViewDescription](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'view' field") } if err := WriteSimpleField[uint32](ctx, "requestedMaxReferencesPerNode", m.GetRequestedMaxReferencesPerNode(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'requestedMaxReferencesPerNode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToBrowse", m.GetNoOfNodesToBrowse(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToBrowse := int32(utils.InlineIf(bool((m.GetNodesToBrowse()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToBrowse()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToBrowse", noOfNodesToBrowse, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToBrowse' field") } @@ -451,11 +436,10 @@ func (m *_BrowseRequest) deepCopy() *_BrowseRequest { } _BrowseRequestCopy := &_BrowseRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.View.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), + m.View.DeepCopy().(ViewDescription), m.RequestedMaxReferencesPerNode, - m.NoOfNodesToBrowse, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToBrowse), + utils.DeepCopySlice[BrowseDescription, BrowseDescription](m.NodesToBrowse), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _BrowseRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseResponse.go b/plc4go/protocols/opcua/readwrite/model/BrowseResponse.go index 9994a3cce4a..e44b6dcf723 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseResponse.go @@ -41,13 +41,9 @@ type BrowseResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []BrowseResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsBrowseResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type BrowseResponse interface { // _BrowseResponse is the data-structure of this message type _BrowseResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []BrowseResult + DiagnosticInfos []DiagnosticInfo } var _ BrowseResponse = (*_BrowseResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowseResponse)(nil) // NewBrowseResponse factory function for _BrowseResponse -func NewBrowseResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_BrowseResponse { +func NewBrowseResponse(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) *_BrowseResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for BrowseResponse must not be nil") + panic("responseHeader of type ResponseHeader for BrowseResponse must not be nil") } _result := &_BrowseResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewBrowseResponse(responseHeader ExtensionObjectDefinition, noOfResults int type BrowseResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) BrowseResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) BrowseResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) BrowseResponseBuilder + WithResponseHeader(ResponseHeader) BrowseResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) BrowseResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) BrowseResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) BrowseResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) BrowseResponseBuilder + WithResults(...BrowseResult) BrowseResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) BrowseResponseBuilder // Build builds the BrowseResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_BrowseResponseBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowseResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) BrowseResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_BrowseResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []BrowseResult, diagnosticInfos []DiagnosticInfo) BrowseResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_BrowseResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) BrowseResponseBuilder { +func (b *_BrowseResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) BrowseResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_BrowseResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) BrowseResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_BrowseResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) BrowseResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_BrowseResponseBuilder) WithNoOfResults(noOfResults int32) BrowseResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_BrowseResponseBuilder) WithResults(results ...ExtensionObjectDefinition) BrowseResponseBuilder { +func (b *_BrowseResponseBuilder) WithResults(results ...BrowseResult) BrowseResponseBuilder { b.Results = results return b } -func (b *_BrowseResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) BrowseResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_BrowseResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) BrowseResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_BrowseResponse) CreateBrowseResponseBuilder() BrowseResponseBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseResponse) GetIdentifier() string { - return "530" +func (m *_BrowseResponse) GetExtensionId() int32 { + return int32(530) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_BrowseResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_BrowseResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_BrowseResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_BrowseResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_BrowseResponse) GetResults() []ExtensionObjectDefinition { +func (m *_BrowseResponse) GetResults() []BrowseResult { return m.Results } -func (m *_BrowseResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_BrowseResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_BrowseResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_BrowseResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_BrowseResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseResponse BrowseResponse, err error) { +func (m *_BrowseResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseResponse BrowseResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_BrowseResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("524")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[BrowseResult](ctx, "results", ReadComplex[BrowseResult](ExtensionObjectDefinitionParseWithBufferProducer[BrowseResult]((int32)(int32(524))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_BrowseResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuf return errors.Wrap(pushErr, "Error pushing for BrowseResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_BrowseResponse) deepCopy() *_BrowseResponse { } _BrowseResponseCopy := &_BrowseResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[BrowseResult, BrowseResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/BrowseResult.go b/plc4go/protocols/opcua/readwrite/model/BrowseResult.go index fa72dcb9df8..1cd5f0fdb8c 100644 --- a/plc4go/protocols/opcua/readwrite/model/BrowseResult.go +++ b/plc4go/protocols/opcua/readwrite/model/BrowseResult.go @@ -44,10 +44,8 @@ type BrowseResult interface { GetStatusCode() StatusCode // GetContinuationPoint returns ContinuationPoint (property field) GetContinuationPoint() PascalByteString - // GetNoOfReferences returns NoOfReferences (property field) - GetNoOfReferences() int32 // GetReferences returns References (property field) - GetReferences() []ExtensionObjectDefinition + GetReferences() []ReferenceDescription // IsBrowseResult is a marker method to prevent unintentional type checks (interfaces of same signature) IsBrowseResult() // CreateBuilder creates a BrowseResultBuilder @@ -59,15 +57,14 @@ type _BrowseResult struct { ExtensionObjectDefinitionContract StatusCode StatusCode ContinuationPoint PascalByteString - NoOfReferences int32 - References []ExtensionObjectDefinition + References []ReferenceDescription } var _ BrowseResult = (*_BrowseResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_BrowseResult)(nil) // NewBrowseResult factory function for _BrowseResult -func NewBrowseResult(statusCode StatusCode, continuationPoint PascalByteString, noOfReferences int32, references []ExtensionObjectDefinition) *_BrowseResult { +func NewBrowseResult(statusCode StatusCode, continuationPoint PascalByteString, references []ReferenceDescription) *_BrowseResult { if statusCode == nil { panic("statusCode of type StatusCode for BrowseResult must not be nil") } @@ -78,7 +75,6 @@ func NewBrowseResult(statusCode StatusCode, continuationPoint PascalByteString, ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, ContinuationPoint: continuationPoint, - NoOfReferences: noOfReferences, References: references, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -94,7 +90,7 @@ func NewBrowseResult(statusCode StatusCode, continuationPoint PascalByteString, type BrowseResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, continuationPoint PascalByteString, noOfReferences int32, references []ExtensionObjectDefinition) BrowseResultBuilder + WithMandatoryFields(statusCode StatusCode, continuationPoint PascalByteString, references []ReferenceDescription) BrowseResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) BrowseResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder @@ -103,10 +99,8 @@ type BrowseResultBuilder interface { WithContinuationPoint(PascalByteString) BrowseResultBuilder // WithContinuationPointBuilder adds ContinuationPoint (property field) which is build by the builder WithContinuationPointBuilder(func(PascalByteStringBuilder) PascalByteStringBuilder) BrowseResultBuilder - // WithNoOfReferences adds NoOfReferences (property field) - WithNoOfReferences(int32) BrowseResultBuilder // WithReferences adds References (property field) - WithReferences(...ExtensionObjectDefinition) BrowseResultBuilder + WithReferences(...ReferenceDescription) BrowseResultBuilder // Build builds the BrowseResult or returns an error if something is wrong Build() (BrowseResult, error) // MustBuild does the same as Build but panics on error @@ -132,8 +126,8 @@ func (b *_BrowseResultBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_BrowseResultBuilder) WithMandatoryFields(statusCode StatusCode, continuationPoint PascalByteString, noOfReferences int32, references []ExtensionObjectDefinition) BrowseResultBuilder { - return b.WithStatusCode(statusCode).WithContinuationPoint(continuationPoint).WithNoOfReferences(noOfReferences).WithReferences(references...) +func (b *_BrowseResultBuilder) WithMandatoryFields(statusCode StatusCode, continuationPoint PascalByteString, references []ReferenceDescription) BrowseResultBuilder { + return b.WithStatusCode(statusCode).WithContinuationPoint(continuationPoint).WithReferences(references...) } func (b *_BrowseResultBuilder) WithStatusCode(statusCode StatusCode) BrowseResultBuilder { @@ -172,12 +166,7 @@ func (b *_BrowseResultBuilder) WithContinuationPointBuilder(builderSupplier func return b } -func (b *_BrowseResultBuilder) WithNoOfReferences(noOfReferences int32) BrowseResultBuilder { - b.NoOfReferences = noOfReferences - return b -} - -func (b *_BrowseResultBuilder) WithReferences(references ...ExtensionObjectDefinition) BrowseResultBuilder { +func (b *_BrowseResultBuilder) WithReferences(references ...ReferenceDescription) BrowseResultBuilder { b.References = references return b } @@ -244,8 +233,8 @@ func (b *_BrowseResult) CreateBrowseResultBuilder() BrowseResultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BrowseResult) GetIdentifier() string { - return "524" +func (m *_BrowseResult) GetExtensionId() int32 { + return int32(524) } /////////////////////// @@ -270,11 +259,7 @@ func (m *_BrowseResult) GetContinuationPoint() PascalByteString { return m.ContinuationPoint } -func (m *_BrowseResult) GetNoOfReferences() int32 { - return m.NoOfReferences -} - -func (m *_BrowseResult) GetReferences() []ExtensionObjectDefinition { +func (m *_BrowseResult) GetReferences() []ReferenceDescription { return m.References } @@ -307,7 +292,7 @@ func (m *_BrowseResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (continuationPoint) lengthInBits += m.ContinuationPoint.GetLengthInBits(ctx) - // Simple field (noOfReferences) + // Implicit Field (noOfReferences) lengthInBits += 32 // Array field @@ -327,7 +312,7 @@ func (m *_BrowseResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BrowseResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__browseResult BrowseResult, err error) { +func (m *_BrowseResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__browseResult BrowseResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -350,13 +335,13 @@ func (m *_BrowseResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.ContinuationPoint = continuationPoint - noOfReferences, err := ReadSimpleField(ctx, "noOfReferences", ReadSignedInt(readBuffer, uint8(32))) + noOfReferences, err := ReadImplicitField[int32](ctx, "noOfReferences", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReferences' field")) } - m.NoOfReferences = noOfReferences + _ = noOfReferences - references, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "references", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("520")), readBuffer), uint64(noOfReferences)) + references, err := ReadCountArrayField[ReferenceDescription](ctx, "references", ReadComplex[ReferenceDescription](ExtensionObjectDefinitionParseWithBufferProducer[ReferenceDescription]((int32)(int32(520))), readBuffer), uint64(noOfReferences)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'references' field")) } @@ -394,8 +379,8 @@ func (m *_BrowseResult) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if err := WriteSimpleField[PascalByteString](ctx, "continuationPoint", m.GetContinuationPoint(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'continuationPoint' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReferences", m.GetNoOfReferences(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReferences := int32(utils.InlineIf(bool((m.GetReferences()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReferences()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReferences", noOfReferences, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReferences' field") } @@ -425,8 +410,7 @@ func (m *_BrowseResult) deepCopy() *_BrowseResult { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), m.ContinuationPoint.DeepCopy().(PascalByteString), - m.NoOfReferences, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.References), + utils.DeepCopySlice[ReferenceDescription, ReferenceDescription](m.References), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _BrowseResultCopy diff --git a/plc4go/protocols/opcua/readwrite/model/BuildInfo.go b/plc4go/protocols/opcua/readwrite/model/BuildInfo.go index 91a5b8c681a..fa9a63dd926 100644 --- a/plc4go/protocols/opcua/readwrite/model/BuildInfo.go +++ b/plc4go/protocols/opcua/readwrite/model/BuildInfo.go @@ -338,8 +338,8 @@ func (b *_BuildInfo) CreateBuildInfoBuilder() BuildInfoBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_BuildInfo) GetIdentifier() string { - return "340" +func (m *_BuildInfo) GetExtensionId() int32 { + return int32(340) } /////////////////////// @@ -428,7 +428,7 @@ func (m *_BuildInfo) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_BuildInfo) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__buildInfo BuildInfo, err error) { +func (m *_BuildInfo) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__buildInfo BuildInfo, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/CallMethodRequest.go b/plc4go/protocols/opcua/readwrite/model/CallMethodRequest.go index 36181a8e927..4b061fee545 100644 --- a/plc4go/protocols/opcua/readwrite/model/CallMethodRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CallMethodRequest.go @@ -44,8 +44,6 @@ type CallMethodRequest interface { GetObjectId() NodeId // GetMethodId returns MethodId (property field) GetMethodId() NodeId - // GetNoOfInputArguments returns NoOfInputArguments (property field) - GetNoOfInputArguments() int32 // GetInputArguments returns InputArguments (property field) GetInputArguments() []Variant // IsCallMethodRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,17 +55,16 @@ type CallMethodRequest interface { // _CallMethodRequest is the data-structure of this message type _CallMethodRequest struct { ExtensionObjectDefinitionContract - ObjectId NodeId - MethodId NodeId - NoOfInputArguments int32 - InputArguments []Variant + ObjectId NodeId + MethodId NodeId + InputArguments []Variant } var _ CallMethodRequest = (*_CallMethodRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CallMethodRequest)(nil) // NewCallMethodRequest factory function for _CallMethodRequest -func NewCallMethodRequest(objectId NodeId, methodId NodeId, noOfInputArguments int32, inputArguments []Variant) *_CallMethodRequest { +func NewCallMethodRequest(objectId NodeId, methodId NodeId, inputArguments []Variant) *_CallMethodRequest { if objectId == nil { panic("objectId of type NodeId for CallMethodRequest must not be nil") } @@ -78,7 +75,6 @@ func NewCallMethodRequest(objectId NodeId, methodId NodeId, noOfInputArguments i ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ObjectId: objectId, MethodId: methodId, - NoOfInputArguments: noOfInputArguments, InputArguments: inputArguments, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -94,7 +90,7 @@ func NewCallMethodRequest(objectId NodeId, methodId NodeId, noOfInputArguments i type CallMethodRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(objectId NodeId, methodId NodeId, noOfInputArguments int32, inputArguments []Variant) CallMethodRequestBuilder + WithMandatoryFields(objectId NodeId, methodId NodeId, inputArguments []Variant) CallMethodRequestBuilder // WithObjectId adds ObjectId (property field) WithObjectId(NodeId) CallMethodRequestBuilder // WithObjectIdBuilder adds ObjectId (property field) which is build by the builder @@ -103,8 +99,6 @@ type CallMethodRequestBuilder interface { WithMethodId(NodeId) CallMethodRequestBuilder // WithMethodIdBuilder adds MethodId (property field) which is build by the builder WithMethodIdBuilder(func(NodeIdBuilder) NodeIdBuilder) CallMethodRequestBuilder - // WithNoOfInputArguments adds NoOfInputArguments (property field) - WithNoOfInputArguments(int32) CallMethodRequestBuilder // WithInputArguments adds InputArguments (property field) WithInputArguments(...Variant) CallMethodRequestBuilder // Build builds the CallMethodRequest or returns an error if something is wrong @@ -132,8 +126,8 @@ func (b *_CallMethodRequestBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_CallMethodRequestBuilder) WithMandatoryFields(objectId NodeId, methodId NodeId, noOfInputArguments int32, inputArguments []Variant) CallMethodRequestBuilder { - return b.WithObjectId(objectId).WithMethodId(methodId).WithNoOfInputArguments(noOfInputArguments).WithInputArguments(inputArguments...) +func (b *_CallMethodRequestBuilder) WithMandatoryFields(objectId NodeId, methodId NodeId, inputArguments []Variant) CallMethodRequestBuilder { + return b.WithObjectId(objectId).WithMethodId(methodId).WithInputArguments(inputArguments...) } func (b *_CallMethodRequestBuilder) WithObjectId(objectId NodeId) CallMethodRequestBuilder { @@ -172,11 +166,6 @@ func (b *_CallMethodRequestBuilder) WithMethodIdBuilder(builderSupplier func(Nod return b } -func (b *_CallMethodRequestBuilder) WithNoOfInputArguments(noOfInputArguments int32) CallMethodRequestBuilder { - b.NoOfInputArguments = noOfInputArguments - return b -} - func (b *_CallMethodRequestBuilder) WithInputArguments(inputArguments ...Variant) CallMethodRequestBuilder { b.InputArguments = inputArguments return b @@ -244,8 +233,8 @@ func (b *_CallMethodRequest) CreateCallMethodRequestBuilder() CallMethodRequestB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CallMethodRequest) GetIdentifier() string { - return "706" +func (m *_CallMethodRequest) GetExtensionId() int32 { + return int32(706) } /////////////////////// @@ -270,10 +259,6 @@ func (m *_CallMethodRequest) GetMethodId() NodeId { return m.MethodId } -func (m *_CallMethodRequest) GetNoOfInputArguments() int32 { - return m.NoOfInputArguments -} - func (m *_CallMethodRequest) GetInputArguments() []Variant { return m.InputArguments } @@ -307,7 +292,7 @@ func (m *_CallMethodRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (methodId) lengthInBits += m.MethodId.GetLengthInBits(ctx) - // Simple field (noOfInputArguments) + // Implicit Field (noOfInputArguments) lengthInBits += 32 // Array field @@ -327,7 +312,7 @@ func (m *_CallMethodRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CallMethodRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__callMethodRequest CallMethodRequest, err error) { +func (m *_CallMethodRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__callMethodRequest CallMethodRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -350,11 +335,11 @@ func (m *_CallMethodRequest) parse(ctx context.Context, readBuffer utils.ReadBuf } m.MethodId = methodId - noOfInputArguments, err := ReadSimpleField(ctx, "noOfInputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfInputArguments, err := ReadImplicitField[int32](ctx, "noOfInputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfInputArguments' field")) } - m.NoOfInputArguments = noOfInputArguments + _ = noOfInputArguments inputArguments, err := ReadCountArrayField[Variant](ctx, "inputArguments", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfInputArguments)) if err != nil { @@ -394,8 +379,8 @@ func (m *_CallMethodRequest) SerializeWithWriteBuffer(ctx context.Context, write if err := WriteSimpleField[NodeId](ctx, "methodId", m.GetMethodId(), WriteComplex[NodeId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'methodId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfInputArguments", m.GetNoOfInputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfInputArguments := int32(utils.InlineIf(bool((m.GetInputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetInputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfInputArguments", noOfInputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfInputArguments' field") } @@ -425,7 +410,6 @@ func (m *_CallMethodRequest) deepCopy() *_CallMethodRequest { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.ObjectId.DeepCopy().(NodeId), m.MethodId.DeepCopy().(NodeId), - m.NoOfInputArguments, utils.DeepCopySlice[Variant, Variant](m.InputArguments), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CallMethodResult.go b/plc4go/protocols/opcua/readwrite/model/CallMethodResult.go index 4285e449428..d650ab4c9bb 100644 --- a/plc4go/protocols/opcua/readwrite/model/CallMethodResult.go +++ b/plc4go/protocols/opcua/readwrite/model/CallMethodResult.go @@ -42,16 +42,10 @@ type CallMethodResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfInputArgumentResults returns NoOfInputArgumentResults (property field) - GetNoOfInputArgumentResults() int32 // GetInputArgumentResults returns InputArgumentResults (property field) GetInputArgumentResults() []StatusCode - // GetNoOfInputArgumentDiagnosticInfos returns NoOfInputArgumentDiagnosticInfos (property field) - GetNoOfInputArgumentDiagnosticInfos() int32 // GetInputArgumentDiagnosticInfos returns InputArgumentDiagnosticInfos (property field) GetInputArgumentDiagnosticInfos() []DiagnosticInfo - // GetNoOfOutputArguments returns NoOfOutputArguments (property field) - GetNoOfOutputArguments() int32 // GetOutputArguments returns OutputArguments (property field) GetOutputArguments() []Variant // IsCallMethodResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -63,31 +57,25 @@ type CallMethodResult interface { // _CallMethodResult is the data-structure of this message type _CallMethodResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfInputArgumentResults int32 - InputArgumentResults []StatusCode - NoOfInputArgumentDiagnosticInfos int32 - InputArgumentDiagnosticInfos []DiagnosticInfo - NoOfOutputArguments int32 - OutputArguments []Variant + StatusCode StatusCode + InputArgumentResults []StatusCode + InputArgumentDiagnosticInfos []DiagnosticInfo + OutputArguments []Variant } var _ CallMethodResult = (*_CallMethodResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CallMethodResult)(nil) // NewCallMethodResult factory function for _CallMethodResult -func NewCallMethodResult(statusCode StatusCode, noOfInputArgumentResults int32, inputArgumentResults []StatusCode, noOfInputArgumentDiagnosticInfos int32, inputArgumentDiagnosticInfos []DiagnosticInfo, noOfOutputArguments int32, outputArguments []Variant) *_CallMethodResult { +func NewCallMethodResult(statusCode StatusCode, inputArgumentResults []StatusCode, inputArgumentDiagnosticInfos []DiagnosticInfo, outputArguments []Variant) *_CallMethodResult { if statusCode == nil { panic("statusCode of type StatusCode for CallMethodResult must not be nil") } _result := &_CallMethodResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfInputArgumentResults: noOfInputArgumentResults, InputArgumentResults: inputArgumentResults, - NoOfInputArgumentDiagnosticInfos: noOfInputArgumentDiagnosticInfos, InputArgumentDiagnosticInfos: inputArgumentDiagnosticInfos, - NoOfOutputArguments: noOfOutputArguments, OutputArguments: outputArguments, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -103,21 +91,15 @@ func NewCallMethodResult(statusCode StatusCode, noOfInputArgumentResults int32, type CallMethodResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfInputArgumentResults int32, inputArgumentResults []StatusCode, noOfInputArgumentDiagnosticInfos int32, inputArgumentDiagnosticInfos []DiagnosticInfo, noOfOutputArguments int32, outputArguments []Variant) CallMethodResultBuilder + WithMandatoryFields(statusCode StatusCode, inputArgumentResults []StatusCode, inputArgumentDiagnosticInfos []DiagnosticInfo, outputArguments []Variant) CallMethodResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) CallMethodResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) CallMethodResultBuilder - // WithNoOfInputArgumentResults adds NoOfInputArgumentResults (property field) - WithNoOfInputArgumentResults(int32) CallMethodResultBuilder // WithInputArgumentResults adds InputArgumentResults (property field) WithInputArgumentResults(...StatusCode) CallMethodResultBuilder - // WithNoOfInputArgumentDiagnosticInfos adds NoOfInputArgumentDiagnosticInfos (property field) - WithNoOfInputArgumentDiagnosticInfos(int32) CallMethodResultBuilder // WithInputArgumentDiagnosticInfos adds InputArgumentDiagnosticInfos (property field) WithInputArgumentDiagnosticInfos(...DiagnosticInfo) CallMethodResultBuilder - // WithNoOfOutputArguments adds NoOfOutputArguments (property field) - WithNoOfOutputArguments(int32) CallMethodResultBuilder // WithOutputArguments adds OutputArguments (property field) WithOutputArguments(...Variant) CallMethodResultBuilder // Build builds the CallMethodResult or returns an error if something is wrong @@ -145,8 +127,8 @@ func (b *_CallMethodResultBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_CallMethodResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfInputArgumentResults int32, inputArgumentResults []StatusCode, noOfInputArgumentDiagnosticInfos int32, inputArgumentDiagnosticInfos []DiagnosticInfo, noOfOutputArguments int32, outputArguments []Variant) CallMethodResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfInputArgumentResults(noOfInputArgumentResults).WithInputArgumentResults(inputArgumentResults...).WithNoOfInputArgumentDiagnosticInfos(noOfInputArgumentDiagnosticInfos).WithInputArgumentDiagnosticInfos(inputArgumentDiagnosticInfos...).WithNoOfOutputArguments(noOfOutputArguments).WithOutputArguments(outputArguments...) +func (b *_CallMethodResultBuilder) WithMandatoryFields(statusCode StatusCode, inputArgumentResults []StatusCode, inputArgumentDiagnosticInfos []DiagnosticInfo, outputArguments []Variant) CallMethodResultBuilder { + return b.WithStatusCode(statusCode).WithInputArgumentResults(inputArgumentResults...).WithInputArgumentDiagnosticInfos(inputArgumentDiagnosticInfos...).WithOutputArguments(outputArguments...) } func (b *_CallMethodResultBuilder) WithStatusCode(statusCode StatusCode) CallMethodResultBuilder { @@ -167,31 +149,16 @@ func (b *_CallMethodResultBuilder) WithStatusCodeBuilder(builderSupplier func(St return b } -func (b *_CallMethodResultBuilder) WithNoOfInputArgumentResults(noOfInputArgumentResults int32) CallMethodResultBuilder { - b.NoOfInputArgumentResults = noOfInputArgumentResults - return b -} - func (b *_CallMethodResultBuilder) WithInputArgumentResults(inputArgumentResults ...StatusCode) CallMethodResultBuilder { b.InputArgumentResults = inputArgumentResults return b } -func (b *_CallMethodResultBuilder) WithNoOfInputArgumentDiagnosticInfos(noOfInputArgumentDiagnosticInfos int32) CallMethodResultBuilder { - b.NoOfInputArgumentDiagnosticInfos = noOfInputArgumentDiagnosticInfos - return b -} - func (b *_CallMethodResultBuilder) WithInputArgumentDiagnosticInfos(inputArgumentDiagnosticInfos ...DiagnosticInfo) CallMethodResultBuilder { b.InputArgumentDiagnosticInfos = inputArgumentDiagnosticInfos return b } -func (b *_CallMethodResultBuilder) WithNoOfOutputArguments(noOfOutputArguments int32) CallMethodResultBuilder { - b.NoOfOutputArguments = noOfOutputArguments - return b -} - func (b *_CallMethodResultBuilder) WithOutputArguments(outputArguments ...Variant) CallMethodResultBuilder { b.OutputArguments = outputArguments return b @@ -253,8 +220,8 @@ func (b *_CallMethodResult) CreateCallMethodResultBuilder() CallMethodResultBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CallMethodResult) GetIdentifier() string { - return "709" +func (m *_CallMethodResult) GetExtensionId() int32 { + return int32(709) } /////////////////////// @@ -275,26 +242,14 @@ func (m *_CallMethodResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_CallMethodResult) GetNoOfInputArgumentResults() int32 { - return m.NoOfInputArgumentResults -} - func (m *_CallMethodResult) GetInputArgumentResults() []StatusCode { return m.InputArgumentResults } -func (m *_CallMethodResult) GetNoOfInputArgumentDiagnosticInfos() int32 { - return m.NoOfInputArgumentDiagnosticInfos -} - func (m *_CallMethodResult) GetInputArgumentDiagnosticInfos() []DiagnosticInfo { return m.InputArgumentDiagnosticInfos } -func (m *_CallMethodResult) GetNoOfOutputArguments() int32 { - return m.NoOfOutputArguments -} - func (m *_CallMethodResult) GetOutputArguments() []Variant { return m.OutputArguments } @@ -325,7 +280,7 @@ func (m *_CallMethodResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfInputArgumentResults) + // Implicit Field (noOfInputArgumentResults) lengthInBits += 32 // Array field @@ -338,7 +293,7 @@ func (m *_CallMethodResult) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfInputArgumentDiagnosticInfos) + // Implicit Field (noOfInputArgumentDiagnosticInfos) lengthInBits += 32 // Array field @@ -351,7 +306,7 @@ func (m *_CallMethodResult) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfOutputArguments) + // Implicit Field (noOfOutputArguments) lengthInBits += 32 // Array field @@ -371,7 +326,7 @@ func (m *_CallMethodResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CallMethodResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__callMethodResult CallMethodResult, err error) { +func (m *_CallMethodResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__callMethodResult CallMethodResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -388,11 +343,11 @@ func (m *_CallMethodResult) parse(ctx context.Context, readBuffer utils.ReadBuff } m.StatusCode = statusCode - noOfInputArgumentResults, err := ReadSimpleField(ctx, "noOfInputArgumentResults", ReadSignedInt(readBuffer, uint8(32))) + noOfInputArgumentResults, err := ReadImplicitField[int32](ctx, "noOfInputArgumentResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfInputArgumentResults' field")) } - m.NoOfInputArgumentResults = noOfInputArgumentResults + _ = noOfInputArgumentResults inputArgumentResults, err := ReadCountArrayField[StatusCode](ctx, "inputArgumentResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfInputArgumentResults)) if err != nil { @@ -400,11 +355,11 @@ func (m *_CallMethodResult) parse(ctx context.Context, readBuffer utils.ReadBuff } m.InputArgumentResults = inputArgumentResults - noOfInputArgumentDiagnosticInfos, err := ReadSimpleField(ctx, "noOfInputArgumentDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfInputArgumentDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfInputArgumentDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfInputArgumentDiagnosticInfos' field")) } - m.NoOfInputArgumentDiagnosticInfos = noOfInputArgumentDiagnosticInfos + _ = noOfInputArgumentDiagnosticInfos inputArgumentDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "inputArgumentDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfInputArgumentDiagnosticInfos)) if err != nil { @@ -412,11 +367,11 @@ func (m *_CallMethodResult) parse(ctx context.Context, readBuffer utils.ReadBuff } m.InputArgumentDiagnosticInfos = inputArgumentDiagnosticInfos - noOfOutputArguments, err := ReadSimpleField(ctx, "noOfOutputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfOutputArguments, err := ReadImplicitField[int32](ctx, "noOfOutputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfOutputArguments' field")) } - m.NoOfOutputArguments = noOfOutputArguments + _ = noOfOutputArguments outputArguments, err := ReadCountArrayField[Variant](ctx, "outputArguments", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfOutputArguments)) if err != nil { @@ -452,24 +407,24 @@ func (m *_CallMethodResult) SerializeWithWriteBuffer(ctx context.Context, writeB if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfInputArgumentResults", m.GetNoOfInputArgumentResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfInputArgumentResults := int32(utils.InlineIf(bool((m.GetInputArgumentResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetInputArgumentResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfInputArgumentResults", noOfInputArgumentResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfInputArgumentResults' field") } if err := WriteComplexTypeArrayField(ctx, "inputArgumentResults", m.GetInputArgumentResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'inputArgumentResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfInputArgumentDiagnosticInfos", m.GetNoOfInputArgumentDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfInputArgumentDiagnosticInfos := int32(utils.InlineIf(bool((m.GetInputArgumentDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetInputArgumentDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfInputArgumentDiagnosticInfos", noOfInputArgumentDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfInputArgumentDiagnosticInfos' field") } if err := WriteComplexTypeArrayField(ctx, "inputArgumentDiagnosticInfos", m.GetInputArgumentDiagnosticInfos(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'inputArgumentDiagnosticInfos' field") } - - if err := WriteSimpleField[int32](ctx, "noOfOutputArguments", m.GetNoOfOutputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfOutputArguments := int32(utils.InlineIf(bool((m.GetOutputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetOutputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfOutputArguments", noOfOutputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfOutputArguments' field") } @@ -498,11 +453,8 @@ func (m *_CallMethodResult) deepCopy() *_CallMethodResult { _CallMethodResultCopy := &_CallMethodResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfInputArgumentResults, utils.DeepCopySlice[StatusCode, StatusCode](m.InputArgumentResults), - m.NoOfInputArgumentDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.InputArgumentDiagnosticInfos), - m.NoOfOutputArguments, utils.DeepCopySlice[Variant, Variant](m.OutputArguments), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CallRequest.go b/plc4go/protocols/opcua/readwrite/model/CallRequest.go index 5e0dff45403..96867ded639 100644 --- a/plc4go/protocols/opcua/readwrite/model/CallRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CallRequest.go @@ -41,11 +41,9 @@ type CallRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfMethodsToCall returns NoOfMethodsToCall (property field) - GetNoOfMethodsToCall() int32 + GetRequestHeader() RequestHeader // GetMethodsToCall returns MethodsToCall (property field) - GetMethodsToCall() []ExtensionObjectDefinition + GetMethodsToCall() []CallMethodRequest // IsCallRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsCallRequest() // CreateBuilder creates a CallRequestBuilder @@ -55,23 +53,21 @@ type CallRequest interface { // _CallRequest is the data-structure of this message type _CallRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfMethodsToCall int32 - MethodsToCall []ExtensionObjectDefinition + RequestHeader RequestHeader + MethodsToCall []CallMethodRequest } var _ CallRequest = (*_CallRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CallRequest)(nil) // NewCallRequest factory function for _CallRequest -func NewCallRequest(requestHeader ExtensionObjectDefinition, noOfMethodsToCall int32, methodsToCall []ExtensionObjectDefinition) *_CallRequest { +func NewCallRequest(requestHeader RequestHeader, methodsToCall []CallMethodRequest) *_CallRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CallRequest must not be nil") + panic("requestHeader of type RequestHeader for CallRequest must not be nil") } _result := &_CallRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfMethodsToCall: noOfMethodsToCall, MethodsToCall: methodsToCall, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewCallRequest(requestHeader ExtensionObjectDefinition, noOfMethodsToCall i type CallRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfMethodsToCall int32, methodsToCall []ExtensionObjectDefinition) CallRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, methodsToCall []CallMethodRequest) CallRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CallRequestBuilder + WithRequestHeader(RequestHeader) CallRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CallRequestBuilder - // WithNoOfMethodsToCall adds NoOfMethodsToCall (property field) - WithNoOfMethodsToCall(int32) CallRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CallRequestBuilder // WithMethodsToCall adds MethodsToCall (property field) - WithMethodsToCall(...ExtensionObjectDefinition) CallRequestBuilder + WithMethodsToCall(...CallMethodRequest) CallRequestBuilder // Build builds the CallRequest or returns an error if something is wrong Build() (CallRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_CallRequestBuilder) setParent(contract ExtensionObjectDefinitionContra b.ExtensionObjectDefinitionContract = contract } -func (b *_CallRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfMethodsToCall int32, methodsToCall []ExtensionObjectDefinition) CallRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfMethodsToCall(noOfMethodsToCall).WithMethodsToCall(methodsToCall...) +func (b *_CallRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, methodsToCall []CallMethodRequest) CallRequestBuilder { + return b.WithRequestHeader(requestHeader).WithMethodsToCall(methodsToCall...) } -func (b *_CallRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CallRequestBuilder { +func (b *_CallRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CallRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CallRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CallRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CallRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CallRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_CallRequestBuilder) WithNoOfMethodsToCall(noOfMethodsToCall int32) CallRequestBuilder { - b.NoOfMethodsToCall = noOfMethodsToCall - return b -} - -func (b *_CallRequestBuilder) WithMethodsToCall(methodsToCall ...ExtensionObjectDefinition) CallRequestBuilder { +func (b *_CallRequestBuilder) WithMethodsToCall(methodsToCall ...CallMethodRequest) CallRequestBuilder { b.MethodsToCall = methodsToCall return b } @@ -209,8 +198,8 @@ func (b *_CallRequest) CreateCallRequestBuilder() CallRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CallRequest) GetIdentifier() string { - return "712" +func (m *_CallRequest) GetExtensionId() int32 { + return int32(712) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_CallRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CallRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CallRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_CallRequest) GetNoOfMethodsToCall() int32 { - return m.NoOfMethodsToCall -} - -func (m *_CallRequest) GetMethodsToCall() []ExtensionObjectDefinition { +func (m *_CallRequest) GetMethodsToCall() []CallMethodRequest { return m.MethodsToCall } @@ -265,7 +250,7 @@ func (m *_CallRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfMethodsToCall) + // Implicit Field (noOfMethodsToCall) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_CallRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CallRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__callRequest CallRequest, err error) { +func (m *_CallRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__callRequest CallRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_CallRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, p currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfMethodsToCall, err := ReadSimpleField(ctx, "noOfMethodsToCall", ReadSignedInt(readBuffer, uint8(32))) + noOfMethodsToCall, err := ReadImplicitField[int32](ctx, "noOfMethodsToCall", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfMethodsToCall' field")) } - m.NoOfMethodsToCall = noOfMethodsToCall + _ = noOfMethodsToCall - methodsToCall, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "methodsToCall", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("706")), readBuffer), uint64(noOfMethodsToCall)) + methodsToCall, err := ReadCountArrayField[CallMethodRequest](ctx, "methodsToCall", ReadComplex[CallMethodRequest](ExtensionObjectDefinitionParseWithBufferProducer[CallMethodRequest]((int32)(int32(706))), readBuffer), uint64(noOfMethodsToCall)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'methodsToCall' field")) } @@ -339,11 +324,11 @@ func (m *_CallRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuffer return errors.Wrap(pushErr, "Error pushing for CallRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfMethodsToCall", m.GetNoOfMethodsToCall(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfMethodsToCall := int32(utils.InlineIf(bool((m.GetMethodsToCall()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetMethodsToCall()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfMethodsToCall", noOfMethodsToCall, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfMethodsToCall' field") } @@ -371,9 +356,8 @@ func (m *_CallRequest) deepCopy() *_CallRequest { } _CallRequestCopy := &_CallRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfMethodsToCall, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.MethodsToCall), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[CallMethodRequest, CallMethodRequest](m.MethodsToCall), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _CallRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/CallResponse.go b/plc4go/protocols/opcua/readwrite/model/CallResponse.go index 30b3c6ffaac..2ecb9ea3b73 100644 --- a/plc4go/protocols/opcua/readwrite/model/CallResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CallResponse.go @@ -41,13 +41,9 @@ type CallResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []CallMethodResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsCallResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type CallResponse interface { // _CallResponse is the data-structure of this message type _CallResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []CallMethodResult + DiagnosticInfos []DiagnosticInfo } var _ CallResponse = (*_CallResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CallResponse)(nil) // NewCallResponse factory function for _CallResponse -func NewCallResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_CallResponse { +func NewCallResponse(responseHeader ResponseHeader, results []CallMethodResult, diagnosticInfos []DiagnosticInfo) *_CallResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CallResponse must not be nil") + panic("responseHeader of type ResponseHeader for CallResponse must not be nil") } _result := &_CallResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewCallResponse(responseHeader ExtensionObjectDefinition, noOfResults int32 type CallResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) CallResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []CallMethodResult, diagnosticInfos []DiagnosticInfo) CallResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CallResponseBuilder + WithResponseHeader(ResponseHeader) CallResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CallResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) CallResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CallResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) CallResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) CallResponseBuilder + WithResults(...CallMethodResult) CallResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) CallResponseBuilder // Build builds the CallResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_CallResponseBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_CallResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) CallResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_CallResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []CallMethodResult, diagnosticInfos []DiagnosticInfo) CallResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_CallResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CallResponseBuilder { +func (b *_CallResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CallResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CallResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CallResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CallResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CallResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_CallResponseBuilder) WithNoOfResults(noOfResults int32) CallResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_CallResponseBuilder) WithResults(results ...ExtensionObjectDefinition) CallResponseBuilder { +func (b *_CallResponseBuilder) WithResults(results ...CallMethodResult) CallResponseBuilder { b.Results = results return b } -func (b *_CallResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) CallResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_CallResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) CallResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_CallResponse) CreateCallResponseBuilder() CallResponseBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CallResponse) GetIdentifier() string { - return "715" +func (m *_CallResponse) GetExtensionId() int32 { + return int32(715) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_CallResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CallResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CallResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_CallResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_CallResponse) GetResults() []ExtensionObjectDefinition { +func (m *_CallResponse) GetResults() []CallMethodResult { return m.Results } -func (m *_CallResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_CallResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_CallResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_CallResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_CallResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CallResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__callResponse CallResponse, err error) { +func (m *_CallResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__callResponse CallResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_CallResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("709")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[CallMethodResult](ctx, "results", ReadComplex[CallMethodResult](ExtensionObjectDefinitionParseWithBufferProducer[CallMethodResult]((int32)(int32(709))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_CallResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuffe return errors.Wrap(pushErr, "Error pushing for CallResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_CallResponse) deepCopy() *_CallResponse { } _CallResponseCopy := &_CallResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[CallMethodResult, CallMethodResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CancelRequest.go b/plc4go/protocols/opcua/readwrite/model/CancelRequest.go index 6c715405598..20b5cbc81c7 100644 --- a/plc4go/protocols/opcua/readwrite/model/CancelRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CancelRequest.go @@ -41,7 +41,7 @@ type CancelRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetRequestHandle returns RequestHandle (property field) GetRequestHandle() uint32 // IsCancelRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,7 +53,7 @@ type CancelRequest interface { // _CancelRequest is the data-structure of this message type _CancelRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader RequestHandle uint32 } @@ -61,9 +61,9 @@ var _ CancelRequest = (*_CancelRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CancelRequest)(nil) // NewCancelRequest factory function for _CancelRequest -func NewCancelRequest(requestHeader ExtensionObjectDefinition, requestHandle uint32) *_CancelRequest { +func NewCancelRequest(requestHeader RequestHeader, requestHandle uint32) *_CancelRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CancelRequest must not be nil") + panic("requestHeader of type RequestHeader for CancelRequest must not be nil") } _result := &_CancelRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -83,11 +83,11 @@ func NewCancelRequest(requestHeader ExtensionObjectDefinition, requestHandle uin type CancelRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, requestHandle uint32) CancelRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, requestHandle uint32) CancelRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CancelRequestBuilder + WithRequestHeader(RequestHeader) CancelRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CancelRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CancelRequestBuilder // WithRequestHandle adds RequestHandle (property field) WithRequestHandle(uint32) CancelRequestBuilder // Build builds the CancelRequest or returns an error if something is wrong @@ -115,24 +115,24 @@ func (b *_CancelRequestBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_CancelRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, requestHandle uint32) CancelRequestBuilder { +func (b *_CancelRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, requestHandle uint32) CancelRequestBuilder { return b.WithRequestHeader(requestHeader).WithRequestHandle(requestHandle) } -func (b *_CancelRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CancelRequestBuilder { +func (b *_CancelRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CancelRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CancelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CancelRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CancelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CancelRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -198,8 +198,8 @@ func (b *_CancelRequest) CreateCancelRequestBuilder() CancelRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CancelRequest) GetIdentifier() string { - return "479" +func (m *_CancelRequest) GetExtensionId() int32 { + return int32(479) } /////////////////////// @@ -216,7 +216,7 @@ func (m *_CancelRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CancelRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CancelRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -260,7 +260,7 @@ func (m *_CancelRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CancelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__cancelRequest CancelRequest, err error) { +func (m *_CancelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__cancelRequest CancelRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -271,7 +271,7 @@ func (m *_CancelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -308,7 +308,7 @@ func (m *_CancelRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuff return errors.Wrap(pushErr, "Error pushing for CancelRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -336,7 +336,7 @@ func (m *_CancelRequest) deepCopy() *_CancelRequest { } _CancelRequestCopy := &_CancelRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.RequestHandle, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CancelResponse.go b/plc4go/protocols/opcua/readwrite/model/CancelResponse.go index 89183d39756..f7838cc460d 100644 --- a/plc4go/protocols/opcua/readwrite/model/CancelResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CancelResponse.go @@ -41,7 +41,7 @@ type CancelResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetCancelCount returns CancelCount (property field) GetCancelCount() uint32 // IsCancelResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,7 +53,7 @@ type CancelResponse interface { // _CancelResponse is the data-structure of this message type _CancelResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader CancelCount uint32 } @@ -61,9 +61,9 @@ var _ CancelResponse = (*_CancelResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CancelResponse)(nil) // NewCancelResponse factory function for _CancelResponse -func NewCancelResponse(responseHeader ExtensionObjectDefinition, cancelCount uint32) *_CancelResponse { +func NewCancelResponse(responseHeader ResponseHeader, cancelCount uint32) *_CancelResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CancelResponse must not be nil") + panic("responseHeader of type ResponseHeader for CancelResponse must not be nil") } _result := &_CancelResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -83,11 +83,11 @@ func NewCancelResponse(responseHeader ExtensionObjectDefinition, cancelCount uin type CancelResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, cancelCount uint32) CancelResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, cancelCount uint32) CancelResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CancelResponseBuilder + WithResponseHeader(ResponseHeader) CancelResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CancelResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CancelResponseBuilder // WithCancelCount adds CancelCount (property field) WithCancelCount(uint32) CancelResponseBuilder // Build builds the CancelResponse or returns an error if something is wrong @@ -115,24 +115,24 @@ func (b *_CancelResponseBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_CancelResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, cancelCount uint32) CancelResponseBuilder { +func (b *_CancelResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, cancelCount uint32) CancelResponseBuilder { return b.WithResponseHeader(responseHeader).WithCancelCount(cancelCount) } -func (b *_CancelResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CancelResponseBuilder { +func (b *_CancelResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CancelResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CancelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CancelResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CancelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CancelResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -198,8 +198,8 @@ func (b *_CancelResponse) CreateCancelResponseBuilder() CancelResponseBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CancelResponse) GetIdentifier() string { - return "482" +func (m *_CancelResponse) GetExtensionId() int32 { + return int32(482) } /////////////////////// @@ -216,7 +216,7 @@ func (m *_CancelResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CancelResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CancelResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -260,7 +260,7 @@ func (m *_CancelResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CancelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__cancelResponse CancelResponse, err error) { +func (m *_CancelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__cancelResponse CancelResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -271,7 +271,7 @@ func (m *_CancelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -308,7 +308,7 @@ func (m *_CancelResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuf return errors.Wrap(pushErr, "Error pushing for CancelResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -336,7 +336,7 @@ func (m *_CancelResponse) deepCopy() *_CancelResponse { } _CancelResponseCopy := &_CancelResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.CancelCount, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CartesianCoordinates.go b/plc4go/protocols/opcua/readwrite/model/CartesianCoordinates.go index 74e1a1f4a8c..62c10ea8591 100644 --- a/plc4go/protocols/opcua/readwrite/model/CartesianCoordinates.go +++ b/plc4go/protocols/opcua/readwrite/model/CartesianCoordinates.go @@ -150,8 +150,8 @@ func (b *_CartesianCoordinates) CreateCartesianCoordinatesBuilder() CartesianCoo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CartesianCoordinates) GetIdentifier() string { - return "18811" +func (m *_CartesianCoordinates) GetExtensionId() int32 { + return int32(18811) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_CartesianCoordinates) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CartesianCoordinates) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__cartesianCoordinates CartesianCoordinates, err error) { +func (m *_CartesianCoordinates) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__cartesianCoordinates CartesianCoordinates, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ChannelSecurityToken.go b/plc4go/protocols/opcua/readwrite/model/ChannelSecurityToken.go index dc81995f86c..514a8a905b6 100644 --- a/plc4go/protocols/opcua/readwrite/model/ChannelSecurityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/ChannelSecurityToken.go @@ -196,8 +196,8 @@ func (b *_ChannelSecurityToken) CreateChannelSecurityTokenBuilder() ChannelSecur /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ChannelSecurityToken) GetIdentifier() string { - return "443" +func (m *_ChannelSecurityToken) GetExtensionId() int32 { + return int32(443) } /////////////////////// @@ -272,7 +272,7 @@ func (m *_ChannelSecurityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ChannelSecurityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__channelSecurityToken ChannelSecurityToken, err error) { +func (m *_ChannelSecurityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__channelSecurityToken ChannelSecurityToken, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelRequest.go b/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelRequest.go index 5441c66703a..b72efe2bebd 100644 --- a/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelRequest.go @@ -41,7 +41,7 @@ type CloseSecureChannelRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // IsCloseSecureChannelRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsCloseSecureChannelRequest() // CreateBuilder creates a CloseSecureChannelRequestBuilder @@ -51,16 +51,16 @@ type CloseSecureChannelRequest interface { // _CloseSecureChannelRequest is the data-structure of this message type _CloseSecureChannelRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader } var _ CloseSecureChannelRequest = (*_CloseSecureChannelRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CloseSecureChannelRequest)(nil) // NewCloseSecureChannelRequest factory function for _CloseSecureChannelRequest -func NewCloseSecureChannelRequest(requestHeader ExtensionObjectDefinition) *_CloseSecureChannelRequest { +func NewCloseSecureChannelRequest(requestHeader RequestHeader) *_CloseSecureChannelRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CloseSecureChannelRequest must not be nil") + panic("requestHeader of type RequestHeader for CloseSecureChannelRequest must not be nil") } _result := &_CloseSecureChannelRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewCloseSecureChannelRequest(requestHeader ExtensionObjectDefinition) *_Clo type CloseSecureChannelRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition) CloseSecureChannelRequestBuilder + WithMandatoryFields(requestHeader RequestHeader) CloseSecureChannelRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CloseSecureChannelRequestBuilder + WithRequestHeader(RequestHeader) CloseSecureChannelRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSecureChannelRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CloseSecureChannelRequestBuilder // Build builds the CloseSecureChannelRequest or returns an error if something is wrong Build() (CloseSecureChannelRequest, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_CloseSecureChannelRequestBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_CloseSecureChannelRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition) CloseSecureChannelRequestBuilder { +func (b *_CloseSecureChannelRequestBuilder) WithMandatoryFields(requestHeader RequestHeader) CloseSecureChannelRequestBuilder { return b.WithRequestHeader(requestHeader) } -func (b *_CloseSecureChannelRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CloseSecureChannelRequestBuilder { +func (b *_CloseSecureChannelRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CloseSecureChannelRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CloseSecureChannelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSecureChannelRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CloseSecureChannelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CloseSecureChannelRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_CloseSecureChannelRequest) CreateCloseSecureChannelRequestBuilder() Cl /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CloseSecureChannelRequest) GetIdentifier() string { - return "452" +func (m *_CloseSecureChannelRequest) GetExtensionId() int32 { + return int32(452) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_CloseSecureChannelRequest) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CloseSecureChannelRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CloseSecureChannelRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -242,7 +242,7 @@ func (m *_CloseSecureChannelRequest) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_CloseSecureChannelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__closeSecureChannelRequest CloseSecureChannelRequest, err error) { +func (m *_CloseSecureChannelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__closeSecureChannelRequest CloseSecureChannelRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_CloseSecureChannelRequest) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -284,7 +284,7 @@ func (m *_CloseSecureChannelRequest) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for CloseSecureChannelRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -308,7 +308,7 @@ func (m *_CloseSecureChannelRequest) deepCopy() *_CloseSecureChannelRequest { } _CloseSecureChannelRequestCopy := &_CloseSecureChannelRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _CloseSecureChannelRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelResponse.go b/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelResponse.go index 7a462d392aa..e27e22ee38d 100644 --- a/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CloseSecureChannelResponse.go @@ -41,7 +41,7 @@ type CloseSecureChannelResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // IsCloseSecureChannelResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsCloseSecureChannelResponse() // CreateBuilder creates a CloseSecureChannelResponseBuilder @@ -51,16 +51,16 @@ type CloseSecureChannelResponse interface { // _CloseSecureChannelResponse is the data-structure of this message type _CloseSecureChannelResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader } var _ CloseSecureChannelResponse = (*_CloseSecureChannelResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CloseSecureChannelResponse)(nil) // NewCloseSecureChannelResponse factory function for _CloseSecureChannelResponse -func NewCloseSecureChannelResponse(responseHeader ExtensionObjectDefinition) *_CloseSecureChannelResponse { +func NewCloseSecureChannelResponse(responseHeader ResponseHeader) *_CloseSecureChannelResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CloseSecureChannelResponse must not be nil") + panic("responseHeader of type ResponseHeader for CloseSecureChannelResponse must not be nil") } _result := &_CloseSecureChannelResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewCloseSecureChannelResponse(responseHeader ExtensionObjectDefinition) *_C type CloseSecureChannelResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition) CloseSecureChannelResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader) CloseSecureChannelResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CloseSecureChannelResponseBuilder + WithResponseHeader(ResponseHeader) CloseSecureChannelResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSecureChannelResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CloseSecureChannelResponseBuilder // Build builds the CloseSecureChannelResponse or returns an error if something is wrong Build() (CloseSecureChannelResponse, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_CloseSecureChannelResponseBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_CloseSecureChannelResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition) CloseSecureChannelResponseBuilder { +func (b *_CloseSecureChannelResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader) CloseSecureChannelResponseBuilder { return b.WithResponseHeader(responseHeader) } -func (b *_CloseSecureChannelResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CloseSecureChannelResponseBuilder { +func (b *_CloseSecureChannelResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CloseSecureChannelResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CloseSecureChannelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSecureChannelResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CloseSecureChannelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CloseSecureChannelResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_CloseSecureChannelResponse) CreateCloseSecureChannelResponseBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CloseSecureChannelResponse) GetIdentifier() string { - return "455" +func (m *_CloseSecureChannelResponse) GetExtensionId() int32 { + return int32(455) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_CloseSecureChannelResponse) GetParent() ExtensionObjectDefinitionContr /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CloseSecureChannelResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CloseSecureChannelResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -242,7 +242,7 @@ func (m *_CloseSecureChannelResponse) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_CloseSecureChannelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__closeSecureChannelResponse CloseSecureChannelResponse, err error) { +func (m *_CloseSecureChannelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__closeSecureChannelResponse CloseSecureChannelResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_CloseSecureChannelResponse) parse(ctx context.Context, readBuffer util currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -284,7 +284,7 @@ func (m *_CloseSecureChannelResponse) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(pushErr, "Error pushing for CloseSecureChannelResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -308,7 +308,7 @@ func (m *_CloseSecureChannelResponse) deepCopy() *_CloseSecureChannelResponse { } _CloseSecureChannelResponseCopy := &_CloseSecureChannelResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _CloseSecureChannelResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/CloseSessionRequest.go b/plc4go/protocols/opcua/readwrite/model/CloseSessionRequest.go index e6220c9c6a6..9511c646813 100644 --- a/plc4go/protocols/opcua/readwrite/model/CloseSessionRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CloseSessionRequest.go @@ -41,7 +41,7 @@ type CloseSessionRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetDeleteSubscriptions returns DeleteSubscriptions (property field) GetDeleteSubscriptions() bool // IsCloseSessionRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,7 +53,7 @@ type CloseSessionRequest interface { // _CloseSessionRequest is the data-structure of this message type _CloseSessionRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader DeleteSubscriptions bool // Reserved Fields reservedField0 *uint8 @@ -63,9 +63,9 @@ var _ CloseSessionRequest = (*_CloseSessionRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CloseSessionRequest)(nil) // NewCloseSessionRequest factory function for _CloseSessionRequest -func NewCloseSessionRequest(requestHeader ExtensionObjectDefinition, deleteSubscriptions bool) *_CloseSessionRequest { +func NewCloseSessionRequest(requestHeader RequestHeader, deleteSubscriptions bool) *_CloseSessionRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CloseSessionRequest must not be nil") + panic("requestHeader of type RequestHeader for CloseSessionRequest must not be nil") } _result := &_CloseSessionRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -85,11 +85,11 @@ func NewCloseSessionRequest(requestHeader ExtensionObjectDefinition, deleteSubsc type CloseSessionRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, deleteSubscriptions bool) CloseSessionRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, deleteSubscriptions bool) CloseSessionRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CloseSessionRequestBuilder + WithRequestHeader(RequestHeader) CloseSessionRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSessionRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CloseSessionRequestBuilder // WithDeleteSubscriptions adds DeleteSubscriptions (property field) WithDeleteSubscriptions(bool) CloseSessionRequestBuilder // Build builds the CloseSessionRequest or returns an error if something is wrong @@ -117,24 +117,24 @@ func (b *_CloseSessionRequestBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_CloseSessionRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, deleteSubscriptions bool) CloseSessionRequestBuilder { +func (b *_CloseSessionRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, deleteSubscriptions bool) CloseSessionRequestBuilder { return b.WithRequestHeader(requestHeader).WithDeleteSubscriptions(deleteSubscriptions) } -func (b *_CloseSessionRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CloseSessionRequestBuilder { +func (b *_CloseSessionRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CloseSessionRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CloseSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSessionRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CloseSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CloseSessionRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -200,8 +200,8 @@ func (b *_CloseSessionRequest) CreateCloseSessionRequestBuilder() CloseSessionRe /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CloseSessionRequest) GetIdentifier() string { - return "473" +func (m *_CloseSessionRequest) GetExtensionId() int32 { + return int32(473) } /////////////////////// @@ -218,7 +218,7 @@ func (m *_CloseSessionRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CloseSessionRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CloseSessionRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -265,7 +265,7 @@ func (m *_CloseSessionRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CloseSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__closeSessionRequest CloseSessionRequest, err error) { +func (m *_CloseSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__closeSessionRequest CloseSessionRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -276,7 +276,7 @@ func (m *_CloseSessionRequest) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -319,7 +319,7 @@ func (m *_CloseSessionRequest) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for CloseSessionRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -351,7 +351,7 @@ func (m *_CloseSessionRequest) deepCopy() *_CloseSessionRequest { } _CloseSessionRequestCopy := &_CloseSessionRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.DeleteSubscriptions, m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/CloseSessionResponse.go b/plc4go/protocols/opcua/readwrite/model/CloseSessionResponse.go index 66849b2b061..191a88904fe 100644 --- a/plc4go/protocols/opcua/readwrite/model/CloseSessionResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CloseSessionResponse.go @@ -41,7 +41,7 @@ type CloseSessionResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // IsCloseSessionResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsCloseSessionResponse() // CreateBuilder creates a CloseSessionResponseBuilder @@ -51,16 +51,16 @@ type CloseSessionResponse interface { // _CloseSessionResponse is the data-structure of this message type _CloseSessionResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader } var _ CloseSessionResponse = (*_CloseSessionResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CloseSessionResponse)(nil) // NewCloseSessionResponse factory function for _CloseSessionResponse -func NewCloseSessionResponse(responseHeader ExtensionObjectDefinition) *_CloseSessionResponse { +func NewCloseSessionResponse(responseHeader ResponseHeader) *_CloseSessionResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CloseSessionResponse must not be nil") + panic("responseHeader of type ResponseHeader for CloseSessionResponse must not be nil") } _result := &_CloseSessionResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewCloseSessionResponse(responseHeader ExtensionObjectDefinition) *_CloseSe type CloseSessionResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition) CloseSessionResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader) CloseSessionResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CloseSessionResponseBuilder + WithResponseHeader(ResponseHeader) CloseSessionResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSessionResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CloseSessionResponseBuilder // Build builds the CloseSessionResponse or returns an error if something is wrong Build() (CloseSessionResponse, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_CloseSessionResponseBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_CloseSessionResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition) CloseSessionResponseBuilder { +func (b *_CloseSessionResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader) CloseSessionResponseBuilder { return b.WithResponseHeader(responseHeader) } -func (b *_CloseSessionResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CloseSessionResponseBuilder { +func (b *_CloseSessionResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CloseSessionResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CloseSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CloseSessionResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CloseSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CloseSessionResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_CloseSessionResponse) CreateCloseSessionResponseBuilder() CloseSession /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CloseSessionResponse) GetIdentifier() string { - return "476" +func (m *_CloseSessionResponse) GetExtensionId() int32 { + return int32(476) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_CloseSessionResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CloseSessionResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CloseSessionResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -242,7 +242,7 @@ func (m *_CloseSessionResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CloseSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__closeSessionResponse CloseSessionResponse, err error) { +func (m *_CloseSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__closeSessionResponse CloseSessionResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_CloseSessionResponse) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -284,7 +284,7 @@ func (m *_CloseSessionResponse) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for CloseSessionResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -308,7 +308,7 @@ func (m *_CloseSessionResponse) deepCopy() *_CloseSessionResponse { } _CloseSessionResponseCopy := &_CloseSessionResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _CloseSessionResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ComplexNumberType.go b/plc4go/protocols/opcua/readwrite/model/ComplexNumberType.go index d856ab0e162..bb544b9a86c 100644 --- a/plc4go/protocols/opcua/readwrite/model/ComplexNumberType.go +++ b/plc4go/protocols/opcua/readwrite/model/ComplexNumberType.go @@ -174,8 +174,8 @@ func (b *_ComplexNumberType) CreateComplexNumberTypeBuilder() ComplexNumberTypeB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ComplexNumberType) GetIdentifier() string { - return "12173" +func (m *_ComplexNumberType) GetExtensionId() int32 { + return int32(12173) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_ComplexNumberType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ComplexNumberType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__complexNumberType ComplexNumberType, err error) { +func (m *_ComplexNumberType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__complexNumberType ComplexNumberType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ConfigurationVersionDataType.go b/plc4go/protocols/opcua/readwrite/model/ConfigurationVersionDataType.go index 54340b44d5a..9609ec40d43 100644 --- a/plc4go/protocols/opcua/readwrite/model/ConfigurationVersionDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ConfigurationVersionDataType.go @@ -174,8 +174,8 @@ func (b *_ConfigurationVersionDataType) CreateConfigurationVersionDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ConfigurationVersionDataType) GetIdentifier() string { - return "14595" +func (m *_ConfigurationVersionDataType) GetExtensionId() int32 { + return int32(14595) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_ConfigurationVersionDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_ConfigurationVersionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__configurationVersionDataType ConfigurationVersionDataType, err error) { +func (m *_ConfigurationVersionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__configurationVersionDataType ConfigurationVersionDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ConnectionTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/ConnectionTransportDataType.go index 5bda6a67583..04a62fdf10c 100644 --- a/plc4go/protocols/opcua/readwrite/model/ConnectionTransportDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ConnectionTransportDataType.go @@ -150,8 +150,8 @@ func (b *_ConnectionTransportDataType) CreateConnectionTransportDataTypeBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ConnectionTransportDataType) GetIdentifier() string { - return "15620" +func (m *_ConnectionTransportDataType) GetExtensionId() int32 { + return int32(15620) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_ConnectionTransportDataType) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_ConnectionTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__connectionTransportDataType ConnectionTransportDataType, err error) { +func (m *_ConnectionTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__connectionTransportDataType ConnectionTransportDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ContentFilter.go b/plc4go/protocols/opcua/readwrite/model/ContentFilter.go index 7b86c4e8405..ec203fc235f 100644 --- a/plc4go/protocols/opcua/readwrite/model/ContentFilter.go +++ b/plc4go/protocols/opcua/readwrite/model/ContentFilter.go @@ -40,10 +40,8 @@ type ContentFilter interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfElements returns NoOfElements (property field) - GetNoOfElements() int32 // GetElements returns Elements (property field) - GetElements() []ExtensionObjectDefinition + GetElements() []ContentFilterElement // IsContentFilter is a marker method to prevent unintentional type checks (interfaces of same signature) IsContentFilter() // CreateBuilder creates a ContentFilterBuilder @@ -53,18 +51,16 @@ type ContentFilter interface { // _ContentFilter is the data-structure of this message type _ContentFilter struct { ExtensionObjectDefinitionContract - NoOfElements int32 - Elements []ExtensionObjectDefinition + Elements []ContentFilterElement } var _ ContentFilter = (*_ContentFilter)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ContentFilter)(nil) // NewContentFilter factory function for _ContentFilter -func NewContentFilter(noOfElements int32, elements []ExtensionObjectDefinition) *_ContentFilter { +func NewContentFilter(elements []ContentFilterElement) *_ContentFilter { _result := &_ContentFilter{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfElements: noOfElements, Elements: elements, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,11 +76,9 @@ func NewContentFilter(noOfElements int32, elements []ExtensionObjectDefinition) type ContentFilterBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfElements int32, elements []ExtensionObjectDefinition) ContentFilterBuilder - // WithNoOfElements adds NoOfElements (property field) - WithNoOfElements(int32) ContentFilterBuilder + WithMandatoryFields(elements []ContentFilterElement) ContentFilterBuilder // WithElements adds Elements (property field) - WithElements(...ExtensionObjectDefinition) ContentFilterBuilder + WithElements(...ContentFilterElement) ContentFilterBuilder // Build builds the ContentFilter or returns an error if something is wrong Build() (ContentFilter, error) // MustBuild does the same as Build but panics on error @@ -110,16 +104,11 @@ func (b *_ContentFilterBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_ContentFilterBuilder) WithMandatoryFields(noOfElements int32, elements []ExtensionObjectDefinition) ContentFilterBuilder { - return b.WithNoOfElements(noOfElements).WithElements(elements...) +func (b *_ContentFilterBuilder) WithMandatoryFields(elements []ContentFilterElement) ContentFilterBuilder { + return b.WithElements(elements...) } -func (b *_ContentFilterBuilder) WithNoOfElements(noOfElements int32) ContentFilterBuilder { - b.NoOfElements = noOfElements - return b -} - -func (b *_ContentFilterBuilder) WithElements(elements ...ExtensionObjectDefinition) ContentFilterBuilder { +func (b *_ContentFilterBuilder) WithElements(elements ...ContentFilterElement) ContentFilterBuilder { b.Elements = elements return b } @@ -174,8 +163,8 @@ func (b *_ContentFilter) CreateContentFilterBuilder() ContentFilterBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ContentFilter) GetIdentifier() string { - return "588" +func (m *_ContentFilter) GetExtensionId() int32 { + return int32(588) } /////////////////////// @@ -192,11 +181,7 @@ func (m *_ContentFilter) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ContentFilter) GetNoOfElements() int32 { - return m.NoOfElements -} - -func (m *_ContentFilter) GetElements() []ExtensionObjectDefinition { +func (m *_ContentFilter) GetElements() []ContentFilterElement { return m.Elements } @@ -223,7 +208,7 @@ func (m *_ContentFilter) GetTypeName() string { func (m *_ContentFilter) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfElements) + // Implicit Field (noOfElements) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_ContentFilter) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ContentFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__contentFilter ContentFilter, err error) { +func (m *_ContentFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__contentFilter ContentFilter, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,13 +239,13 @@ func (m *_ContentFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - noOfElements, err := ReadSimpleField(ctx, "noOfElements", ReadSignedInt(readBuffer, uint8(32))) + noOfElements, err := ReadImplicitField[int32](ctx, "noOfElements", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfElements' field")) } - m.NoOfElements = noOfElements + _ = noOfElements - elements, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "elements", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("585")), readBuffer), uint64(noOfElements)) + elements, err := ReadCountArrayField[ContentFilterElement](ctx, "elements", ReadComplex[ContentFilterElement](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilterElement]((int32)(int32(585))), readBuffer), uint64(noOfElements)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'elements' field")) } @@ -290,8 +275,8 @@ func (m *_ContentFilter) SerializeWithWriteBuffer(ctx context.Context, writeBuff if pushErr := writeBuffer.PushContext("ContentFilter"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for ContentFilter") } - - if err := WriteSimpleField[int32](ctx, "noOfElements", m.GetNoOfElements(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfElements := int32(utils.InlineIf(bool((m.GetElements()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetElements()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfElements", noOfElements, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfElements' field") } @@ -319,8 +304,7 @@ func (m *_ContentFilter) deepCopy() *_ContentFilter { } _ContentFilterCopy := &_ContentFilter{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfElements, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Elements), + utils.DeepCopySlice[ContentFilterElement, ContentFilterElement](m.Elements), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ContentFilterCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ContentFilterElement.go b/plc4go/protocols/opcua/readwrite/model/ContentFilterElement.go index b813e7a315d..363ef27c95a 100644 --- a/plc4go/protocols/opcua/readwrite/model/ContentFilterElement.go +++ b/plc4go/protocols/opcua/readwrite/model/ContentFilterElement.go @@ -42,8 +42,6 @@ type ContentFilterElement interface { ExtensionObjectDefinition // GetFilterOperator returns FilterOperator (property field) GetFilterOperator() FilterOperator - // GetNoOfFilterOperands returns NoOfFilterOperands (property field) - GetNoOfFilterOperands() int32 // GetFilterOperands returns FilterOperands (property field) GetFilterOperands() []ExtensionObject // IsContentFilterElement is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,20 +53,18 @@ type ContentFilterElement interface { // _ContentFilterElement is the data-structure of this message type _ContentFilterElement struct { ExtensionObjectDefinitionContract - FilterOperator FilterOperator - NoOfFilterOperands int32 - FilterOperands []ExtensionObject + FilterOperator FilterOperator + FilterOperands []ExtensionObject } var _ ContentFilterElement = (*_ContentFilterElement)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ContentFilterElement)(nil) // NewContentFilterElement factory function for _ContentFilterElement -func NewContentFilterElement(filterOperator FilterOperator, noOfFilterOperands int32, filterOperands []ExtensionObject) *_ContentFilterElement { +func NewContentFilterElement(filterOperator FilterOperator, filterOperands []ExtensionObject) *_ContentFilterElement { _result := &_ContentFilterElement{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), FilterOperator: filterOperator, - NoOfFilterOperands: noOfFilterOperands, FilterOperands: filterOperands, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -84,11 +80,9 @@ func NewContentFilterElement(filterOperator FilterOperator, noOfFilterOperands i type ContentFilterElementBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(filterOperator FilterOperator, noOfFilterOperands int32, filterOperands []ExtensionObject) ContentFilterElementBuilder + WithMandatoryFields(filterOperator FilterOperator, filterOperands []ExtensionObject) ContentFilterElementBuilder // WithFilterOperator adds FilterOperator (property field) WithFilterOperator(FilterOperator) ContentFilterElementBuilder - // WithNoOfFilterOperands adds NoOfFilterOperands (property field) - WithNoOfFilterOperands(int32) ContentFilterElementBuilder // WithFilterOperands adds FilterOperands (property field) WithFilterOperands(...ExtensionObject) ContentFilterElementBuilder // Build builds the ContentFilterElement or returns an error if something is wrong @@ -116,8 +110,8 @@ func (b *_ContentFilterElementBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_ContentFilterElementBuilder) WithMandatoryFields(filterOperator FilterOperator, noOfFilterOperands int32, filterOperands []ExtensionObject) ContentFilterElementBuilder { - return b.WithFilterOperator(filterOperator).WithNoOfFilterOperands(noOfFilterOperands).WithFilterOperands(filterOperands...) +func (b *_ContentFilterElementBuilder) WithMandatoryFields(filterOperator FilterOperator, filterOperands []ExtensionObject) ContentFilterElementBuilder { + return b.WithFilterOperator(filterOperator).WithFilterOperands(filterOperands...) } func (b *_ContentFilterElementBuilder) WithFilterOperator(filterOperator FilterOperator) ContentFilterElementBuilder { @@ -125,11 +119,6 @@ func (b *_ContentFilterElementBuilder) WithFilterOperator(filterOperator FilterO return b } -func (b *_ContentFilterElementBuilder) WithNoOfFilterOperands(noOfFilterOperands int32) ContentFilterElementBuilder { - b.NoOfFilterOperands = noOfFilterOperands - return b -} - func (b *_ContentFilterElementBuilder) WithFilterOperands(filterOperands ...ExtensionObject) ContentFilterElementBuilder { b.FilterOperands = filterOperands return b @@ -185,8 +174,8 @@ func (b *_ContentFilterElement) CreateContentFilterElementBuilder() ContentFilte /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ContentFilterElement) GetIdentifier() string { - return "585" +func (m *_ContentFilterElement) GetExtensionId() int32 { + return int32(585) } /////////////////////// @@ -207,10 +196,6 @@ func (m *_ContentFilterElement) GetFilterOperator() FilterOperator { return m.FilterOperator } -func (m *_ContentFilterElement) GetNoOfFilterOperands() int32 { - return m.NoOfFilterOperands -} - func (m *_ContentFilterElement) GetFilterOperands() []ExtensionObject { return m.FilterOperands } @@ -241,7 +226,7 @@ func (m *_ContentFilterElement) GetLengthInBits(ctx context.Context) uint16 { // Simple field (filterOperator) lengthInBits += 32 - // Simple field (noOfFilterOperands) + // Implicit Field (noOfFilterOperands) lengthInBits += 32 // Array field @@ -261,7 +246,7 @@ func (m *_ContentFilterElement) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ContentFilterElement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__contentFilterElement ContentFilterElement, err error) { +func (m *_ContentFilterElement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__contentFilterElement ContentFilterElement, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -278,13 +263,13 @@ func (m *_ContentFilterElement) parse(ctx context.Context, readBuffer utils.Read } m.FilterOperator = filterOperator - noOfFilterOperands, err := ReadSimpleField(ctx, "noOfFilterOperands", ReadSignedInt(readBuffer, uint8(32))) + noOfFilterOperands, err := ReadImplicitField[int32](ctx, "noOfFilterOperands", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfFilterOperands' field")) } - m.NoOfFilterOperands = noOfFilterOperands + _ = noOfFilterOperands - filterOperands, err := ReadCountArrayField[ExtensionObject](ctx, "filterOperands", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer), uint64(noOfFilterOperands)) + filterOperands, err := ReadCountArrayField[ExtensionObject](ctx, "filterOperands", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfFilterOperands)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filterOperands' field")) } @@ -318,8 +303,8 @@ func (m *_ContentFilterElement) SerializeWithWriteBuffer(ctx context.Context, wr if err := WriteSimpleEnumField[FilterOperator](ctx, "filterOperator", "FilterOperator", m.GetFilterOperator(), WriteEnum[FilterOperator, uint32](FilterOperator.GetValue, FilterOperator.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'filterOperator' field") } - - if err := WriteSimpleField[int32](ctx, "noOfFilterOperands", m.GetNoOfFilterOperands(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfFilterOperands := int32(utils.InlineIf(bool((m.GetFilterOperands()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetFilterOperands()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfFilterOperands", noOfFilterOperands, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfFilterOperands' field") } @@ -348,7 +333,6 @@ func (m *_ContentFilterElement) deepCopy() *_ContentFilterElement { _ContentFilterElementCopy := &_ContentFilterElement{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.FilterOperator, - m.NoOfFilterOperands, utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.FilterOperands), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/ContentFilterElementResult.go b/plc4go/protocols/opcua/readwrite/model/ContentFilterElementResult.go index f7236b56c7a..048945b7c32 100644 --- a/plc4go/protocols/opcua/readwrite/model/ContentFilterElementResult.go +++ b/plc4go/protocols/opcua/readwrite/model/ContentFilterElementResult.go @@ -42,12 +42,8 @@ type ContentFilterElementResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfOperandStatusCodes returns NoOfOperandStatusCodes (property field) - GetNoOfOperandStatusCodes() int32 // GetOperandStatusCodes returns OperandStatusCodes (property field) GetOperandStatusCodes() []StatusCode - // GetNoOfOperandDiagnosticInfos returns NoOfOperandDiagnosticInfos (property field) - GetNoOfOperandDiagnosticInfos() int32 // GetOperandDiagnosticInfos returns OperandDiagnosticInfos (property field) GetOperandDiagnosticInfos() []DiagnosticInfo // IsContentFilterElementResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type ContentFilterElementResult interface { // _ContentFilterElementResult is the data-structure of this message type _ContentFilterElementResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfOperandStatusCodes int32 - OperandStatusCodes []StatusCode - NoOfOperandDiagnosticInfos int32 - OperandDiagnosticInfos []DiagnosticInfo + StatusCode StatusCode + OperandStatusCodes []StatusCode + OperandDiagnosticInfos []DiagnosticInfo } var _ ContentFilterElementResult = (*_ContentFilterElementResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ContentFilterElementResult)(nil) // NewContentFilterElementResult factory function for _ContentFilterElementResult -func NewContentFilterElementResult(statusCode StatusCode, noOfOperandStatusCodes int32, operandStatusCodes []StatusCode, noOfOperandDiagnosticInfos int32, operandDiagnosticInfos []DiagnosticInfo) *_ContentFilterElementResult { +func NewContentFilterElementResult(statusCode StatusCode, operandStatusCodes []StatusCode, operandDiagnosticInfos []DiagnosticInfo) *_ContentFilterElementResult { if statusCode == nil { panic("statusCode of type StatusCode for ContentFilterElementResult must not be nil") } _result := &_ContentFilterElementResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfOperandStatusCodes: noOfOperandStatusCodes, OperandStatusCodes: operandStatusCodes, - NoOfOperandDiagnosticInfos: noOfOperandDiagnosticInfos, OperandDiagnosticInfos: operandDiagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewContentFilterElementResult(statusCode StatusCode, noOfOperandStatusCodes type ContentFilterElementResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfOperandStatusCodes int32, operandStatusCodes []StatusCode, noOfOperandDiagnosticInfos int32, operandDiagnosticInfos []DiagnosticInfo) ContentFilterElementResultBuilder + WithMandatoryFields(statusCode StatusCode, operandStatusCodes []StatusCode, operandDiagnosticInfos []DiagnosticInfo) ContentFilterElementResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) ContentFilterElementResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) ContentFilterElementResultBuilder - // WithNoOfOperandStatusCodes adds NoOfOperandStatusCodes (property field) - WithNoOfOperandStatusCodes(int32) ContentFilterElementResultBuilder // WithOperandStatusCodes adds OperandStatusCodes (property field) WithOperandStatusCodes(...StatusCode) ContentFilterElementResultBuilder - // WithNoOfOperandDiagnosticInfos adds NoOfOperandDiagnosticInfos (property field) - WithNoOfOperandDiagnosticInfos(int32) ContentFilterElementResultBuilder // WithOperandDiagnosticInfos adds OperandDiagnosticInfos (property field) WithOperandDiagnosticInfos(...DiagnosticInfo) ContentFilterElementResultBuilder // Build builds the ContentFilterElementResult or returns an error if something is wrong @@ -133,8 +121,8 @@ func (b *_ContentFilterElementResultBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_ContentFilterElementResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfOperandStatusCodes int32, operandStatusCodes []StatusCode, noOfOperandDiagnosticInfos int32, operandDiagnosticInfos []DiagnosticInfo) ContentFilterElementResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfOperandStatusCodes(noOfOperandStatusCodes).WithOperandStatusCodes(operandStatusCodes...).WithNoOfOperandDiagnosticInfos(noOfOperandDiagnosticInfos).WithOperandDiagnosticInfos(operandDiagnosticInfos...) +func (b *_ContentFilterElementResultBuilder) WithMandatoryFields(statusCode StatusCode, operandStatusCodes []StatusCode, operandDiagnosticInfos []DiagnosticInfo) ContentFilterElementResultBuilder { + return b.WithStatusCode(statusCode).WithOperandStatusCodes(operandStatusCodes...).WithOperandDiagnosticInfos(operandDiagnosticInfos...) } func (b *_ContentFilterElementResultBuilder) WithStatusCode(statusCode StatusCode) ContentFilterElementResultBuilder { @@ -155,21 +143,11 @@ func (b *_ContentFilterElementResultBuilder) WithStatusCodeBuilder(builderSuppli return b } -func (b *_ContentFilterElementResultBuilder) WithNoOfOperandStatusCodes(noOfOperandStatusCodes int32) ContentFilterElementResultBuilder { - b.NoOfOperandStatusCodes = noOfOperandStatusCodes - return b -} - func (b *_ContentFilterElementResultBuilder) WithOperandStatusCodes(operandStatusCodes ...StatusCode) ContentFilterElementResultBuilder { b.OperandStatusCodes = operandStatusCodes return b } -func (b *_ContentFilterElementResultBuilder) WithNoOfOperandDiagnosticInfos(noOfOperandDiagnosticInfos int32) ContentFilterElementResultBuilder { - b.NoOfOperandDiagnosticInfos = noOfOperandDiagnosticInfos - return b -} - func (b *_ContentFilterElementResultBuilder) WithOperandDiagnosticInfos(operandDiagnosticInfos ...DiagnosticInfo) ContentFilterElementResultBuilder { b.OperandDiagnosticInfos = operandDiagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_ContentFilterElementResult) CreateContentFilterElementResultBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ContentFilterElementResult) GetIdentifier() string { - return "606" +func (m *_ContentFilterElementResult) GetExtensionId() int32 { + return int32(606) } /////////////////////// @@ -253,18 +231,10 @@ func (m *_ContentFilterElementResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_ContentFilterElementResult) GetNoOfOperandStatusCodes() int32 { - return m.NoOfOperandStatusCodes -} - func (m *_ContentFilterElementResult) GetOperandStatusCodes() []StatusCode { return m.OperandStatusCodes } -func (m *_ContentFilterElementResult) GetNoOfOperandDiagnosticInfos() int32 { - return m.NoOfOperandDiagnosticInfos -} - func (m *_ContentFilterElementResult) GetOperandDiagnosticInfos() []DiagnosticInfo { return m.OperandDiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_ContentFilterElementResult) GetLengthInBits(ctx context.Context) uint1 // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfOperandStatusCodes) + // Implicit Field (noOfOperandStatusCodes) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_ContentFilterElementResult) GetLengthInBits(ctx context.Context) uint1 } } - // Simple field (noOfOperandDiagnosticInfos) + // Implicit Field (noOfOperandDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_ContentFilterElementResult) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_ContentFilterElementResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__contentFilterElementResult ContentFilterElementResult, err error) { +func (m *_ContentFilterElementResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__contentFilterElementResult ContentFilterElementResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -345,11 +315,11 @@ func (m *_ContentFilterElementResult) parse(ctx context.Context, readBuffer util } m.StatusCode = statusCode - noOfOperandStatusCodes, err := ReadSimpleField(ctx, "noOfOperandStatusCodes", ReadSignedInt(readBuffer, uint8(32))) + noOfOperandStatusCodes, err := ReadImplicitField[int32](ctx, "noOfOperandStatusCodes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfOperandStatusCodes' field")) } - m.NoOfOperandStatusCodes = noOfOperandStatusCodes + _ = noOfOperandStatusCodes operandStatusCodes, err := ReadCountArrayField[StatusCode](ctx, "operandStatusCodes", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfOperandStatusCodes)) if err != nil { @@ -357,11 +327,11 @@ func (m *_ContentFilterElementResult) parse(ctx context.Context, readBuffer util } m.OperandStatusCodes = operandStatusCodes - noOfOperandDiagnosticInfos, err := ReadSimpleField(ctx, "noOfOperandDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfOperandDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfOperandDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfOperandDiagnosticInfos' field")) } - m.NoOfOperandDiagnosticInfos = noOfOperandDiagnosticInfos + _ = noOfOperandDiagnosticInfos operandDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "operandDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfOperandDiagnosticInfos)) if err != nil { @@ -397,16 +367,16 @@ func (m *_ContentFilterElementResult) SerializeWithWriteBuffer(ctx context.Conte if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfOperandStatusCodes", m.GetNoOfOperandStatusCodes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfOperandStatusCodes := int32(utils.InlineIf(bool((m.GetOperandStatusCodes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetOperandStatusCodes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfOperandStatusCodes", noOfOperandStatusCodes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfOperandStatusCodes' field") } if err := WriteComplexTypeArrayField(ctx, "operandStatusCodes", m.GetOperandStatusCodes(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'operandStatusCodes' field") } - - if err := WriteSimpleField[int32](ctx, "noOfOperandDiagnosticInfos", m.GetNoOfOperandDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfOperandDiagnosticInfos := int32(utils.InlineIf(bool((m.GetOperandDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetOperandDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfOperandDiagnosticInfos", noOfOperandDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfOperandDiagnosticInfos' field") } @@ -435,9 +405,7 @@ func (m *_ContentFilterElementResult) deepCopy() *_ContentFilterElementResult { _ContentFilterElementResultCopy := &_ContentFilterElementResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfOperandStatusCodes, utils.DeepCopySlice[StatusCode, StatusCode](m.OperandStatusCodes), - m.NoOfOperandDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.OperandDiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/ContentFilterResult.go b/plc4go/protocols/opcua/readwrite/model/ContentFilterResult.go index cefc0e0edf8..12acedff00b 100644 --- a/plc4go/protocols/opcua/readwrite/model/ContentFilterResult.go +++ b/plc4go/protocols/opcua/readwrite/model/ContentFilterResult.go @@ -40,12 +40,8 @@ type ContentFilterResult interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfElementResults returns NoOfElementResults (property field) - GetNoOfElementResults() int32 // GetElementResults returns ElementResults (property field) - GetElementResults() []ExtensionObjectDefinition - // GetNoOfElementDiagnosticInfos returns NoOfElementDiagnosticInfos (property field) - GetNoOfElementDiagnosticInfos() int32 + GetElementResults() []ContentFilterElementResult // GetElementDiagnosticInfos returns ElementDiagnosticInfos (property field) GetElementDiagnosticInfos() []DiagnosticInfo // IsContentFilterResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,22 +53,18 @@ type ContentFilterResult interface { // _ContentFilterResult is the data-structure of this message type _ContentFilterResult struct { ExtensionObjectDefinitionContract - NoOfElementResults int32 - ElementResults []ExtensionObjectDefinition - NoOfElementDiagnosticInfos int32 - ElementDiagnosticInfos []DiagnosticInfo + ElementResults []ContentFilterElementResult + ElementDiagnosticInfos []DiagnosticInfo } var _ ContentFilterResult = (*_ContentFilterResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ContentFilterResult)(nil) // NewContentFilterResult factory function for _ContentFilterResult -func NewContentFilterResult(noOfElementResults int32, elementResults []ExtensionObjectDefinition, noOfElementDiagnosticInfos int32, elementDiagnosticInfos []DiagnosticInfo) *_ContentFilterResult { +func NewContentFilterResult(elementResults []ContentFilterElementResult, elementDiagnosticInfos []DiagnosticInfo) *_ContentFilterResult { _result := &_ContentFilterResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfElementResults: noOfElementResults, ElementResults: elementResults, - NoOfElementDiagnosticInfos: noOfElementDiagnosticInfos, ElementDiagnosticInfos: elementDiagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -88,13 +80,9 @@ func NewContentFilterResult(noOfElementResults int32, elementResults []Extension type ContentFilterResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfElementResults int32, elementResults []ExtensionObjectDefinition, noOfElementDiagnosticInfos int32, elementDiagnosticInfos []DiagnosticInfo) ContentFilterResultBuilder - // WithNoOfElementResults adds NoOfElementResults (property field) - WithNoOfElementResults(int32) ContentFilterResultBuilder + WithMandatoryFields(elementResults []ContentFilterElementResult, elementDiagnosticInfos []DiagnosticInfo) ContentFilterResultBuilder // WithElementResults adds ElementResults (property field) - WithElementResults(...ExtensionObjectDefinition) ContentFilterResultBuilder - // WithNoOfElementDiagnosticInfos adds NoOfElementDiagnosticInfos (property field) - WithNoOfElementDiagnosticInfos(int32) ContentFilterResultBuilder + WithElementResults(...ContentFilterElementResult) ContentFilterResultBuilder // WithElementDiagnosticInfos adds ElementDiagnosticInfos (property field) WithElementDiagnosticInfos(...DiagnosticInfo) ContentFilterResultBuilder // Build builds the ContentFilterResult or returns an error if something is wrong @@ -122,25 +110,15 @@ func (b *_ContentFilterResultBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_ContentFilterResultBuilder) WithMandatoryFields(noOfElementResults int32, elementResults []ExtensionObjectDefinition, noOfElementDiagnosticInfos int32, elementDiagnosticInfos []DiagnosticInfo) ContentFilterResultBuilder { - return b.WithNoOfElementResults(noOfElementResults).WithElementResults(elementResults...).WithNoOfElementDiagnosticInfos(noOfElementDiagnosticInfos).WithElementDiagnosticInfos(elementDiagnosticInfos...) +func (b *_ContentFilterResultBuilder) WithMandatoryFields(elementResults []ContentFilterElementResult, elementDiagnosticInfos []DiagnosticInfo) ContentFilterResultBuilder { + return b.WithElementResults(elementResults...).WithElementDiagnosticInfos(elementDiagnosticInfos...) } -func (b *_ContentFilterResultBuilder) WithNoOfElementResults(noOfElementResults int32) ContentFilterResultBuilder { - b.NoOfElementResults = noOfElementResults - return b -} - -func (b *_ContentFilterResultBuilder) WithElementResults(elementResults ...ExtensionObjectDefinition) ContentFilterResultBuilder { +func (b *_ContentFilterResultBuilder) WithElementResults(elementResults ...ContentFilterElementResult) ContentFilterResultBuilder { b.ElementResults = elementResults return b } -func (b *_ContentFilterResultBuilder) WithNoOfElementDiagnosticInfos(noOfElementDiagnosticInfos int32) ContentFilterResultBuilder { - b.NoOfElementDiagnosticInfos = noOfElementDiagnosticInfos - return b -} - func (b *_ContentFilterResultBuilder) WithElementDiagnosticInfos(elementDiagnosticInfos ...DiagnosticInfo) ContentFilterResultBuilder { b.ElementDiagnosticInfos = elementDiagnosticInfos return b @@ -196,8 +174,8 @@ func (b *_ContentFilterResult) CreateContentFilterResultBuilder() ContentFilterR /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ContentFilterResult) GetIdentifier() string { - return "609" +func (m *_ContentFilterResult) GetExtensionId() int32 { + return int32(609) } /////////////////////// @@ -214,18 +192,10 @@ func (m *_ContentFilterResult) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ContentFilterResult) GetNoOfElementResults() int32 { - return m.NoOfElementResults -} - -func (m *_ContentFilterResult) GetElementResults() []ExtensionObjectDefinition { +func (m *_ContentFilterResult) GetElementResults() []ContentFilterElementResult { return m.ElementResults } -func (m *_ContentFilterResult) GetNoOfElementDiagnosticInfos() int32 { - return m.NoOfElementDiagnosticInfos -} - func (m *_ContentFilterResult) GetElementDiagnosticInfos() []DiagnosticInfo { return m.ElementDiagnosticInfos } @@ -253,7 +223,7 @@ func (m *_ContentFilterResult) GetTypeName() string { func (m *_ContentFilterResult) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfElementResults) + // Implicit Field (noOfElementResults) lengthInBits += 32 // Array field @@ -266,7 +236,7 @@ func (m *_ContentFilterResult) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfElementDiagnosticInfos) + // Implicit Field (noOfElementDiagnosticInfos) lengthInBits += 32 // Array field @@ -286,7 +256,7 @@ func (m *_ContentFilterResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ContentFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__contentFilterResult ContentFilterResult, err error) { +func (m *_ContentFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__contentFilterResult ContentFilterResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -297,23 +267,23 @@ func (m *_ContentFilterResult) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - noOfElementResults, err := ReadSimpleField(ctx, "noOfElementResults", ReadSignedInt(readBuffer, uint8(32))) + noOfElementResults, err := ReadImplicitField[int32](ctx, "noOfElementResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfElementResults' field")) } - m.NoOfElementResults = noOfElementResults + _ = noOfElementResults - elementResults, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "elementResults", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("606")), readBuffer), uint64(noOfElementResults)) + elementResults, err := ReadCountArrayField[ContentFilterElementResult](ctx, "elementResults", ReadComplex[ContentFilterElementResult](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilterElementResult]((int32)(int32(606))), readBuffer), uint64(noOfElementResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'elementResults' field")) } m.ElementResults = elementResults - noOfElementDiagnosticInfos, err := ReadSimpleField(ctx, "noOfElementDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfElementDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfElementDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfElementDiagnosticInfos' field")) } - m.NoOfElementDiagnosticInfos = noOfElementDiagnosticInfos + _ = noOfElementDiagnosticInfos elementDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "elementDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfElementDiagnosticInfos)) if err != nil { @@ -345,16 +315,16 @@ func (m *_ContentFilterResult) SerializeWithWriteBuffer(ctx context.Context, wri if pushErr := writeBuffer.PushContext("ContentFilterResult"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for ContentFilterResult") } - - if err := WriteSimpleField[int32](ctx, "noOfElementResults", m.GetNoOfElementResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfElementResults := int32(utils.InlineIf(bool((m.GetElementResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetElementResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfElementResults", noOfElementResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfElementResults' field") } if err := WriteComplexTypeArrayField(ctx, "elementResults", m.GetElementResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'elementResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfElementDiagnosticInfos", m.GetNoOfElementDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfElementDiagnosticInfos := int32(utils.InlineIf(bool((m.GetElementDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetElementDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfElementDiagnosticInfos", noOfElementDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfElementDiagnosticInfos' field") } @@ -382,9 +352,7 @@ func (m *_ContentFilterResult) deepCopy() *_ContentFilterResult { } _ContentFilterResultCopy := &_ContentFilterResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfElementResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ElementResults), - m.NoOfElementDiagnosticInfos, + utils.DeepCopySlice[ContentFilterElementResult, ContentFilterElementResult](m.ElementResults), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.ElementDiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsRequest.go b/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsRequest.go index dac9ee7ad21..94c7a06a508 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsRequest.go @@ -41,15 +41,13 @@ type CreateMonitoredItemsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetTimestampsToReturn returns TimestampsToReturn (property field) GetTimestampsToReturn() TimestampsToReturn - // GetNoOfItemsToCreate returns NoOfItemsToCreate (property field) - GetNoOfItemsToCreate() int32 // GetItemsToCreate returns ItemsToCreate (property field) - GetItemsToCreate() []ExtensionObjectDefinition + GetItemsToCreate() []MonitoredItemCreateRequest // IsCreateMonitoredItemsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsCreateMonitoredItemsRequest() // CreateBuilder creates a CreateMonitoredItemsRequestBuilder @@ -59,27 +57,25 @@ type CreateMonitoredItemsRequest interface { // _CreateMonitoredItemsRequest is the data-structure of this message type _CreateMonitoredItemsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader SubscriptionId uint32 TimestampsToReturn TimestampsToReturn - NoOfItemsToCreate int32 - ItemsToCreate []ExtensionObjectDefinition + ItemsToCreate []MonitoredItemCreateRequest } var _ CreateMonitoredItemsRequest = (*_CreateMonitoredItemsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateMonitoredItemsRequest)(nil) // NewCreateMonitoredItemsRequest factory function for _CreateMonitoredItemsRequest -func NewCreateMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToCreate int32, itemsToCreate []ExtensionObjectDefinition) *_CreateMonitoredItemsRequest { +func NewCreateMonitoredItemsRequest(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToCreate []MonitoredItemCreateRequest) *_CreateMonitoredItemsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CreateMonitoredItemsRequest must not be nil") + panic("requestHeader of type RequestHeader for CreateMonitoredItemsRequest must not be nil") } _result := &_CreateMonitoredItemsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, SubscriptionId: subscriptionId, TimestampsToReturn: timestampsToReturn, - NoOfItemsToCreate: noOfItemsToCreate, ItemsToCreate: itemsToCreate, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,19 +91,17 @@ func NewCreateMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, sub type CreateMonitoredItemsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToCreate int32, itemsToCreate []ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToCreate []MonitoredItemCreateRequest) CreateMonitoredItemsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder + WithRequestHeader(RequestHeader) CreateMonitoredItemsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateMonitoredItemsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CreateMonitoredItemsRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) CreateMonitoredItemsRequestBuilder // WithTimestampsToReturn adds TimestampsToReturn (property field) WithTimestampsToReturn(TimestampsToReturn) CreateMonitoredItemsRequestBuilder - // WithNoOfItemsToCreate adds NoOfItemsToCreate (property field) - WithNoOfItemsToCreate(int32) CreateMonitoredItemsRequestBuilder // WithItemsToCreate adds ItemsToCreate (property field) - WithItemsToCreate(...ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder + WithItemsToCreate(...MonitoredItemCreateRequest) CreateMonitoredItemsRequestBuilder // Build builds the CreateMonitoredItemsRequest or returns an error if something is wrong Build() (CreateMonitoredItemsRequest, error) // MustBuild does the same as Build but panics on error @@ -133,24 +127,24 @@ func (b *_CreateMonitoredItemsRequestBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToCreate int32, itemsToCreate []ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTimestampsToReturn(timestampsToReturn).WithNoOfItemsToCreate(noOfItemsToCreate).WithItemsToCreate(itemsToCreate...) +func (b *_CreateMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToCreate []MonitoredItemCreateRequest) CreateMonitoredItemsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTimestampsToReturn(timestampsToReturn).WithItemsToCreate(itemsToCreate...) } -func (b *_CreateMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder { +func (b *_CreateMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CreateMonitoredItemsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CreateMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateMonitoredItemsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CreateMonitoredItemsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -165,12 +159,7 @@ func (b *_CreateMonitoredItemsRequestBuilder) WithTimestampsToReturn(timestampsT return b } -func (b *_CreateMonitoredItemsRequestBuilder) WithNoOfItemsToCreate(noOfItemsToCreate int32) CreateMonitoredItemsRequestBuilder { - b.NoOfItemsToCreate = noOfItemsToCreate - return b -} - -func (b *_CreateMonitoredItemsRequestBuilder) WithItemsToCreate(itemsToCreate ...ExtensionObjectDefinition) CreateMonitoredItemsRequestBuilder { +func (b *_CreateMonitoredItemsRequestBuilder) WithItemsToCreate(itemsToCreate ...MonitoredItemCreateRequest) CreateMonitoredItemsRequestBuilder { b.ItemsToCreate = itemsToCreate return b } @@ -231,8 +220,8 @@ func (b *_CreateMonitoredItemsRequest) CreateCreateMonitoredItemsRequestBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateMonitoredItemsRequest) GetIdentifier() string { - return "751" +func (m *_CreateMonitoredItemsRequest) GetExtensionId() int32 { + return int32(751) } /////////////////////// @@ -249,7 +238,7 @@ func (m *_CreateMonitoredItemsRequest) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateMonitoredItemsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CreateMonitoredItemsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -261,11 +250,7 @@ func (m *_CreateMonitoredItemsRequest) GetTimestampsToReturn() TimestampsToRetur return m.TimestampsToReturn } -func (m *_CreateMonitoredItemsRequest) GetNoOfItemsToCreate() int32 { - return m.NoOfItemsToCreate -} - -func (m *_CreateMonitoredItemsRequest) GetItemsToCreate() []ExtensionObjectDefinition { +func (m *_CreateMonitoredItemsRequest) GetItemsToCreate() []MonitoredItemCreateRequest { return m.ItemsToCreate } @@ -301,7 +286,7 @@ func (m *_CreateMonitoredItemsRequest) GetLengthInBits(ctx context.Context) uint // Simple field (timestampsToReturn) lengthInBits += 32 - // Simple field (noOfItemsToCreate) + // Implicit Field (noOfItemsToCreate) lengthInBits += 32 // Array field @@ -321,7 +306,7 @@ func (m *_CreateMonitoredItemsRequest) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createMonitoredItemsRequest CreateMonitoredItemsRequest, err error) { +func (m *_CreateMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createMonitoredItemsRequest CreateMonitoredItemsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -332,7 +317,7 @@ func (m *_CreateMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -350,13 +335,13 @@ func (m *_CreateMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti } m.TimestampsToReturn = timestampsToReturn - noOfItemsToCreate, err := ReadSimpleField(ctx, "noOfItemsToCreate", ReadSignedInt(readBuffer, uint8(32))) + noOfItemsToCreate, err := ReadImplicitField[int32](ctx, "noOfItemsToCreate", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfItemsToCreate' field")) } - m.NoOfItemsToCreate = noOfItemsToCreate + _ = noOfItemsToCreate - itemsToCreate, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "itemsToCreate", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("745")), readBuffer), uint64(noOfItemsToCreate)) + itemsToCreate, err := ReadCountArrayField[MonitoredItemCreateRequest](ctx, "itemsToCreate", ReadComplex[MonitoredItemCreateRequest](ExtensionObjectDefinitionParseWithBufferProducer[MonitoredItemCreateRequest]((int32)(int32(745))), readBuffer), uint64(noOfItemsToCreate)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'itemsToCreate' field")) } @@ -387,7 +372,7 @@ func (m *_CreateMonitoredItemsRequest) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(pushErr, "Error pushing for CreateMonitoredItemsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -398,8 +383,8 @@ func (m *_CreateMonitoredItemsRequest) SerializeWithWriteBuffer(ctx context.Cont if err := WriteSimpleEnumField[TimestampsToReturn](ctx, "timestampsToReturn", "TimestampsToReturn", m.GetTimestampsToReturn(), WriteEnum[TimestampsToReturn, uint32](TimestampsToReturn.GetValue, TimestampsToReturn.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'timestampsToReturn' field") } - - if err := WriteSimpleField[int32](ctx, "noOfItemsToCreate", m.GetNoOfItemsToCreate(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfItemsToCreate := int32(utils.InlineIf(bool((m.GetItemsToCreate()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetItemsToCreate()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfItemsToCreate", noOfItemsToCreate, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfItemsToCreate' field") } @@ -427,11 +412,10 @@ func (m *_CreateMonitoredItemsRequest) deepCopy() *_CreateMonitoredItemsRequest } _CreateMonitoredItemsRequestCopy := &_CreateMonitoredItemsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.TimestampsToReturn, - m.NoOfItemsToCreate, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ItemsToCreate), + utils.DeepCopySlice[MonitoredItemCreateRequest, MonitoredItemCreateRequest](m.ItemsToCreate), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _CreateMonitoredItemsRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsResponse.go b/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsResponse.go index f4429ea8404..af17abef47b 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateMonitoredItemsResponse.go @@ -41,13 +41,9 @@ type CreateMonitoredItemsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []MonitoredItemCreateResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsCreateMonitoredItemsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type CreateMonitoredItemsResponse interface { // _CreateMonitoredItemsResponse is the data-structure of this message type _CreateMonitoredItemsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []MonitoredItemCreateResult + DiagnosticInfos []DiagnosticInfo } var _ CreateMonitoredItemsResponse = (*_CreateMonitoredItemsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateMonitoredItemsResponse)(nil) // NewCreateMonitoredItemsResponse factory function for _CreateMonitoredItemsResponse -func NewCreateMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_CreateMonitoredItemsResponse { +func NewCreateMonitoredItemsResponse(responseHeader ResponseHeader, results []MonitoredItemCreateResult, diagnosticInfos []DiagnosticInfo) *_CreateMonitoredItemsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CreateMonitoredItemsResponse must not be nil") + panic("responseHeader of type ResponseHeader for CreateMonitoredItemsResponse must not be nil") } _result := &_CreateMonitoredItemsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewCreateMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, n type CreateMonitoredItemsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) CreateMonitoredItemsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []MonitoredItemCreateResult, diagnosticInfos []DiagnosticInfo) CreateMonitoredItemsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CreateMonitoredItemsResponseBuilder + WithResponseHeader(ResponseHeader) CreateMonitoredItemsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateMonitoredItemsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) CreateMonitoredItemsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateMonitoredItemsResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) CreateMonitoredItemsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) CreateMonitoredItemsResponseBuilder + WithResults(...MonitoredItemCreateResult) CreateMonitoredItemsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) CreateMonitoredItemsResponseBuilder // Build builds the CreateMonitoredItemsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_CreateMonitoredItemsResponseBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) CreateMonitoredItemsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_CreateMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []MonitoredItemCreateResult, diagnosticInfos []DiagnosticInfo) CreateMonitoredItemsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_CreateMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CreateMonitoredItemsResponseBuilder { +func (b *_CreateMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CreateMonitoredItemsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CreateMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateMonitoredItemsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateMonitoredItemsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_CreateMonitoredItemsResponseBuilder) WithNoOfResults(noOfResults int32) CreateMonitoredItemsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_CreateMonitoredItemsResponseBuilder) WithResults(results ...ExtensionObjectDefinition) CreateMonitoredItemsResponseBuilder { +func (b *_CreateMonitoredItemsResponseBuilder) WithResults(results ...MonitoredItemCreateResult) CreateMonitoredItemsResponseBuilder { b.Results = results return b } -func (b *_CreateMonitoredItemsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) CreateMonitoredItemsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_CreateMonitoredItemsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) CreateMonitoredItemsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_CreateMonitoredItemsResponse) CreateCreateMonitoredItemsResponseBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateMonitoredItemsResponse) GetIdentifier() string { - return "754" +func (m *_CreateMonitoredItemsResponse) GetExtensionId() int32 { + return int32(754) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_CreateMonitoredItemsResponse) GetParent() ExtensionObjectDefinitionCon /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateMonitoredItemsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CreateMonitoredItemsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_CreateMonitoredItemsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_CreateMonitoredItemsResponse) GetResults() []ExtensionObjectDefinition { +func (m *_CreateMonitoredItemsResponse) GetResults() []MonitoredItemCreateResult { return m.Results } -func (m *_CreateMonitoredItemsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_CreateMonitoredItemsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_CreateMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_CreateMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_CreateMonitoredItemsResponse) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createMonitoredItemsResponse CreateMonitoredItemsResponse, err error) { +func (m *_CreateMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createMonitoredItemsResponse CreateMonitoredItemsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_CreateMonitoredItemsResponse) parse(ctx context.Context, readBuffer ut currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("748")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[MonitoredItemCreateResult](ctx, "results", ReadComplex[MonitoredItemCreateResult](ExtensionObjectDefinitionParseWithBufferProducer[MonitoredItemCreateResult]((int32)(int32(748))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_CreateMonitoredItemsResponse) SerializeWithWriteBuffer(ctx context.Con return errors.Wrap(pushErr, "Error pushing for CreateMonitoredItemsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_CreateMonitoredItemsResponse) deepCopy() *_CreateMonitoredItemsRespons } _CreateMonitoredItemsResponseCopy := &_CreateMonitoredItemsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[MonitoredItemCreateResult, MonitoredItemCreateResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CreateSessionRequest.go b/plc4go/protocols/opcua/readwrite/model/CreateSessionRequest.go index 289ea5278ce..623f04815a3 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateSessionRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateSessionRequest.go @@ -41,9 +41,9 @@ type CreateSessionRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetClientDescription returns ClientDescription (property field) - GetClientDescription() ExtensionObjectDefinition + GetClientDescription() ApplicationDescription // GetServerUri returns ServerUri (property field) GetServerUri() PascalString // GetEndpointUrl returns EndpointUrl (property field) @@ -67,8 +67,8 @@ type CreateSessionRequest interface { // _CreateSessionRequest is the data-structure of this message type _CreateSessionRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - ClientDescription ExtensionObjectDefinition + RequestHeader RequestHeader + ClientDescription ApplicationDescription ServerUri PascalString EndpointUrl PascalString SessionName PascalString @@ -82,12 +82,12 @@ var _ CreateSessionRequest = (*_CreateSessionRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateSessionRequest)(nil) // NewCreateSessionRequest factory function for _CreateSessionRequest -func NewCreateSessionRequest(requestHeader ExtensionObjectDefinition, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) *_CreateSessionRequest { +func NewCreateSessionRequest(requestHeader RequestHeader, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) *_CreateSessionRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CreateSessionRequest must not be nil") + panic("requestHeader of type RequestHeader for CreateSessionRequest must not be nil") } if clientDescription == nil { - panic("clientDescription of type ExtensionObjectDefinition for CreateSessionRequest must not be nil") + panic("clientDescription of type ApplicationDescription for CreateSessionRequest must not be nil") } if serverUri == nil { panic("serverUri of type PascalString for CreateSessionRequest must not be nil") @@ -129,15 +129,15 @@ func NewCreateSessionRequest(requestHeader ExtensionObjectDefinition, clientDesc type CreateSessionRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) CreateSessionRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) CreateSessionRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CreateSessionRequestBuilder + WithRequestHeader(RequestHeader) CreateSessionRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CreateSessionRequestBuilder // WithClientDescription adds ClientDescription (property field) - WithClientDescription(ExtensionObjectDefinition) CreateSessionRequestBuilder + WithClientDescription(ApplicationDescription) CreateSessionRequestBuilder // WithClientDescriptionBuilder adds ClientDescription (property field) which is build by the builder - WithClientDescriptionBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionRequestBuilder + WithClientDescriptionBuilder(func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) CreateSessionRequestBuilder // WithServerUri adds ServerUri (property field) WithServerUri(PascalString) CreateSessionRequestBuilder // WithServerUriBuilder adds ServerUri (property field) which is build by the builder @@ -187,42 +187,42 @@ func (b *_CreateSessionRequestBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateSessionRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) CreateSessionRequestBuilder { +func (b *_CreateSessionRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, sessionName PascalString, clientNonce PascalByteString, clientCertificate PascalByteString, requestedSessionTimeout float64, maxResponseMessageSize uint32) CreateSessionRequestBuilder { return b.WithRequestHeader(requestHeader).WithClientDescription(clientDescription).WithServerUri(serverUri).WithEndpointUrl(endpointUrl).WithSessionName(sessionName).WithClientNonce(clientNonce).WithClientCertificate(clientCertificate).WithRequestedSessionTimeout(requestedSessionTimeout).WithMaxResponseMessageSize(maxResponseMessageSize) } -func (b *_CreateSessionRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CreateSessionRequestBuilder { +func (b *_CreateSessionRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CreateSessionRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CreateSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSessionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CreateSessionRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_CreateSessionRequestBuilder) WithClientDescription(clientDescription ExtensionObjectDefinition) CreateSessionRequestBuilder { +func (b *_CreateSessionRequestBuilder) WithClientDescription(clientDescription ApplicationDescription) CreateSessionRequestBuilder { b.ClientDescription = clientDescription return b } -func (b *_CreateSessionRequestBuilder) WithClientDescriptionBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionRequestBuilder { - builder := builderSupplier(b.ClientDescription.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSessionRequestBuilder) WithClientDescriptionBuilder(builderSupplier func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) CreateSessionRequestBuilder { + builder := builderSupplier(b.ClientDescription.CreateApplicationDescriptionBuilder()) var err error b.ClientDescription, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ApplicationDescriptionBuilder failed")) } return b } @@ -419,8 +419,8 @@ func (b *_CreateSessionRequest) CreateCreateSessionRequestBuilder() CreateSessio /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateSessionRequest) GetIdentifier() string { - return "461" +func (m *_CreateSessionRequest) GetExtensionId() int32 { + return int32(461) } /////////////////////// @@ -437,11 +437,11 @@ func (m *_CreateSessionRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateSessionRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CreateSessionRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_CreateSessionRequest) GetClientDescription() ExtensionObjectDefinition { +func (m *_CreateSessionRequest) GetClientDescription() ApplicationDescription { return m.ClientDescription } @@ -530,7 +530,7 @@ func (m *_CreateSessionRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createSessionRequest CreateSessionRequest, err error) { +func (m *_CreateSessionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createSessionRequest CreateSessionRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -541,13 +541,13 @@ func (m *_CreateSessionRequest) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - clientDescription, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "clientDescription", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("310")), readBuffer)) + clientDescription, err := ReadSimpleField[ApplicationDescription](ctx, "clientDescription", ReadComplex[ApplicationDescription](ExtensionObjectDefinitionParseWithBufferProducer[ApplicationDescription]((int32)(int32(310))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'clientDescription' field")) } @@ -620,11 +620,11 @@ func (m *_CreateSessionRequest) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for CreateSessionRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "clientDescription", m.GetClientDescription(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ApplicationDescription](ctx, "clientDescription", m.GetClientDescription(), WriteComplex[ApplicationDescription](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'clientDescription' field") } @@ -676,8 +676,8 @@ func (m *_CreateSessionRequest) deepCopy() *_CreateSessionRequest { } _CreateSessionRequestCopy := &_CreateSessionRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.ClientDescription.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), + m.ClientDescription.DeepCopy().(ApplicationDescription), m.ServerUri.DeepCopy().(PascalString), m.EndpointUrl.DeepCopy().(PascalString), m.SessionName.DeepCopy().(PascalString), diff --git a/plc4go/protocols/opcua/readwrite/model/CreateSessionResponse.go b/plc4go/protocols/opcua/readwrite/model/CreateSessionResponse.go index a6f97953665..70890fd8eb7 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateSessionResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateSessionResponse.go @@ -41,7 +41,7 @@ type CreateSessionResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetSessionId returns SessionId (property field) GetSessionId() NodeId // GetAuthenticationToken returns AuthenticationToken (property field) @@ -52,16 +52,12 @@ type CreateSessionResponse interface { GetServerNonce() PascalByteString // GetServerCertificate returns ServerCertificate (property field) GetServerCertificate() PascalByteString - // GetNoOfServerEndpoints returns NoOfServerEndpoints (property field) - GetNoOfServerEndpoints() int32 // GetServerEndpoints returns ServerEndpoints (property field) - GetServerEndpoints() []ExtensionObjectDefinition - // GetNoOfServerSoftwareCertificates returns NoOfServerSoftwareCertificates (property field) - GetNoOfServerSoftwareCertificates() int32 + GetServerEndpoints() []EndpointDescription // GetServerSoftwareCertificates returns ServerSoftwareCertificates (property field) - GetServerSoftwareCertificates() []ExtensionObjectDefinition + GetServerSoftwareCertificates() []SignedSoftwareCertificate // GetServerSignature returns ServerSignature (property field) - GetServerSignature() ExtensionObjectDefinition + GetServerSignature() SignatureData // GetMaxRequestMessageSize returns MaxRequestMessageSize (property field) GetMaxRequestMessageSize() uint32 // IsCreateSessionResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -73,27 +69,25 @@ type CreateSessionResponse interface { // _CreateSessionResponse is the data-structure of this message type _CreateSessionResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - SessionId NodeId - AuthenticationToken NodeId - RevisedSessionTimeout float64 - ServerNonce PascalByteString - ServerCertificate PascalByteString - NoOfServerEndpoints int32 - ServerEndpoints []ExtensionObjectDefinition - NoOfServerSoftwareCertificates int32 - ServerSoftwareCertificates []ExtensionObjectDefinition - ServerSignature ExtensionObjectDefinition - MaxRequestMessageSize uint32 + ResponseHeader ResponseHeader + SessionId NodeId + AuthenticationToken NodeId + RevisedSessionTimeout float64 + ServerNonce PascalByteString + ServerCertificate PascalByteString + ServerEndpoints []EndpointDescription + ServerSoftwareCertificates []SignedSoftwareCertificate + ServerSignature SignatureData + MaxRequestMessageSize uint32 } var _ CreateSessionResponse = (*_CreateSessionResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateSessionResponse)(nil) // NewCreateSessionResponse factory function for _CreateSessionResponse -func NewCreateSessionResponse(responseHeader ExtensionObjectDefinition, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, noOfServerEndpoints int32, serverEndpoints []ExtensionObjectDefinition, noOfServerSoftwareCertificates int32, serverSoftwareCertificates []ExtensionObjectDefinition, serverSignature ExtensionObjectDefinition, maxRequestMessageSize uint32) *_CreateSessionResponse { +func NewCreateSessionResponse(responseHeader ResponseHeader, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, serverEndpoints []EndpointDescription, serverSoftwareCertificates []SignedSoftwareCertificate, serverSignature SignatureData, maxRequestMessageSize uint32) *_CreateSessionResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CreateSessionResponse must not be nil") + panic("responseHeader of type ResponseHeader for CreateSessionResponse must not be nil") } if sessionId == nil { panic("sessionId of type NodeId for CreateSessionResponse must not be nil") @@ -108,7 +102,7 @@ func NewCreateSessionResponse(responseHeader ExtensionObjectDefinition, sessionI panic("serverCertificate of type PascalByteString for CreateSessionResponse must not be nil") } if serverSignature == nil { - panic("serverSignature of type ExtensionObjectDefinition for CreateSessionResponse must not be nil") + panic("serverSignature of type SignatureData for CreateSessionResponse must not be nil") } _result := &_CreateSessionResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -118,9 +112,7 @@ func NewCreateSessionResponse(responseHeader ExtensionObjectDefinition, sessionI RevisedSessionTimeout: revisedSessionTimeout, ServerNonce: serverNonce, ServerCertificate: serverCertificate, - NoOfServerEndpoints: noOfServerEndpoints, ServerEndpoints: serverEndpoints, - NoOfServerSoftwareCertificates: noOfServerSoftwareCertificates, ServerSoftwareCertificates: serverSoftwareCertificates, ServerSignature: serverSignature, MaxRequestMessageSize: maxRequestMessageSize, @@ -138,11 +130,11 @@ func NewCreateSessionResponse(responseHeader ExtensionObjectDefinition, sessionI type CreateSessionResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, noOfServerEndpoints int32, serverEndpoints []ExtensionObjectDefinition, noOfServerSoftwareCertificates int32, serverSoftwareCertificates []ExtensionObjectDefinition, serverSignature ExtensionObjectDefinition, maxRequestMessageSize uint32) CreateSessionResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, serverEndpoints []EndpointDescription, serverSoftwareCertificates []SignedSoftwareCertificate, serverSignature SignatureData, maxRequestMessageSize uint32) CreateSessionResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CreateSessionResponseBuilder + WithResponseHeader(ResponseHeader) CreateSessionResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateSessionResponseBuilder // WithSessionId adds SessionId (property field) WithSessionId(NodeId) CreateSessionResponseBuilder // WithSessionIdBuilder adds SessionId (property field) which is build by the builder @@ -161,18 +153,14 @@ type CreateSessionResponseBuilder interface { WithServerCertificate(PascalByteString) CreateSessionResponseBuilder // WithServerCertificateBuilder adds ServerCertificate (property field) which is build by the builder WithServerCertificateBuilder(func(PascalByteStringBuilder) PascalByteStringBuilder) CreateSessionResponseBuilder - // WithNoOfServerEndpoints adds NoOfServerEndpoints (property field) - WithNoOfServerEndpoints(int32) CreateSessionResponseBuilder // WithServerEndpoints adds ServerEndpoints (property field) - WithServerEndpoints(...ExtensionObjectDefinition) CreateSessionResponseBuilder - // WithNoOfServerSoftwareCertificates adds NoOfServerSoftwareCertificates (property field) - WithNoOfServerSoftwareCertificates(int32) CreateSessionResponseBuilder + WithServerEndpoints(...EndpointDescription) CreateSessionResponseBuilder // WithServerSoftwareCertificates adds ServerSoftwareCertificates (property field) - WithServerSoftwareCertificates(...ExtensionObjectDefinition) CreateSessionResponseBuilder + WithServerSoftwareCertificates(...SignedSoftwareCertificate) CreateSessionResponseBuilder // WithServerSignature adds ServerSignature (property field) - WithServerSignature(ExtensionObjectDefinition) CreateSessionResponseBuilder + WithServerSignature(SignatureData) CreateSessionResponseBuilder // WithServerSignatureBuilder adds ServerSignature (property field) which is build by the builder - WithServerSignatureBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionResponseBuilder + WithServerSignatureBuilder(func(SignatureDataBuilder) SignatureDataBuilder) CreateSessionResponseBuilder // WithMaxRequestMessageSize adds MaxRequestMessageSize (property field) WithMaxRequestMessageSize(uint32) CreateSessionResponseBuilder // Build builds the CreateSessionResponse or returns an error if something is wrong @@ -200,24 +188,24 @@ func (b *_CreateSessionResponseBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateSessionResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, noOfServerEndpoints int32, serverEndpoints []ExtensionObjectDefinition, noOfServerSoftwareCertificates int32, serverSoftwareCertificates []ExtensionObjectDefinition, serverSignature ExtensionObjectDefinition, maxRequestMessageSize uint32) CreateSessionResponseBuilder { - return b.WithResponseHeader(responseHeader).WithSessionId(sessionId).WithAuthenticationToken(authenticationToken).WithRevisedSessionTimeout(revisedSessionTimeout).WithServerNonce(serverNonce).WithServerCertificate(serverCertificate).WithNoOfServerEndpoints(noOfServerEndpoints).WithServerEndpoints(serverEndpoints...).WithNoOfServerSoftwareCertificates(noOfServerSoftwareCertificates).WithServerSoftwareCertificates(serverSoftwareCertificates...).WithServerSignature(serverSignature).WithMaxRequestMessageSize(maxRequestMessageSize) +func (b *_CreateSessionResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, sessionId NodeId, authenticationToken NodeId, revisedSessionTimeout float64, serverNonce PascalByteString, serverCertificate PascalByteString, serverEndpoints []EndpointDescription, serverSoftwareCertificates []SignedSoftwareCertificate, serverSignature SignatureData, maxRequestMessageSize uint32) CreateSessionResponseBuilder { + return b.WithResponseHeader(responseHeader).WithSessionId(sessionId).WithAuthenticationToken(authenticationToken).WithRevisedSessionTimeout(revisedSessionTimeout).WithServerNonce(serverNonce).WithServerCertificate(serverCertificate).WithServerEndpoints(serverEndpoints...).WithServerSoftwareCertificates(serverSoftwareCertificates...).WithServerSignature(serverSignature).WithMaxRequestMessageSize(maxRequestMessageSize) } -func (b *_CreateSessionResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CreateSessionResponseBuilder { +func (b *_CreateSessionResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CreateSessionResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CreateSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSessionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateSessionResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -299,40 +287,30 @@ func (b *_CreateSessionResponseBuilder) WithServerCertificateBuilder(builderSupp return b } -func (b *_CreateSessionResponseBuilder) WithNoOfServerEndpoints(noOfServerEndpoints int32) CreateSessionResponseBuilder { - b.NoOfServerEndpoints = noOfServerEndpoints - return b -} - -func (b *_CreateSessionResponseBuilder) WithServerEndpoints(serverEndpoints ...ExtensionObjectDefinition) CreateSessionResponseBuilder { +func (b *_CreateSessionResponseBuilder) WithServerEndpoints(serverEndpoints ...EndpointDescription) CreateSessionResponseBuilder { b.ServerEndpoints = serverEndpoints return b } -func (b *_CreateSessionResponseBuilder) WithNoOfServerSoftwareCertificates(noOfServerSoftwareCertificates int32) CreateSessionResponseBuilder { - b.NoOfServerSoftwareCertificates = noOfServerSoftwareCertificates - return b -} - -func (b *_CreateSessionResponseBuilder) WithServerSoftwareCertificates(serverSoftwareCertificates ...ExtensionObjectDefinition) CreateSessionResponseBuilder { +func (b *_CreateSessionResponseBuilder) WithServerSoftwareCertificates(serverSoftwareCertificates ...SignedSoftwareCertificate) CreateSessionResponseBuilder { b.ServerSoftwareCertificates = serverSoftwareCertificates return b } -func (b *_CreateSessionResponseBuilder) WithServerSignature(serverSignature ExtensionObjectDefinition) CreateSessionResponseBuilder { +func (b *_CreateSessionResponseBuilder) WithServerSignature(serverSignature SignatureData) CreateSessionResponseBuilder { b.ServerSignature = serverSignature return b } -func (b *_CreateSessionResponseBuilder) WithServerSignatureBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSessionResponseBuilder { - builder := builderSupplier(b.ServerSignature.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSessionResponseBuilder) WithServerSignatureBuilder(builderSupplier func(SignatureDataBuilder) SignatureDataBuilder) CreateSessionResponseBuilder { + builder := builderSupplier(b.ServerSignature.CreateSignatureDataBuilder()) var err error b.ServerSignature, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "SignatureDataBuilder failed")) } return b } @@ -428,8 +406,8 @@ func (b *_CreateSessionResponse) CreateCreateSessionResponseBuilder() CreateSess /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateSessionResponse) GetIdentifier() string { - return "464" +func (m *_CreateSessionResponse) GetExtensionId() int32 { + return int32(464) } /////////////////////// @@ -446,7 +424,7 @@ func (m *_CreateSessionResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateSessionResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CreateSessionResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -470,23 +448,15 @@ func (m *_CreateSessionResponse) GetServerCertificate() PascalByteString { return m.ServerCertificate } -func (m *_CreateSessionResponse) GetNoOfServerEndpoints() int32 { - return m.NoOfServerEndpoints -} - -func (m *_CreateSessionResponse) GetServerEndpoints() []ExtensionObjectDefinition { +func (m *_CreateSessionResponse) GetServerEndpoints() []EndpointDescription { return m.ServerEndpoints } -func (m *_CreateSessionResponse) GetNoOfServerSoftwareCertificates() int32 { - return m.NoOfServerSoftwareCertificates -} - -func (m *_CreateSessionResponse) GetServerSoftwareCertificates() []ExtensionObjectDefinition { +func (m *_CreateSessionResponse) GetServerSoftwareCertificates() []SignedSoftwareCertificate { return m.ServerSoftwareCertificates } -func (m *_CreateSessionResponse) GetServerSignature() ExtensionObjectDefinition { +func (m *_CreateSessionResponse) GetServerSignature() SignatureData { return m.ServerSignature } @@ -535,7 +505,7 @@ func (m *_CreateSessionResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (serverCertificate) lengthInBits += m.ServerCertificate.GetLengthInBits(ctx) - // Simple field (noOfServerEndpoints) + // Implicit Field (noOfServerEndpoints) lengthInBits += 32 // Array field @@ -548,7 +518,7 @@ func (m *_CreateSessionResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfServerSoftwareCertificates) + // Implicit Field (noOfServerSoftwareCertificates) lengthInBits += 32 // Array field @@ -574,7 +544,7 @@ func (m *_CreateSessionResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createSessionResponse CreateSessionResponse, err error) { +func (m *_CreateSessionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createSessionResponse CreateSessionResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -585,7 +555,7 @@ func (m *_CreateSessionResponse) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -621,31 +591,31 @@ func (m *_CreateSessionResponse) parse(ctx context.Context, readBuffer utils.Rea } m.ServerCertificate = serverCertificate - noOfServerEndpoints, err := ReadSimpleField(ctx, "noOfServerEndpoints", ReadSignedInt(readBuffer, uint8(32))) + noOfServerEndpoints, err := ReadImplicitField[int32](ctx, "noOfServerEndpoints", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerEndpoints' field")) } - m.NoOfServerEndpoints = noOfServerEndpoints + _ = noOfServerEndpoints - serverEndpoints, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "serverEndpoints", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("314")), readBuffer), uint64(noOfServerEndpoints)) + serverEndpoints, err := ReadCountArrayField[EndpointDescription](ctx, "serverEndpoints", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfServerEndpoints)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'serverEndpoints' field")) } m.ServerEndpoints = serverEndpoints - noOfServerSoftwareCertificates, err := ReadSimpleField(ctx, "noOfServerSoftwareCertificates", ReadSignedInt(readBuffer, uint8(32))) + noOfServerSoftwareCertificates, err := ReadImplicitField[int32](ctx, "noOfServerSoftwareCertificates", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerSoftwareCertificates' field")) } - m.NoOfServerSoftwareCertificates = noOfServerSoftwareCertificates + _ = noOfServerSoftwareCertificates - serverSoftwareCertificates, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "serverSoftwareCertificates", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("346")), readBuffer), uint64(noOfServerSoftwareCertificates)) + serverSoftwareCertificates, err := ReadCountArrayField[SignedSoftwareCertificate](ctx, "serverSoftwareCertificates", ReadComplex[SignedSoftwareCertificate](ExtensionObjectDefinitionParseWithBufferProducer[SignedSoftwareCertificate]((int32)(int32(346))), readBuffer), uint64(noOfServerSoftwareCertificates)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'serverSoftwareCertificates' field")) } m.ServerSoftwareCertificates = serverSoftwareCertificates - serverSignature, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "serverSignature", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("458")), readBuffer)) + serverSignature, err := ReadSimpleField[SignatureData](ctx, "serverSignature", ReadComplex[SignatureData](ExtensionObjectDefinitionParseWithBufferProducer[SignatureData]((int32)(int32(458))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'serverSignature' field")) } @@ -682,7 +652,7 @@ func (m *_CreateSessionResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for CreateSessionResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -705,16 +675,16 @@ func (m *_CreateSessionResponse) SerializeWithWriteBuffer(ctx context.Context, w if err := WriteSimpleField[PascalByteString](ctx, "serverCertificate", m.GetServerCertificate(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'serverCertificate' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerEndpoints", m.GetNoOfServerEndpoints(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerEndpoints := int32(utils.InlineIf(bool((m.GetServerEndpoints()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerEndpoints()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerEndpoints", noOfServerEndpoints, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerEndpoints' field") } if err := WriteComplexTypeArrayField(ctx, "serverEndpoints", m.GetServerEndpoints(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'serverEndpoints' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerSoftwareCertificates", m.GetNoOfServerSoftwareCertificates(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerSoftwareCertificates := int32(utils.InlineIf(bool((m.GetServerSoftwareCertificates()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerSoftwareCertificates()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerSoftwareCertificates", noOfServerSoftwareCertificates, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerSoftwareCertificates' field") } @@ -722,7 +692,7 @@ func (m *_CreateSessionResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(err, "Error serializing 'serverSoftwareCertificates' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "serverSignature", m.GetServerSignature(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[SignatureData](ctx, "serverSignature", m.GetServerSignature(), WriteComplex[SignatureData](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'serverSignature' field") } @@ -750,17 +720,15 @@ func (m *_CreateSessionResponse) deepCopy() *_CreateSessionResponse { } _CreateSessionResponseCopy := &_CreateSessionResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.SessionId.DeepCopy().(NodeId), m.AuthenticationToken.DeepCopy().(NodeId), m.RevisedSessionTimeout, m.ServerNonce.DeepCopy().(PascalByteString), m.ServerCertificate.DeepCopy().(PascalByteString), - m.NoOfServerEndpoints, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ServerEndpoints), - m.NoOfServerSoftwareCertificates, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ServerSoftwareCertificates), - m.ServerSignature.DeepCopy().(ExtensionObjectDefinition), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.ServerEndpoints), + utils.DeepCopySlice[SignedSoftwareCertificate, SignedSoftwareCertificate](m.ServerSoftwareCertificates), + m.ServerSignature.DeepCopy().(SignatureData), m.MaxRequestMessageSize, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionRequest.go b/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionRequest.go index abb35ba1491..f5fa7330c32 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionRequest.go @@ -41,7 +41,7 @@ type CreateSubscriptionRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetRequestedPublishingInterval returns RequestedPublishingInterval (property field) GetRequestedPublishingInterval() float64 // GetRequestedLifetimeCount returns RequestedLifetimeCount (property field) @@ -63,7 +63,7 @@ type CreateSubscriptionRequest interface { // _CreateSubscriptionRequest is the data-structure of this message type _CreateSubscriptionRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader RequestedPublishingInterval float64 RequestedLifetimeCount uint32 RequestedMaxKeepAliveCount uint32 @@ -78,9 +78,9 @@ var _ CreateSubscriptionRequest = (*_CreateSubscriptionRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateSubscriptionRequest)(nil) // NewCreateSubscriptionRequest factory function for _CreateSubscriptionRequest -func NewCreateSubscriptionRequest(requestHeader ExtensionObjectDefinition, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) *_CreateSubscriptionRequest { +func NewCreateSubscriptionRequest(requestHeader RequestHeader, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) *_CreateSubscriptionRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for CreateSubscriptionRequest must not be nil") + panic("requestHeader of type RequestHeader for CreateSubscriptionRequest must not be nil") } _result := &_CreateSubscriptionRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -105,11 +105,11 @@ func NewCreateSubscriptionRequest(requestHeader ExtensionObjectDefinition, reque type CreateSubscriptionRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) CreateSubscriptionRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) CreateSubscriptionRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) CreateSubscriptionRequestBuilder + WithRequestHeader(RequestHeader) CreateSubscriptionRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSubscriptionRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) CreateSubscriptionRequestBuilder // WithRequestedPublishingInterval adds RequestedPublishingInterval (property field) WithRequestedPublishingInterval(float64) CreateSubscriptionRequestBuilder // WithRequestedLifetimeCount adds RequestedLifetimeCount (property field) @@ -147,24 +147,24 @@ func (b *_CreateSubscriptionRequestBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateSubscriptionRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) CreateSubscriptionRequestBuilder { +func (b *_CreateSubscriptionRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, publishingEnabled bool, priority uint8) CreateSubscriptionRequestBuilder { return b.WithRequestHeader(requestHeader).WithRequestedPublishingInterval(requestedPublishingInterval).WithRequestedLifetimeCount(requestedLifetimeCount).WithRequestedMaxKeepAliveCount(requestedMaxKeepAliveCount).WithMaxNotificationsPerPublish(maxNotificationsPerPublish).WithPublishingEnabled(publishingEnabled).WithPriority(priority) } -func (b *_CreateSubscriptionRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) CreateSubscriptionRequestBuilder { +func (b *_CreateSubscriptionRequestBuilder) WithRequestHeader(requestHeader RequestHeader) CreateSubscriptionRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_CreateSubscriptionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSubscriptionRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSubscriptionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) CreateSubscriptionRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -255,8 +255,8 @@ func (b *_CreateSubscriptionRequest) CreateCreateSubscriptionRequestBuilder() Cr /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateSubscriptionRequest) GetIdentifier() string { - return "787" +func (m *_CreateSubscriptionRequest) GetExtensionId() int32 { + return int32(787) } /////////////////////// @@ -273,7 +273,7 @@ func (m *_CreateSubscriptionRequest) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateSubscriptionRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_CreateSubscriptionRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -355,7 +355,7 @@ func (m *_CreateSubscriptionRequest) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateSubscriptionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createSubscriptionRequest CreateSubscriptionRequest, err error) { +func (m *_CreateSubscriptionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createSubscriptionRequest CreateSubscriptionRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -366,7 +366,7 @@ func (m *_CreateSubscriptionRequest) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -439,7 +439,7 @@ func (m *_CreateSubscriptionRequest) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for CreateSubscriptionRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -491,7 +491,7 @@ func (m *_CreateSubscriptionRequest) deepCopy() *_CreateSubscriptionRequest { } _CreateSubscriptionRequestCopy := &_CreateSubscriptionRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.RequestedPublishingInterval, m.RequestedLifetimeCount, m.RequestedMaxKeepAliveCount, diff --git a/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionResponse.go b/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionResponse.go index cc69199ceaf..b87b02b46f8 100644 --- a/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/CreateSubscriptionResponse.go @@ -41,7 +41,7 @@ type CreateSubscriptionResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetRevisedPublishingInterval returns RevisedPublishingInterval (property field) @@ -59,7 +59,7 @@ type CreateSubscriptionResponse interface { // _CreateSubscriptionResponse is the data-structure of this message type _CreateSubscriptionResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader SubscriptionId uint32 RevisedPublishingInterval float64 RevisedLifetimeCount uint32 @@ -70,9 +70,9 @@ var _ CreateSubscriptionResponse = (*_CreateSubscriptionResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_CreateSubscriptionResponse)(nil) // NewCreateSubscriptionResponse factory function for _CreateSubscriptionResponse -func NewCreateSubscriptionResponse(responseHeader ExtensionObjectDefinition, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) *_CreateSubscriptionResponse { +func NewCreateSubscriptionResponse(responseHeader ResponseHeader, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) *_CreateSubscriptionResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for CreateSubscriptionResponse must not be nil") + panic("responseHeader of type ResponseHeader for CreateSubscriptionResponse must not be nil") } _result := &_CreateSubscriptionResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -95,11 +95,11 @@ func NewCreateSubscriptionResponse(responseHeader ExtensionObjectDefinition, sub type CreateSubscriptionResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) CreateSubscriptionResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) CreateSubscriptionResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) CreateSubscriptionResponseBuilder + WithResponseHeader(ResponseHeader) CreateSubscriptionResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSubscriptionResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateSubscriptionResponseBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) CreateSubscriptionResponseBuilder // WithRevisedPublishingInterval adds RevisedPublishingInterval (property field) @@ -133,24 +133,24 @@ func (b *_CreateSubscriptionResponseBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_CreateSubscriptionResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) CreateSubscriptionResponseBuilder { +func (b *_CreateSubscriptionResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, subscriptionId uint32, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) CreateSubscriptionResponseBuilder { return b.WithResponseHeader(responseHeader).WithSubscriptionId(subscriptionId).WithRevisedPublishingInterval(revisedPublishingInterval).WithRevisedLifetimeCount(revisedLifetimeCount).WithRevisedMaxKeepAliveCount(revisedMaxKeepAliveCount) } -func (b *_CreateSubscriptionResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) CreateSubscriptionResponseBuilder { +func (b *_CreateSubscriptionResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) CreateSubscriptionResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_CreateSubscriptionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) CreateSubscriptionResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_CreateSubscriptionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) CreateSubscriptionResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -231,8 +231,8 @@ func (b *_CreateSubscriptionResponse) CreateCreateSubscriptionResponseBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CreateSubscriptionResponse) GetIdentifier() string { - return "790" +func (m *_CreateSubscriptionResponse) GetExtensionId() int32 { + return int32(790) } /////////////////////// @@ -249,7 +249,7 @@ func (m *_CreateSubscriptionResponse) GetParent() ExtensionObjectDefinitionContr /////////////////////// Accessors for property fields. /////////////////////// -func (m *_CreateSubscriptionResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_CreateSubscriptionResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -314,7 +314,7 @@ func (m *_CreateSubscriptionResponse) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_CreateSubscriptionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__createSubscriptionResponse CreateSubscriptionResponse, err error) { +func (m *_CreateSubscriptionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__createSubscriptionResponse CreateSubscriptionResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -325,7 +325,7 @@ func (m *_CreateSubscriptionResponse) parse(ctx context.Context, readBuffer util currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -380,7 +380,7 @@ func (m *_CreateSubscriptionResponse) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(pushErr, "Error pushing for CreateSubscriptionResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -420,7 +420,7 @@ func (m *_CreateSubscriptionResponse) deepCopy() *_CreateSubscriptionResponse { } _CreateSubscriptionResponseCopy := &_CreateSubscriptionResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.SubscriptionId, m.RevisedPublishingInterval, m.RevisedLifetimeCount, diff --git a/plc4go/protocols/opcua/readwrite/model/CurrencyUnitType.go b/plc4go/protocols/opcua/readwrite/model/CurrencyUnitType.go index 029ab7e44a7..dd17c7f0660 100644 --- a/plc4go/protocols/opcua/readwrite/model/CurrencyUnitType.go +++ b/plc4go/protocols/opcua/readwrite/model/CurrencyUnitType.go @@ -244,8 +244,8 @@ func (b *_CurrencyUnitType) CreateCurrencyUnitTypeBuilder() CurrencyUnitTypeBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_CurrencyUnitType) GetIdentifier() string { - return "23500" +func (m *_CurrencyUnitType) GetExtensionId() int32 { + return int32(23500) } /////////////////////// @@ -320,7 +320,7 @@ func (m *_CurrencyUnitType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_CurrencyUnitType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__currencyUnitType CurrencyUnitType, err error) { +func (m *_CurrencyUnitType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__currencyUnitType CurrencyUnitType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataChangeFilter.go b/plc4go/protocols/opcua/readwrite/model/DataChangeFilter.go new file mode 100644 index 00000000000..08ea156c1f5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DataChangeFilter.go @@ -0,0 +1,364 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DataChangeFilter is the corresponding interface of DataChangeFilter +type DataChangeFilter interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetTrigger returns Trigger (property field) + GetTrigger() DataChangeTrigger + // GetDeadbandType returns DeadbandType (property field) + GetDeadbandType() uint32 + // GetDeadbandValue returns DeadbandValue (property field) + GetDeadbandValue() float64 + // IsDataChangeFilter is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDataChangeFilter() + // CreateBuilder creates a DataChangeFilterBuilder + CreateDataChangeFilterBuilder() DataChangeFilterBuilder +} + +// _DataChangeFilter is the data-structure of this message +type _DataChangeFilter struct { + ExtensionObjectDefinitionContract + Trigger DataChangeTrigger + DeadbandType uint32 + DeadbandValue float64 +} + +var _ DataChangeFilter = (*_DataChangeFilter)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DataChangeFilter)(nil) + +// NewDataChangeFilter factory function for _DataChangeFilter +func NewDataChangeFilter(trigger DataChangeTrigger, deadbandType uint32, deadbandValue float64) *_DataChangeFilter { + _result := &_DataChangeFilter{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Trigger: trigger, + DeadbandType: deadbandType, + DeadbandValue: deadbandValue, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DataChangeFilterBuilder is a builder for DataChangeFilter +type DataChangeFilterBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(trigger DataChangeTrigger, deadbandType uint32, deadbandValue float64) DataChangeFilterBuilder + // WithTrigger adds Trigger (property field) + WithTrigger(DataChangeTrigger) DataChangeFilterBuilder + // WithDeadbandType adds DeadbandType (property field) + WithDeadbandType(uint32) DataChangeFilterBuilder + // WithDeadbandValue adds DeadbandValue (property field) + WithDeadbandValue(float64) DataChangeFilterBuilder + // Build builds the DataChangeFilter or returns an error if something is wrong + Build() (DataChangeFilter, error) + // MustBuild does the same as Build but panics on error + MustBuild() DataChangeFilter +} + +// NewDataChangeFilterBuilder() creates a DataChangeFilterBuilder +func NewDataChangeFilterBuilder() DataChangeFilterBuilder { + return &_DataChangeFilterBuilder{_DataChangeFilter: new(_DataChangeFilter)} +} + +type _DataChangeFilterBuilder struct { + *_DataChangeFilter + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DataChangeFilterBuilder) = (*_DataChangeFilterBuilder)(nil) + +func (b *_DataChangeFilterBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DataChangeFilterBuilder) WithMandatoryFields(trigger DataChangeTrigger, deadbandType uint32, deadbandValue float64) DataChangeFilterBuilder { + return b.WithTrigger(trigger).WithDeadbandType(deadbandType).WithDeadbandValue(deadbandValue) +} + +func (b *_DataChangeFilterBuilder) WithTrigger(trigger DataChangeTrigger) DataChangeFilterBuilder { + b.Trigger = trigger + return b +} + +func (b *_DataChangeFilterBuilder) WithDeadbandType(deadbandType uint32) DataChangeFilterBuilder { + b.DeadbandType = deadbandType + return b +} + +func (b *_DataChangeFilterBuilder) WithDeadbandValue(deadbandValue float64) DataChangeFilterBuilder { + b.DeadbandValue = deadbandValue + return b +} + +func (b *_DataChangeFilterBuilder) Build() (DataChangeFilter, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DataChangeFilter.deepCopy(), nil +} + +func (b *_DataChangeFilterBuilder) MustBuild() DataChangeFilter { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DataChangeFilterBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DataChangeFilterBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DataChangeFilterBuilder) DeepCopy() any { + _copy := b.CreateDataChangeFilterBuilder().(*_DataChangeFilterBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDataChangeFilterBuilder creates a DataChangeFilterBuilder +func (b *_DataChangeFilter) CreateDataChangeFilterBuilder() DataChangeFilterBuilder { + if b == nil { + return NewDataChangeFilterBuilder() + } + return &_DataChangeFilterBuilder{_DataChangeFilter: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DataChangeFilter) GetExtensionId() int32 { + return int32(724) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DataChangeFilter) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DataChangeFilter) GetTrigger() DataChangeTrigger { + return m.Trigger +} + +func (m *_DataChangeFilter) GetDeadbandType() uint32 { + return m.DeadbandType +} + +func (m *_DataChangeFilter) GetDeadbandValue() float64 { + return m.DeadbandValue +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDataChangeFilter(structType any) DataChangeFilter { + if casted, ok := structType.(DataChangeFilter); ok { + return casted + } + if casted, ok := structType.(*DataChangeFilter); ok { + return *casted + } + return nil +} + +func (m *_DataChangeFilter) GetTypeName() string { + return "DataChangeFilter" +} + +func (m *_DataChangeFilter) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (trigger) + lengthInBits += 32 + + // Simple field (deadbandType) + lengthInBits += 32 + + // Simple field (deadbandValue) + lengthInBits += 64 + + return lengthInBits +} + +func (m *_DataChangeFilter) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DataChangeFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataChangeFilter DataChangeFilter, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DataChangeFilter"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DataChangeFilter") + } + currentPos := positionAware.GetPos() + _ = currentPos + + trigger, err := ReadEnumField[DataChangeTrigger](ctx, "trigger", "DataChangeTrigger", ReadEnum(DataChangeTriggerByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'trigger' field")) + } + m.Trigger = trigger + + deadbandType, err := ReadSimpleField(ctx, "deadbandType", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deadbandType' field")) + } + m.DeadbandType = deadbandType + + deadbandValue, err := ReadSimpleField(ctx, "deadbandValue", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deadbandValue' field")) + } + m.DeadbandValue = deadbandValue + + if closeErr := readBuffer.CloseContext("DataChangeFilter"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DataChangeFilter") + } + + return m, nil +} + +func (m *_DataChangeFilter) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DataChangeFilter) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DataChangeFilter"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DataChangeFilter") + } + + if err := WriteSimpleEnumField[DataChangeTrigger](ctx, "trigger", "DataChangeTrigger", m.GetTrigger(), WriteEnum[DataChangeTrigger, uint32](DataChangeTrigger.GetValue, DataChangeTrigger.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'trigger' field") + } + + if err := WriteSimpleField[uint32](ctx, "deadbandType", m.GetDeadbandType(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'deadbandType' field") + } + + if err := WriteSimpleField[float64](ctx, "deadbandValue", m.GetDeadbandValue(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'deadbandValue' field") + } + + if popErr := writeBuffer.PopContext("DataChangeFilter"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DataChangeFilter") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DataChangeFilter) IsDataChangeFilter() {} + +func (m *_DataChangeFilter) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DataChangeFilter) deepCopy() *_DataChangeFilter { + if m == nil { + return nil + } + _DataChangeFilterCopy := &_DataChangeFilter{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Trigger, + m.DeadbandType, + m.DeadbandValue, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DataChangeFilterCopy +} + +func (m *_DataChangeFilter) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DataChangeNotification.go b/plc4go/protocols/opcua/readwrite/model/DataChangeNotification.go index 925c4bad587..22f9c6159b5 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataChangeNotification.go +++ b/plc4go/protocols/opcua/readwrite/model/DataChangeNotification.go @@ -40,12 +40,8 @@ type DataChangeNotification interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfMonitoredItems returns NoOfMonitoredItems (property field) - GetNoOfMonitoredItems() int32 // GetMonitoredItems returns MonitoredItems (property field) - GetMonitoredItems() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetMonitoredItems() []MonitoredItemNotification // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsDataChangeNotification is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,22 +53,18 @@ type DataChangeNotification interface { // _DataChangeNotification is the data-structure of this message type _DataChangeNotification struct { ExtensionObjectDefinitionContract - NoOfMonitoredItems int32 - MonitoredItems []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + MonitoredItems []MonitoredItemNotification + DiagnosticInfos []DiagnosticInfo } var _ DataChangeNotification = (*_DataChangeNotification)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DataChangeNotification)(nil) // NewDataChangeNotification factory function for _DataChangeNotification -func NewDataChangeNotification(noOfMonitoredItems int32, monitoredItems []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_DataChangeNotification { +func NewDataChangeNotification(monitoredItems []MonitoredItemNotification, diagnosticInfos []DiagnosticInfo) *_DataChangeNotification { _result := &_DataChangeNotification{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfMonitoredItems: noOfMonitoredItems, MonitoredItems: monitoredItems, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -88,13 +80,9 @@ func NewDataChangeNotification(noOfMonitoredItems int32, monitoredItems []Extens type DataChangeNotificationBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfMonitoredItems int32, monitoredItems []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DataChangeNotificationBuilder - // WithNoOfMonitoredItems adds NoOfMonitoredItems (property field) - WithNoOfMonitoredItems(int32) DataChangeNotificationBuilder + WithMandatoryFields(monitoredItems []MonitoredItemNotification, diagnosticInfos []DiagnosticInfo) DataChangeNotificationBuilder // WithMonitoredItems adds MonitoredItems (property field) - WithMonitoredItems(...ExtensionObjectDefinition) DataChangeNotificationBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) DataChangeNotificationBuilder + WithMonitoredItems(...MonitoredItemNotification) DataChangeNotificationBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) DataChangeNotificationBuilder // Build builds the DataChangeNotification or returns an error if something is wrong @@ -122,25 +110,15 @@ func (b *_DataChangeNotificationBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_DataChangeNotificationBuilder) WithMandatoryFields(noOfMonitoredItems int32, monitoredItems []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DataChangeNotificationBuilder { - return b.WithNoOfMonitoredItems(noOfMonitoredItems).WithMonitoredItems(monitoredItems...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_DataChangeNotificationBuilder) WithMandatoryFields(monitoredItems []MonitoredItemNotification, diagnosticInfos []DiagnosticInfo) DataChangeNotificationBuilder { + return b.WithMonitoredItems(monitoredItems...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_DataChangeNotificationBuilder) WithNoOfMonitoredItems(noOfMonitoredItems int32) DataChangeNotificationBuilder { - b.NoOfMonitoredItems = noOfMonitoredItems - return b -} - -func (b *_DataChangeNotificationBuilder) WithMonitoredItems(monitoredItems ...ExtensionObjectDefinition) DataChangeNotificationBuilder { +func (b *_DataChangeNotificationBuilder) WithMonitoredItems(monitoredItems ...MonitoredItemNotification) DataChangeNotificationBuilder { b.MonitoredItems = monitoredItems return b } -func (b *_DataChangeNotificationBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) DataChangeNotificationBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_DataChangeNotificationBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) DataChangeNotificationBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -196,8 +174,8 @@ func (b *_DataChangeNotification) CreateDataChangeNotificationBuilder() DataChan /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataChangeNotification) GetIdentifier() string { - return "811" +func (m *_DataChangeNotification) GetExtensionId() int32 { + return int32(811) } /////////////////////// @@ -214,18 +192,10 @@ func (m *_DataChangeNotification) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DataChangeNotification) GetNoOfMonitoredItems() int32 { - return m.NoOfMonitoredItems -} - -func (m *_DataChangeNotification) GetMonitoredItems() []ExtensionObjectDefinition { +func (m *_DataChangeNotification) GetMonitoredItems() []MonitoredItemNotification { return m.MonitoredItems } -func (m *_DataChangeNotification) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_DataChangeNotification) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -253,10 +223,7 @@ func (m *_DataChangeNotification) GetTypeName() string { func (m *_DataChangeNotification) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Implicit Field (notificationLength) - lengthInBits += 32 - - // Simple field (noOfMonitoredItems) + // Implicit Field (noOfMonitoredItems) lengthInBits += 32 // Array field @@ -269,7 +236,7 @@ func (m *_DataChangeNotification) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -289,7 +256,7 @@ func (m *_DataChangeNotification) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DataChangeNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataChangeNotification DataChangeNotification, err error) { +func (m *_DataChangeNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataChangeNotification DataChangeNotification, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -300,29 +267,23 @@ func (m *_DataChangeNotification) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos - notificationLength, err := ReadImplicitField[int32](ctx, "notificationLength", ReadSignedInt(readBuffer, uint8(32))) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationLength' field")) - } - _ = notificationLength - - noOfMonitoredItems, err := ReadSimpleField(ctx, "noOfMonitoredItems", ReadSignedInt(readBuffer, uint8(32))) + noOfMonitoredItems, err := ReadImplicitField[int32](ctx, "noOfMonitoredItems", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfMonitoredItems' field")) } - m.NoOfMonitoredItems = noOfMonitoredItems + _ = noOfMonitoredItems - monitoredItems, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "monitoredItems", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("808")), readBuffer), uint64(noOfMonitoredItems)) + monitoredItems, err := ReadCountArrayField[MonitoredItemNotification](ctx, "monitoredItems", ReadComplex[MonitoredItemNotification](ExtensionObjectDefinitionParseWithBufferProducer[MonitoredItemNotification]((int32)(int32(808))), readBuffer), uint64(noOfMonitoredItems)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'monitoredItems' field")) } m.MonitoredItems = monitoredItems - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -354,20 +315,16 @@ func (m *_DataChangeNotification) SerializeWithWriteBuffer(ctx context.Context, if pushErr := writeBuffer.PushContext("DataChangeNotification"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for DataChangeNotification") } - notificationLength := int32(int32(m.GetLengthInBytes(ctx))) - if err := WriteImplicitField(ctx, "notificationLength", notificationLength, WriteSignedInt(writeBuffer, 32)); err != nil { - return errors.Wrap(err, "Error serializing 'notificationLength' field") - } - - if err := WriteSimpleField[int32](ctx, "noOfMonitoredItems", m.GetNoOfMonitoredItems(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfMonitoredItems := int32(utils.InlineIf(bool((m.GetMonitoredItems()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetMonitoredItems()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfMonitoredItems", noOfMonitoredItems, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfMonitoredItems' field") } if err := WriteComplexTypeArrayField(ctx, "monitoredItems", m.GetMonitoredItems(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'monitoredItems' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -395,9 +352,7 @@ func (m *_DataChangeNotification) deepCopy() *_DataChangeNotification { } _DataChangeNotificationCopy := &_DataChangeNotification{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfMonitoredItems, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.MonitoredItems), - m.NoOfDiagnosticInfos, + utils.DeepCopySlice[MonitoredItemNotification, MonitoredItemNotification](m.MonitoredItems), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetMetaDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetMetaDataType.go new file mode 100644 index 00000000000..96a449a3e44 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DataSetMetaDataType.go @@ -0,0 +1,734 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DataSetMetaDataType is the corresponding interface of DataSetMetaDataType +type DataSetMetaDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNamespaces returns Namespaces (property field) + GetNamespaces() []PascalString + // GetStructureDataTypes returns StructureDataTypes (property field) + GetStructureDataTypes() []StructureDescription + // GetEnumDataTypes returns EnumDataTypes (property field) + GetEnumDataTypes() []EnumDescription + // GetSimpleDataTypes returns SimpleDataTypes (property field) + GetSimpleDataTypes() []SimpleTypeDescription + // GetName returns Name (property field) + GetName() PascalString + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetFields returns Fields (property field) + GetFields() []FieldMetaData + // GetDataSetClassId returns DataSetClassId (property field) + GetDataSetClassId() GuidValue + // GetConfigurationVersion returns ConfigurationVersion (property field) + GetConfigurationVersion() ConfigurationVersionDataType + // IsDataSetMetaDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDataSetMetaDataType() + // CreateBuilder creates a DataSetMetaDataTypeBuilder + CreateDataSetMetaDataTypeBuilder() DataSetMetaDataTypeBuilder +} + +// _DataSetMetaDataType is the data-structure of this message +type _DataSetMetaDataType struct { + ExtensionObjectDefinitionContract + Namespaces []PascalString + StructureDataTypes []StructureDescription + EnumDataTypes []EnumDescription + SimpleDataTypes []SimpleTypeDescription + Name PascalString + Description LocalizedText + Fields []FieldMetaData + DataSetClassId GuidValue + ConfigurationVersion ConfigurationVersionDataType +} + +var _ DataSetMetaDataType = (*_DataSetMetaDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DataSetMetaDataType)(nil) + +// NewDataSetMetaDataType factory function for _DataSetMetaDataType +func NewDataSetMetaDataType(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, name PascalString, description LocalizedText, fields []FieldMetaData, dataSetClassId GuidValue, configurationVersion ConfigurationVersionDataType) *_DataSetMetaDataType { + if name == nil { + panic("name of type PascalString for DataSetMetaDataType must not be nil") + } + if description == nil { + panic("description of type LocalizedText for DataSetMetaDataType must not be nil") + } + if dataSetClassId == nil { + panic("dataSetClassId of type GuidValue for DataSetMetaDataType must not be nil") + } + if configurationVersion == nil { + panic("configurationVersion of type ConfigurationVersionDataType for DataSetMetaDataType must not be nil") + } + _result := &_DataSetMetaDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Namespaces: namespaces, + StructureDataTypes: structureDataTypes, + EnumDataTypes: enumDataTypes, + SimpleDataTypes: simpleDataTypes, + Name: name, + Description: description, + Fields: fields, + DataSetClassId: dataSetClassId, + ConfigurationVersion: configurationVersion, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DataSetMetaDataTypeBuilder is a builder for DataSetMetaDataType +type DataSetMetaDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, name PascalString, description LocalizedText, fields []FieldMetaData, dataSetClassId GuidValue, configurationVersion ConfigurationVersionDataType) DataSetMetaDataTypeBuilder + // WithNamespaces adds Namespaces (property field) + WithNamespaces(...PascalString) DataSetMetaDataTypeBuilder + // WithStructureDataTypes adds StructureDataTypes (property field) + WithStructureDataTypes(...StructureDescription) DataSetMetaDataTypeBuilder + // WithEnumDataTypes adds EnumDataTypes (property field) + WithEnumDataTypes(...EnumDescription) DataSetMetaDataTypeBuilder + // WithSimpleDataTypes adds SimpleDataTypes (property field) + WithSimpleDataTypes(...SimpleTypeDescription) DataSetMetaDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) DataSetMetaDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) DataSetMetaDataTypeBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) DataSetMetaDataTypeBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) DataSetMetaDataTypeBuilder + // WithFields adds Fields (property field) + WithFields(...FieldMetaData) DataSetMetaDataTypeBuilder + // WithDataSetClassId adds DataSetClassId (property field) + WithDataSetClassId(GuidValue) DataSetMetaDataTypeBuilder + // WithDataSetClassIdBuilder adds DataSetClassId (property field) which is build by the builder + WithDataSetClassIdBuilder(func(GuidValueBuilder) GuidValueBuilder) DataSetMetaDataTypeBuilder + // WithConfigurationVersion adds ConfigurationVersion (property field) + WithConfigurationVersion(ConfigurationVersionDataType) DataSetMetaDataTypeBuilder + // WithConfigurationVersionBuilder adds ConfigurationVersion (property field) which is build by the builder + WithConfigurationVersionBuilder(func(ConfigurationVersionDataTypeBuilder) ConfigurationVersionDataTypeBuilder) DataSetMetaDataTypeBuilder + // Build builds the DataSetMetaDataType or returns an error if something is wrong + Build() (DataSetMetaDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DataSetMetaDataType +} + +// NewDataSetMetaDataTypeBuilder() creates a DataSetMetaDataTypeBuilder +func NewDataSetMetaDataTypeBuilder() DataSetMetaDataTypeBuilder { + return &_DataSetMetaDataTypeBuilder{_DataSetMetaDataType: new(_DataSetMetaDataType)} +} + +type _DataSetMetaDataTypeBuilder struct { + *_DataSetMetaDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DataSetMetaDataTypeBuilder) = (*_DataSetMetaDataTypeBuilder)(nil) + +func (b *_DataSetMetaDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DataSetMetaDataTypeBuilder) WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, name PascalString, description LocalizedText, fields []FieldMetaData, dataSetClassId GuidValue, configurationVersion ConfigurationVersionDataType) DataSetMetaDataTypeBuilder { + return b.WithNamespaces(namespaces...).WithStructureDataTypes(structureDataTypes...).WithEnumDataTypes(enumDataTypes...).WithSimpleDataTypes(simpleDataTypes...).WithName(name).WithDescription(description).WithFields(fields...).WithDataSetClassId(dataSetClassId).WithConfigurationVersion(configurationVersion) +} + +func (b *_DataSetMetaDataTypeBuilder) WithNamespaces(namespaces ...PascalString) DataSetMetaDataTypeBuilder { + b.Namespaces = namespaces + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithStructureDataTypes(structureDataTypes ...StructureDescription) DataSetMetaDataTypeBuilder { + b.StructureDataTypes = structureDataTypes + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithEnumDataTypes(enumDataTypes ...EnumDescription) DataSetMetaDataTypeBuilder { + b.EnumDataTypes = enumDataTypes + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithSimpleDataTypes(simpleDataTypes ...SimpleTypeDescription) DataSetMetaDataTypeBuilder { + b.SimpleDataTypes = simpleDataTypes + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithName(name PascalString) DataSetMetaDataTypeBuilder { + b.Name = name + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DataSetMetaDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithDescription(description LocalizedText) DataSetMetaDataTypeBuilder { + b.Description = description + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) DataSetMetaDataTypeBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithFields(fields ...FieldMetaData) DataSetMetaDataTypeBuilder { + b.Fields = fields + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithDataSetClassId(dataSetClassId GuidValue) DataSetMetaDataTypeBuilder { + b.DataSetClassId = dataSetClassId + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithDataSetClassIdBuilder(builderSupplier func(GuidValueBuilder) GuidValueBuilder) DataSetMetaDataTypeBuilder { + builder := builderSupplier(b.DataSetClassId.CreateGuidValueBuilder()) + var err error + b.DataSetClassId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "GuidValueBuilder failed")) + } + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithConfigurationVersion(configurationVersion ConfigurationVersionDataType) DataSetMetaDataTypeBuilder { + b.ConfigurationVersion = configurationVersion + return b +} + +func (b *_DataSetMetaDataTypeBuilder) WithConfigurationVersionBuilder(builderSupplier func(ConfigurationVersionDataTypeBuilder) ConfigurationVersionDataTypeBuilder) DataSetMetaDataTypeBuilder { + builder := builderSupplier(b.ConfigurationVersion.CreateConfigurationVersionDataTypeBuilder()) + var err error + b.ConfigurationVersion, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ConfigurationVersionDataTypeBuilder failed")) + } + return b +} + +func (b *_DataSetMetaDataTypeBuilder) Build() (DataSetMetaDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.DataSetClassId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetClassId' not set")) + } + if b.ConfigurationVersion == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'configurationVersion' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DataSetMetaDataType.deepCopy(), nil +} + +func (b *_DataSetMetaDataTypeBuilder) MustBuild() DataSetMetaDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DataSetMetaDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DataSetMetaDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DataSetMetaDataTypeBuilder) DeepCopy() any { + _copy := b.CreateDataSetMetaDataTypeBuilder().(*_DataSetMetaDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDataSetMetaDataTypeBuilder creates a DataSetMetaDataTypeBuilder +func (b *_DataSetMetaDataType) CreateDataSetMetaDataTypeBuilder() DataSetMetaDataTypeBuilder { + if b == nil { + return NewDataSetMetaDataTypeBuilder() + } + return &_DataSetMetaDataTypeBuilder{_DataSetMetaDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DataSetMetaDataType) GetExtensionId() int32 { + return int32(14525) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DataSetMetaDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DataSetMetaDataType) GetNamespaces() []PascalString { + return m.Namespaces +} + +func (m *_DataSetMetaDataType) GetStructureDataTypes() []StructureDescription { + return m.StructureDataTypes +} + +func (m *_DataSetMetaDataType) GetEnumDataTypes() []EnumDescription { + return m.EnumDataTypes +} + +func (m *_DataSetMetaDataType) GetSimpleDataTypes() []SimpleTypeDescription { + return m.SimpleDataTypes +} + +func (m *_DataSetMetaDataType) GetName() PascalString { + return m.Name +} + +func (m *_DataSetMetaDataType) GetDescription() LocalizedText { + return m.Description +} + +func (m *_DataSetMetaDataType) GetFields() []FieldMetaData { + return m.Fields +} + +func (m *_DataSetMetaDataType) GetDataSetClassId() GuidValue { + return m.DataSetClassId +} + +func (m *_DataSetMetaDataType) GetConfigurationVersion() ConfigurationVersionDataType { + return m.ConfigurationVersion +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDataSetMetaDataType(structType any) DataSetMetaDataType { + if casted, ok := structType.(DataSetMetaDataType); ok { + return casted + } + if casted, ok := structType.(*DataSetMetaDataType); ok { + return *casted + } + return nil +} + +func (m *_DataSetMetaDataType) GetTypeName() string { + return "DataSetMetaDataType" +} + +func (m *_DataSetMetaDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfNamespaces) + lengthInBits += 32 + + // Array field + if len(m.Namespaces) > 0 { + for _curItem, element := range m.Namespaces { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Namespaces), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfStructureDataTypes) + lengthInBits += 32 + + // Array field + if len(m.StructureDataTypes) > 0 { + for _curItem, element := range m.StructureDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.StructureDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfEnumDataTypes) + lengthInBits += 32 + + // Array field + if len(m.EnumDataTypes) > 0 { + for _curItem, element := range m.EnumDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.EnumDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfSimpleDataTypes) + lengthInBits += 32 + + // Array field + if len(m.SimpleDataTypes) > 0 { + for _curItem, element := range m.SimpleDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SimpleDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Implicit Field (noOfFields) + lengthInBits += 32 + + // Array field + if len(m.Fields) > 0 { + for _curItem, element := range m.Fields { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Fields), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (dataSetClassId) + lengthInBits += m.DataSetClassId.GetLengthInBits(ctx) + + // Simple field (configurationVersion) + lengthInBits += m.ConfigurationVersion.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_DataSetMetaDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DataSetMetaDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetMetaDataType DataSetMetaDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DataSetMetaDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DataSetMetaDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfNamespaces, err := ReadImplicitField[int32](ctx, "noOfNamespaces", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNamespaces' field")) + } + _ = noOfNamespaces + + namespaces, err := ReadCountArrayField[PascalString](ctx, "namespaces", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfNamespaces)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespaces' field")) + } + m.Namespaces = namespaces + + noOfStructureDataTypes, err := ReadImplicitField[int32](ctx, "noOfStructureDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfStructureDataTypes' field")) + } + _ = noOfStructureDataTypes + + structureDataTypes, err := ReadCountArrayField[StructureDescription](ctx, "structureDataTypes", ReadComplex[StructureDescription](ExtensionObjectDefinitionParseWithBufferProducer[StructureDescription]((int32)(int32(15489))), readBuffer), uint64(noOfStructureDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'structureDataTypes' field")) + } + m.StructureDataTypes = structureDataTypes + + noOfEnumDataTypes, err := ReadImplicitField[int32](ctx, "noOfEnumDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEnumDataTypes' field")) + } + _ = noOfEnumDataTypes + + enumDataTypes, err := ReadCountArrayField[EnumDescription](ctx, "enumDataTypes", ReadComplex[EnumDescription](ExtensionObjectDefinitionParseWithBufferProducer[EnumDescription]((int32)(int32(15490))), readBuffer), uint64(noOfEnumDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enumDataTypes' field")) + } + m.EnumDataTypes = enumDataTypes + + noOfSimpleDataTypes, err := ReadImplicitField[int32](ctx, "noOfSimpleDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSimpleDataTypes' field")) + } + _ = noOfSimpleDataTypes + + simpleDataTypes, err := ReadCountArrayField[SimpleTypeDescription](ctx, "simpleDataTypes", ReadComplex[SimpleTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[SimpleTypeDescription]((int32)(int32(15007))), readBuffer), uint64(noOfSimpleDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'simpleDataTypes' field")) + } + m.SimpleDataTypes = simpleDataTypes + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + noOfFields, err := ReadImplicitField[int32](ctx, "noOfFields", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfFields' field")) + } + _ = noOfFields + + fields, err := ReadCountArrayField[FieldMetaData](ctx, "fields", ReadComplex[FieldMetaData](ExtensionObjectDefinitionParseWithBufferProducer[FieldMetaData]((int32)(int32(14526))), readBuffer), uint64(noOfFields)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'fields' field")) + } + m.Fields = fields + + dataSetClassId, err := ReadSimpleField[GuidValue](ctx, "dataSetClassId", ReadComplex[GuidValue](GuidValueParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetClassId' field")) + } + m.DataSetClassId = dataSetClassId + + configurationVersion, err := ReadSimpleField[ConfigurationVersionDataType](ctx, "configurationVersion", ReadComplex[ConfigurationVersionDataType](ExtensionObjectDefinitionParseWithBufferProducer[ConfigurationVersionDataType]((int32)(int32(14595))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'configurationVersion' field")) + } + m.ConfigurationVersion = configurationVersion + + if closeErr := readBuffer.CloseContext("DataSetMetaDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DataSetMetaDataType") + } + + return m, nil +} + +func (m *_DataSetMetaDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DataSetMetaDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DataSetMetaDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DataSetMetaDataType") + } + noOfNamespaces := int32(utils.InlineIf(bool((m.GetNamespaces()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNamespaces()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNamespaces", noOfNamespaces, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfNamespaces' field") + } + + if err := WriteComplexTypeArrayField(ctx, "namespaces", m.GetNamespaces(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'namespaces' field") + } + noOfStructureDataTypes := int32(utils.InlineIf(bool((m.GetStructureDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetStructureDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfStructureDataTypes", noOfStructureDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfStructureDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "structureDataTypes", m.GetStructureDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'structureDataTypes' field") + } + noOfEnumDataTypes := int32(utils.InlineIf(bool((m.GetEnumDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEnumDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEnumDataTypes", noOfEnumDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfEnumDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "enumDataTypes", m.GetEnumDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'enumDataTypes' field") + } + noOfSimpleDataTypes := int32(utils.InlineIf(bool((m.GetSimpleDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSimpleDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSimpleDataTypes", noOfSimpleDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSimpleDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "simpleDataTypes", m.GetSimpleDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'simpleDataTypes' field") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + noOfFields := int32(utils.InlineIf(bool((m.GetFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfFields", noOfFields, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfFields' field") + } + + if err := WriteComplexTypeArrayField(ctx, "fields", m.GetFields(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'fields' field") + } + + if err := WriteSimpleField[GuidValue](ctx, "dataSetClassId", m.GetDataSetClassId(), WriteComplex[GuidValue](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetClassId' field") + } + + if err := WriteSimpleField[ConfigurationVersionDataType](ctx, "configurationVersion", m.GetConfigurationVersion(), WriteComplex[ConfigurationVersionDataType](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'configurationVersion' field") + } + + if popErr := writeBuffer.PopContext("DataSetMetaDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DataSetMetaDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DataSetMetaDataType) IsDataSetMetaDataType() {} + +func (m *_DataSetMetaDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DataSetMetaDataType) deepCopy() *_DataSetMetaDataType { + if m == nil { + return nil + } + _DataSetMetaDataTypeCopy := &_DataSetMetaDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[PascalString, PascalString](m.Namespaces), + utils.DeepCopySlice[StructureDescription, StructureDescription](m.StructureDataTypes), + utils.DeepCopySlice[EnumDescription, EnumDescription](m.EnumDataTypes), + utils.DeepCopySlice[SimpleTypeDescription, SimpleTypeDescription](m.SimpleDataTypes), + m.Name.DeepCopy().(PascalString), + m.Description.DeepCopy().(LocalizedText), + utils.DeepCopySlice[FieldMetaData, FieldMetaData](m.Fields), + m.DataSetClassId.DeepCopy().(GuidValue), + m.ConfigurationVersion.DeepCopy().(ConfigurationVersionDataType), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DataSetMetaDataTypeCopy +} + +func (m *_DataSetMetaDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetReaderDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetReaderDataType.go new file mode 100644 index 00000000000..9d3a3bb4dd6 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DataSetReaderDataType.go @@ -0,0 +1,1018 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DataSetReaderDataType is the corresponding interface of DataSetReaderDataType +type DataSetReaderDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetName returns Name (property field) + GetName() PascalString + // GetEnabled returns Enabled (property field) + GetEnabled() bool + // GetPublisherId returns PublisherId (property field) + GetPublisherId() Variant + // GetWriterGroupId returns WriterGroupId (property field) + GetWriterGroupId() uint16 + // GetDataSetWriterId returns DataSetWriterId (property field) + GetDataSetWriterId() uint16 + // GetDataSetMetaData returns DataSetMetaData (property field) + GetDataSetMetaData() DataSetMetaDataType + // GetDataSetFieldContentMask returns DataSetFieldContentMask (property field) + GetDataSetFieldContentMask() DataSetFieldContentMask + // GetMessageReceiveTimeout returns MessageReceiveTimeout (property field) + GetMessageReceiveTimeout() float64 + // GetKeyFrameCount returns KeyFrameCount (property field) + GetKeyFrameCount() uint32 + // GetHeaderLayoutUri returns HeaderLayoutUri (property field) + GetHeaderLayoutUri() PascalString + // GetSecurityMode returns SecurityMode (property field) + GetSecurityMode() MessageSecurityMode + // GetSecurityGroupId returns SecurityGroupId (property field) + GetSecurityGroupId() PascalString + // GetSecurityKeyServices returns SecurityKeyServices (property field) + GetSecurityKeyServices() []EndpointDescription + // GetDataSetReaderProperties returns DataSetReaderProperties (property field) + GetDataSetReaderProperties() []KeyValuePair + // GetTransportSettings returns TransportSettings (property field) + GetTransportSettings() ExtensionObject + // GetMessageSettings returns MessageSettings (property field) + GetMessageSettings() ExtensionObject + // GetSubscribedDataSet returns SubscribedDataSet (property field) + GetSubscribedDataSet() ExtensionObject + // IsDataSetReaderDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDataSetReaderDataType() + // CreateBuilder creates a DataSetReaderDataTypeBuilder + CreateDataSetReaderDataTypeBuilder() DataSetReaderDataTypeBuilder +} + +// _DataSetReaderDataType is the data-structure of this message +type _DataSetReaderDataType struct { + ExtensionObjectDefinitionContract + Name PascalString + Enabled bool + PublisherId Variant + WriterGroupId uint16 + DataSetWriterId uint16 + DataSetMetaData DataSetMetaDataType + DataSetFieldContentMask DataSetFieldContentMask + MessageReceiveTimeout float64 + KeyFrameCount uint32 + HeaderLayoutUri PascalString + SecurityMode MessageSecurityMode + SecurityGroupId PascalString + SecurityKeyServices []EndpointDescription + DataSetReaderProperties []KeyValuePair + TransportSettings ExtensionObject + MessageSettings ExtensionObject + SubscribedDataSet ExtensionObject + // Reserved Fields + reservedField0 *uint8 +} + +var _ DataSetReaderDataType = (*_DataSetReaderDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DataSetReaderDataType)(nil) + +// NewDataSetReaderDataType factory function for _DataSetReaderDataType +func NewDataSetReaderDataType(name PascalString, enabled bool, publisherId Variant, writerGroupId uint16, dataSetWriterId uint16, dataSetMetaData DataSetMetaDataType, dataSetFieldContentMask DataSetFieldContentMask, messageReceiveTimeout float64, keyFrameCount uint32, headerLayoutUri PascalString, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, dataSetReaderProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, subscribedDataSet ExtensionObject) *_DataSetReaderDataType { + if name == nil { + panic("name of type PascalString for DataSetReaderDataType must not be nil") + } + if publisherId == nil { + panic("publisherId of type Variant for DataSetReaderDataType must not be nil") + } + if dataSetMetaData == nil { + panic("dataSetMetaData of type DataSetMetaDataType for DataSetReaderDataType must not be nil") + } + if headerLayoutUri == nil { + panic("headerLayoutUri of type PascalString for DataSetReaderDataType must not be nil") + } + if securityGroupId == nil { + panic("securityGroupId of type PascalString for DataSetReaderDataType must not be nil") + } + if transportSettings == nil { + panic("transportSettings of type ExtensionObject for DataSetReaderDataType must not be nil") + } + if messageSettings == nil { + panic("messageSettings of type ExtensionObject for DataSetReaderDataType must not be nil") + } + if subscribedDataSet == nil { + panic("subscribedDataSet of type ExtensionObject for DataSetReaderDataType must not be nil") + } + _result := &_DataSetReaderDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Name: name, + Enabled: enabled, + PublisherId: publisherId, + WriterGroupId: writerGroupId, + DataSetWriterId: dataSetWriterId, + DataSetMetaData: dataSetMetaData, + DataSetFieldContentMask: dataSetFieldContentMask, + MessageReceiveTimeout: messageReceiveTimeout, + KeyFrameCount: keyFrameCount, + HeaderLayoutUri: headerLayoutUri, + SecurityMode: securityMode, + SecurityGroupId: securityGroupId, + SecurityKeyServices: securityKeyServices, + DataSetReaderProperties: dataSetReaderProperties, + TransportSettings: transportSettings, + MessageSettings: messageSettings, + SubscribedDataSet: subscribedDataSet, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DataSetReaderDataTypeBuilder is a builder for DataSetReaderDataType +type DataSetReaderDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, writerGroupId uint16, dataSetWriterId uint16, dataSetMetaData DataSetMetaDataType, dataSetFieldContentMask DataSetFieldContentMask, messageReceiveTimeout float64, keyFrameCount uint32, headerLayoutUri PascalString, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, dataSetReaderProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, subscribedDataSet ExtensionObject) DataSetReaderDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) DataSetReaderDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder + // WithEnabled adds Enabled (property field) + WithEnabled(bool) DataSetReaderDataTypeBuilder + // WithPublisherId adds PublisherId (property field) + WithPublisherId(Variant) DataSetReaderDataTypeBuilder + // WithPublisherIdBuilder adds PublisherId (property field) which is build by the builder + WithPublisherIdBuilder(func(VariantBuilder) VariantBuilder) DataSetReaderDataTypeBuilder + // WithWriterGroupId adds WriterGroupId (property field) + WithWriterGroupId(uint16) DataSetReaderDataTypeBuilder + // WithDataSetWriterId adds DataSetWriterId (property field) + WithDataSetWriterId(uint16) DataSetReaderDataTypeBuilder + // WithDataSetMetaData adds DataSetMetaData (property field) + WithDataSetMetaData(DataSetMetaDataType) DataSetReaderDataTypeBuilder + // WithDataSetMetaDataBuilder adds DataSetMetaData (property field) which is build by the builder + WithDataSetMetaDataBuilder(func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) DataSetReaderDataTypeBuilder + // WithDataSetFieldContentMask adds DataSetFieldContentMask (property field) + WithDataSetFieldContentMask(DataSetFieldContentMask) DataSetReaderDataTypeBuilder + // WithMessageReceiveTimeout adds MessageReceiveTimeout (property field) + WithMessageReceiveTimeout(float64) DataSetReaderDataTypeBuilder + // WithKeyFrameCount adds KeyFrameCount (property field) + WithKeyFrameCount(uint32) DataSetReaderDataTypeBuilder + // WithHeaderLayoutUri adds HeaderLayoutUri (property field) + WithHeaderLayoutUri(PascalString) DataSetReaderDataTypeBuilder + // WithHeaderLayoutUriBuilder adds HeaderLayoutUri (property field) which is build by the builder + WithHeaderLayoutUriBuilder(func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder + // WithSecurityMode adds SecurityMode (property field) + WithSecurityMode(MessageSecurityMode) DataSetReaderDataTypeBuilder + // WithSecurityGroupId adds SecurityGroupId (property field) + WithSecurityGroupId(PascalString) DataSetReaderDataTypeBuilder + // WithSecurityGroupIdBuilder adds SecurityGroupId (property field) which is build by the builder + WithSecurityGroupIdBuilder(func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder + // WithSecurityKeyServices adds SecurityKeyServices (property field) + WithSecurityKeyServices(...EndpointDescription) DataSetReaderDataTypeBuilder + // WithDataSetReaderProperties adds DataSetReaderProperties (property field) + WithDataSetReaderProperties(...KeyValuePair) DataSetReaderDataTypeBuilder + // WithTransportSettings adds TransportSettings (property field) + WithTransportSettings(ExtensionObject) DataSetReaderDataTypeBuilder + // WithTransportSettingsBuilder adds TransportSettings (property field) which is build by the builder + WithTransportSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder + // WithMessageSettings adds MessageSettings (property field) + WithMessageSettings(ExtensionObject) DataSetReaderDataTypeBuilder + // WithMessageSettingsBuilder adds MessageSettings (property field) which is build by the builder + WithMessageSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder + // WithSubscribedDataSet adds SubscribedDataSet (property field) + WithSubscribedDataSet(ExtensionObject) DataSetReaderDataTypeBuilder + // WithSubscribedDataSetBuilder adds SubscribedDataSet (property field) which is build by the builder + WithSubscribedDataSetBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder + // Build builds the DataSetReaderDataType or returns an error if something is wrong + Build() (DataSetReaderDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DataSetReaderDataType +} + +// NewDataSetReaderDataTypeBuilder() creates a DataSetReaderDataTypeBuilder +func NewDataSetReaderDataTypeBuilder() DataSetReaderDataTypeBuilder { + return &_DataSetReaderDataTypeBuilder{_DataSetReaderDataType: new(_DataSetReaderDataType)} +} + +type _DataSetReaderDataTypeBuilder struct { + *_DataSetReaderDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DataSetReaderDataTypeBuilder) = (*_DataSetReaderDataTypeBuilder)(nil) + +func (b *_DataSetReaderDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DataSetReaderDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, writerGroupId uint16, dataSetWriterId uint16, dataSetMetaData DataSetMetaDataType, dataSetFieldContentMask DataSetFieldContentMask, messageReceiveTimeout float64, keyFrameCount uint32, headerLayoutUri PascalString, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, dataSetReaderProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, subscribedDataSet ExtensionObject) DataSetReaderDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithPublisherId(publisherId).WithWriterGroupId(writerGroupId).WithDataSetWriterId(dataSetWriterId).WithDataSetMetaData(dataSetMetaData).WithDataSetFieldContentMask(dataSetFieldContentMask).WithMessageReceiveTimeout(messageReceiveTimeout).WithKeyFrameCount(keyFrameCount).WithHeaderLayoutUri(headerLayoutUri).WithSecurityMode(securityMode).WithSecurityGroupId(securityGroupId).WithSecurityKeyServices(securityKeyServices...).WithDataSetReaderProperties(dataSetReaderProperties...).WithTransportSettings(transportSettings).WithMessageSettings(messageSettings).WithSubscribedDataSet(subscribedDataSet) +} + +func (b *_DataSetReaderDataTypeBuilder) WithName(name PascalString) DataSetReaderDataTypeBuilder { + b.Name = name + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithEnabled(enabled bool) DataSetReaderDataTypeBuilder { + b.Enabled = enabled + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithPublisherId(publisherId Variant) DataSetReaderDataTypeBuilder { + b.PublisherId = publisherId + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithPublisherIdBuilder(builderSupplier func(VariantBuilder) VariantBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.PublisherId.CreateVariantBuilder()) + var err error + b.PublisherId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithWriterGroupId(writerGroupId uint16) DataSetReaderDataTypeBuilder { + b.WriterGroupId = writerGroupId + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithDataSetWriterId(dataSetWriterId uint16) DataSetReaderDataTypeBuilder { + b.DataSetWriterId = dataSetWriterId + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithDataSetMetaData(dataSetMetaData DataSetMetaDataType) DataSetReaderDataTypeBuilder { + b.DataSetMetaData = dataSetMetaData + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithDataSetMetaDataBuilder(builderSupplier func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.DataSetMetaData.CreateDataSetMetaDataTypeBuilder()) + var err error + b.DataSetMetaData, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "DataSetMetaDataTypeBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithDataSetFieldContentMask(dataSetFieldContentMask DataSetFieldContentMask) DataSetReaderDataTypeBuilder { + b.DataSetFieldContentMask = dataSetFieldContentMask + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithMessageReceiveTimeout(messageReceiveTimeout float64) DataSetReaderDataTypeBuilder { + b.MessageReceiveTimeout = messageReceiveTimeout + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithKeyFrameCount(keyFrameCount uint32) DataSetReaderDataTypeBuilder { + b.KeyFrameCount = keyFrameCount + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithHeaderLayoutUri(headerLayoutUri PascalString) DataSetReaderDataTypeBuilder { + b.HeaderLayoutUri = headerLayoutUri + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithHeaderLayoutUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.HeaderLayoutUri.CreatePascalStringBuilder()) + var err error + b.HeaderLayoutUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSecurityMode(securityMode MessageSecurityMode) DataSetReaderDataTypeBuilder { + b.SecurityMode = securityMode + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSecurityGroupId(securityGroupId PascalString) DataSetReaderDataTypeBuilder { + b.SecurityGroupId = securityGroupId + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSecurityGroupIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.SecurityGroupId.CreatePascalStringBuilder()) + var err error + b.SecurityGroupId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSecurityKeyServices(securityKeyServices ...EndpointDescription) DataSetReaderDataTypeBuilder { + b.SecurityKeyServices = securityKeyServices + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithDataSetReaderProperties(dataSetReaderProperties ...KeyValuePair) DataSetReaderDataTypeBuilder { + b.DataSetReaderProperties = dataSetReaderProperties + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithTransportSettings(transportSettings ExtensionObject) DataSetReaderDataTypeBuilder { + b.TransportSettings = transportSettings + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithTransportSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.TransportSettings.CreateExtensionObjectBuilder()) + var err error + b.TransportSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithMessageSettings(messageSettings ExtensionObject) DataSetReaderDataTypeBuilder { + b.MessageSettings = messageSettings + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithMessageSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.MessageSettings.CreateExtensionObjectBuilder()) + var err error + b.MessageSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSubscribedDataSet(subscribedDataSet ExtensionObject) DataSetReaderDataTypeBuilder { + b.SubscribedDataSet = subscribedDataSet + return b +} + +func (b *_DataSetReaderDataTypeBuilder) WithSubscribedDataSetBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DataSetReaderDataTypeBuilder { + builder := builderSupplier(b.SubscribedDataSet.CreateExtensionObjectBuilder()) + var err error + b.SubscribedDataSet, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DataSetReaderDataTypeBuilder) Build() (DataSetReaderDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.PublisherId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'publisherId' not set")) + } + if b.DataSetMetaData == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetMetaData' not set")) + } + if b.HeaderLayoutUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'headerLayoutUri' not set")) + } + if b.SecurityGroupId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'securityGroupId' not set")) + } + if b.TransportSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'transportSettings' not set")) + } + if b.MessageSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'messageSettings' not set")) + } + if b.SubscribedDataSet == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'subscribedDataSet' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DataSetReaderDataType.deepCopy(), nil +} + +func (b *_DataSetReaderDataTypeBuilder) MustBuild() DataSetReaderDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DataSetReaderDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DataSetReaderDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DataSetReaderDataTypeBuilder) DeepCopy() any { + _copy := b.CreateDataSetReaderDataTypeBuilder().(*_DataSetReaderDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDataSetReaderDataTypeBuilder creates a DataSetReaderDataTypeBuilder +func (b *_DataSetReaderDataType) CreateDataSetReaderDataTypeBuilder() DataSetReaderDataTypeBuilder { + if b == nil { + return NewDataSetReaderDataTypeBuilder() + } + return &_DataSetReaderDataTypeBuilder{_DataSetReaderDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DataSetReaderDataType) GetExtensionId() int32 { + return int32(15625) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DataSetReaderDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DataSetReaderDataType) GetName() PascalString { + return m.Name +} + +func (m *_DataSetReaderDataType) GetEnabled() bool { + return m.Enabled +} + +func (m *_DataSetReaderDataType) GetPublisherId() Variant { + return m.PublisherId +} + +func (m *_DataSetReaderDataType) GetWriterGroupId() uint16 { + return m.WriterGroupId +} + +func (m *_DataSetReaderDataType) GetDataSetWriterId() uint16 { + return m.DataSetWriterId +} + +func (m *_DataSetReaderDataType) GetDataSetMetaData() DataSetMetaDataType { + return m.DataSetMetaData +} + +func (m *_DataSetReaderDataType) GetDataSetFieldContentMask() DataSetFieldContentMask { + return m.DataSetFieldContentMask +} + +func (m *_DataSetReaderDataType) GetMessageReceiveTimeout() float64 { + return m.MessageReceiveTimeout +} + +func (m *_DataSetReaderDataType) GetKeyFrameCount() uint32 { + return m.KeyFrameCount +} + +func (m *_DataSetReaderDataType) GetHeaderLayoutUri() PascalString { + return m.HeaderLayoutUri +} + +func (m *_DataSetReaderDataType) GetSecurityMode() MessageSecurityMode { + return m.SecurityMode +} + +func (m *_DataSetReaderDataType) GetSecurityGroupId() PascalString { + return m.SecurityGroupId +} + +func (m *_DataSetReaderDataType) GetSecurityKeyServices() []EndpointDescription { + return m.SecurityKeyServices +} + +func (m *_DataSetReaderDataType) GetDataSetReaderProperties() []KeyValuePair { + return m.DataSetReaderProperties +} + +func (m *_DataSetReaderDataType) GetTransportSettings() ExtensionObject { + return m.TransportSettings +} + +func (m *_DataSetReaderDataType) GetMessageSettings() ExtensionObject { + return m.MessageSettings +} + +func (m *_DataSetReaderDataType) GetSubscribedDataSet() ExtensionObject { + return m.SubscribedDataSet +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDataSetReaderDataType(structType any) DataSetReaderDataType { + if casted, ok := structType.(DataSetReaderDataType); ok { + return casted + } + if casted, ok := structType.(*DataSetReaderDataType); ok { + return *casted + } + return nil +} + +func (m *_DataSetReaderDataType) GetTypeName() string { + return "DataSetReaderDataType" +} + +func (m *_DataSetReaderDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (enabled) + lengthInBits += 1 + + // Simple field (publisherId) + lengthInBits += m.PublisherId.GetLengthInBits(ctx) + + // Simple field (writerGroupId) + lengthInBits += 16 + + // Simple field (dataSetWriterId) + lengthInBits += 16 + + // Simple field (dataSetMetaData) + lengthInBits += m.DataSetMetaData.GetLengthInBits(ctx) + + // Simple field (dataSetFieldContentMask) + lengthInBits += 32 + + // Simple field (messageReceiveTimeout) + lengthInBits += 64 + + // Simple field (keyFrameCount) + lengthInBits += 32 + + // Simple field (headerLayoutUri) + lengthInBits += m.HeaderLayoutUri.GetLengthInBits(ctx) + + // Simple field (securityMode) + lengthInBits += 32 + + // Simple field (securityGroupId) + lengthInBits += m.SecurityGroupId.GetLengthInBits(ctx) + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32 + + // Array field + if len(m.SecurityKeyServices) > 0 { + for _curItem, element := range m.SecurityKeyServices { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SecurityKeyServices), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfDataSetReaderProperties) + lengthInBits += 32 + + // Array field + if len(m.DataSetReaderProperties) > 0 { + for _curItem, element := range m.DataSetReaderProperties { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetReaderProperties), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (transportSettings) + lengthInBits += m.TransportSettings.GetLengthInBits(ctx) + + // Simple field (messageSettings) + lengthInBits += m.MessageSettings.GetLengthInBits(ctx) + + // Simple field (subscribedDataSet) + lengthInBits += m.SubscribedDataSet.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_DataSetReaderDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DataSetReaderDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetReaderDataType DataSetReaderDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DataSetReaderDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DataSetReaderDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + enabled, err := ReadSimpleField(ctx, "enabled", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enabled' field")) + } + m.Enabled = enabled + + publisherId, err := ReadSimpleField[Variant](ctx, "publisherId", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publisherId' field")) + } + m.PublisherId = publisherId + + writerGroupId, err := ReadSimpleField(ctx, "writerGroupId", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writerGroupId' field")) + } + m.WriterGroupId = writerGroupId + + dataSetWriterId, err := ReadSimpleField(ctx, "dataSetWriterId", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetWriterId' field")) + } + m.DataSetWriterId = dataSetWriterId + + dataSetMetaData, err := ReadSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", ReadComplex[DataSetMetaDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetMetaDataType]((int32)(int32(14525))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMetaData' field")) + } + m.DataSetMetaData = dataSetMetaData + + dataSetFieldContentMask, err := ReadEnumField[DataSetFieldContentMask](ctx, "dataSetFieldContentMask", "DataSetFieldContentMask", ReadEnum(DataSetFieldContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetFieldContentMask' field")) + } + m.DataSetFieldContentMask = dataSetFieldContentMask + + messageReceiveTimeout, err := ReadSimpleField(ctx, "messageReceiveTimeout", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageReceiveTimeout' field")) + } + m.MessageReceiveTimeout = messageReceiveTimeout + + keyFrameCount, err := ReadSimpleField(ctx, "keyFrameCount", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'keyFrameCount' field")) + } + m.KeyFrameCount = keyFrameCount + + headerLayoutUri, err := ReadSimpleField[PascalString](ctx, "headerLayoutUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'headerLayoutUri' field")) + } + m.HeaderLayoutUri = headerLayoutUri + + securityMode, err := ReadEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", ReadEnum(MessageSecurityModeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityMode' field")) + } + m.SecurityMode = securityMode + + securityGroupId, err := ReadSimpleField[PascalString](ctx, "securityGroupId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityGroupId' field")) + } + m.SecurityGroupId = securityGroupId + + noOfSecurityKeyServices, err := ReadImplicitField[int32](ctx, "noOfSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityKeyServices' field")) + } + _ = noOfSecurityKeyServices + + securityKeyServices, err := ReadCountArrayField[EndpointDescription](ctx, "securityKeyServices", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfSecurityKeyServices)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityKeyServices' field")) + } + m.SecurityKeyServices = securityKeyServices + + noOfDataSetReaderProperties, err := ReadImplicitField[int32](ctx, "noOfDataSetReaderProperties", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetReaderProperties' field")) + } + _ = noOfDataSetReaderProperties + + dataSetReaderProperties, err := ReadCountArrayField[KeyValuePair](ctx, "dataSetReaderProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfDataSetReaderProperties)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetReaderProperties' field")) + } + m.DataSetReaderProperties = dataSetReaderProperties + + transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transportSettings' field")) + } + m.TransportSettings = transportSettings + + messageSettings, err := ReadSimpleField[ExtensionObject](ctx, "messageSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageSettings' field")) + } + m.MessageSettings = messageSettings + + subscribedDataSet, err := ReadSimpleField[ExtensionObject](ctx, "subscribedDataSet", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'subscribedDataSet' field")) + } + m.SubscribedDataSet = subscribedDataSet + + if closeErr := readBuffer.CloseContext("DataSetReaderDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DataSetReaderDataType") + } + + return m, nil +} + +func (m *_DataSetReaderDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DataSetReaderDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DataSetReaderDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DataSetReaderDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "enabled", m.GetEnabled(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'enabled' field") + } + + if err := WriteSimpleField[Variant](ctx, "publisherId", m.GetPublisherId(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'publisherId' field") + } + + if err := WriteSimpleField[uint16](ctx, "writerGroupId", m.GetWriterGroupId(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'writerGroupId' field") + } + + if err := WriteSimpleField[uint16](ctx, "dataSetWriterId", m.GetDataSetWriterId(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetWriterId' field") + } + + if err := WriteSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", m.GetDataSetMetaData(), WriteComplex[DataSetMetaDataType](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMetaData' field") + } + + if err := WriteSimpleEnumField[DataSetFieldContentMask](ctx, "dataSetFieldContentMask", "DataSetFieldContentMask", m.GetDataSetFieldContentMask(), WriteEnum[DataSetFieldContentMask, uint32](DataSetFieldContentMask.GetValue, DataSetFieldContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetFieldContentMask' field") + } + + if err := WriteSimpleField[float64](ctx, "messageReceiveTimeout", m.GetMessageReceiveTimeout(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'messageReceiveTimeout' field") + } + + if err := WriteSimpleField[uint32](ctx, "keyFrameCount", m.GetKeyFrameCount(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'keyFrameCount' field") + } + + if err := WriteSimpleField[PascalString](ctx, "headerLayoutUri", m.GetHeaderLayoutUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'headerLayoutUri' field") + } + + if err := WriteSimpleEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", m.GetSecurityMode(), WriteEnum[MessageSecurityMode, uint32](MessageSecurityMode.GetValue, MessageSecurityMode.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'securityMode' field") + } + + if err := WriteSimpleField[PascalString](ctx, "securityGroupId", m.GetSecurityGroupId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'securityGroupId' field") + } + noOfSecurityKeyServices := int32(utils.InlineIf(bool((m.GetSecurityKeyServices()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityKeyServices()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityKeyServices", noOfSecurityKeyServices, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSecurityKeyServices' field") + } + + if err := WriteComplexTypeArrayField(ctx, "securityKeyServices", m.GetSecurityKeyServices(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'securityKeyServices' field") + } + noOfDataSetReaderProperties := int32(utils.InlineIf(bool((m.GetDataSetReaderProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetReaderProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetReaderProperties", noOfDataSetReaderProperties, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetReaderProperties' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetReaderProperties", m.GetDataSetReaderProperties(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetReaderProperties' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "transportSettings", m.GetTransportSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'transportSettings' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "messageSettings", m.GetMessageSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'messageSettings' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "subscribedDataSet", m.GetSubscribedDataSet(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'subscribedDataSet' field") + } + + if popErr := writeBuffer.PopContext("DataSetReaderDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DataSetReaderDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DataSetReaderDataType) IsDataSetReaderDataType() {} + +func (m *_DataSetReaderDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DataSetReaderDataType) deepCopy() *_DataSetReaderDataType { + if m == nil { + return nil + } + _DataSetReaderDataTypeCopy := &_DataSetReaderDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Name.DeepCopy().(PascalString), + m.Enabled, + m.PublisherId.DeepCopy().(Variant), + m.WriterGroupId, + m.DataSetWriterId, + m.DataSetMetaData.DeepCopy().(DataSetMetaDataType), + m.DataSetFieldContentMask, + m.MessageReceiveTimeout, + m.KeyFrameCount, + m.HeaderLayoutUri.DeepCopy().(PascalString), + m.SecurityMode, + m.SecurityGroupId.DeepCopy().(PascalString), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.SecurityKeyServices), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.DataSetReaderProperties), + m.TransportSettings.DeepCopy().(ExtensionObject), + m.MessageSettings.DeepCopy().(ExtensionObject), + m.SubscribedDataSet.DeepCopy().(ExtensionObject), + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DataSetReaderDataTypeCopy +} + +func (m *_DataSetReaderDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetReaderMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetReaderMessageDataType.go index ad4717d5da1..73021c2c612 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataSetReaderMessageDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/DataSetReaderMessageDataType.go @@ -150,8 +150,8 @@ func (b *_DataSetReaderMessageDataType) CreateDataSetReaderMessageDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataSetReaderMessageDataType) GetIdentifier() string { - return "15631" +func (m *_DataSetReaderMessageDataType) GetExtensionId() int32 { + return int32(15631) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DataSetReaderMessageDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_DataSetReaderMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataSetReaderMessageDataType DataSetReaderMessageDataType, err error) { +func (m *_DataSetReaderMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetReaderMessageDataType DataSetReaderMessageDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetReaderTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetReaderTransportDataType.go index fb2c443d65d..ed64b7fa39b 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataSetReaderTransportDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/DataSetReaderTransportDataType.go @@ -150,8 +150,8 @@ func (b *_DataSetReaderTransportDataType) CreateDataSetReaderTransportDataTypeBu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataSetReaderTransportDataType) GetIdentifier() string { - return "15630" +func (m *_DataSetReaderTransportDataType) GetExtensionId() int32 { + return int32(15630) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DataSetReaderTransportDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_DataSetReaderTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataSetReaderTransportDataType DataSetReaderTransportDataType, err error) { +func (m *_DataSetReaderTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetReaderTransportDataType DataSetReaderTransportDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetWriterDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetWriterDataType.go index bc711efe5f2..449df29c2bf 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataSetWriterDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/DataSetWriterDataType.go @@ -52,10 +52,8 @@ type DataSetWriterDataType interface { GetKeyFrameCount() uint32 // GetDataSetName returns DataSetName (property field) GetDataSetName() PascalString - // GetNoOfDataSetWriterProperties returns NoOfDataSetWriterProperties (property field) - GetNoOfDataSetWriterProperties() int32 // GetDataSetWriterProperties returns DataSetWriterProperties (property field) - GetDataSetWriterProperties() []ExtensionObjectDefinition + GetDataSetWriterProperties() []KeyValuePair // GetTransportSettings returns TransportSettings (property field) GetTransportSettings() ExtensionObject // GetMessageSettings returns MessageSettings (property field) @@ -69,16 +67,15 @@ type DataSetWriterDataType interface { // _DataSetWriterDataType is the data-structure of this message type _DataSetWriterDataType struct { ExtensionObjectDefinitionContract - Name PascalString - Enabled bool - DataSetWriterId uint16 - DataSetFieldContentMask DataSetFieldContentMask - KeyFrameCount uint32 - DataSetName PascalString - NoOfDataSetWriterProperties int32 - DataSetWriterProperties []ExtensionObjectDefinition - TransportSettings ExtensionObject - MessageSettings ExtensionObject + Name PascalString + Enabled bool + DataSetWriterId uint16 + DataSetFieldContentMask DataSetFieldContentMask + KeyFrameCount uint32 + DataSetName PascalString + DataSetWriterProperties []KeyValuePair + TransportSettings ExtensionObject + MessageSettings ExtensionObject // Reserved Fields reservedField0 *uint8 } @@ -87,7 +84,7 @@ var _ DataSetWriterDataType = (*_DataSetWriterDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DataSetWriterDataType)(nil) // NewDataSetWriterDataType factory function for _DataSetWriterDataType -func NewDataSetWriterDataType(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, noOfDataSetWriterProperties int32, dataSetWriterProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, messageSettings ExtensionObject) *_DataSetWriterDataType { +func NewDataSetWriterDataType(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, dataSetWriterProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject) *_DataSetWriterDataType { if name == nil { panic("name of type PascalString for DataSetWriterDataType must not be nil") } @@ -108,7 +105,6 @@ func NewDataSetWriterDataType(name PascalString, enabled bool, dataSetWriterId u DataSetFieldContentMask: dataSetFieldContentMask, KeyFrameCount: keyFrameCount, DataSetName: dataSetName, - NoOfDataSetWriterProperties: noOfDataSetWriterProperties, DataSetWriterProperties: dataSetWriterProperties, TransportSettings: transportSettings, MessageSettings: messageSettings, @@ -126,7 +122,7 @@ func NewDataSetWriterDataType(name PascalString, enabled bool, dataSetWriterId u type DataSetWriterDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, noOfDataSetWriterProperties int32, dataSetWriterProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, messageSettings ExtensionObject) DataSetWriterDataTypeBuilder + WithMandatoryFields(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, dataSetWriterProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject) DataSetWriterDataTypeBuilder // WithName adds Name (property field) WithName(PascalString) DataSetWriterDataTypeBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -143,10 +139,8 @@ type DataSetWriterDataTypeBuilder interface { WithDataSetName(PascalString) DataSetWriterDataTypeBuilder // WithDataSetNameBuilder adds DataSetName (property field) which is build by the builder WithDataSetNameBuilder(func(PascalStringBuilder) PascalStringBuilder) DataSetWriterDataTypeBuilder - // WithNoOfDataSetWriterProperties adds NoOfDataSetWriterProperties (property field) - WithNoOfDataSetWriterProperties(int32) DataSetWriterDataTypeBuilder // WithDataSetWriterProperties adds DataSetWriterProperties (property field) - WithDataSetWriterProperties(...ExtensionObjectDefinition) DataSetWriterDataTypeBuilder + WithDataSetWriterProperties(...KeyValuePair) DataSetWriterDataTypeBuilder // WithTransportSettings adds TransportSettings (property field) WithTransportSettings(ExtensionObject) DataSetWriterDataTypeBuilder // WithTransportSettingsBuilder adds TransportSettings (property field) which is build by the builder @@ -180,8 +174,8 @@ func (b *_DataSetWriterDataTypeBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_DataSetWriterDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, noOfDataSetWriterProperties int32, dataSetWriterProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, messageSettings ExtensionObject) DataSetWriterDataTypeBuilder { - return b.WithName(name).WithEnabled(enabled).WithDataSetWriterId(dataSetWriterId).WithDataSetFieldContentMask(dataSetFieldContentMask).WithKeyFrameCount(keyFrameCount).WithDataSetName(dataSetName).WithNoOfDataSetWriterProperties(noOfDataSetWriterProperties).WithDataSetWriterProperties(dataSetWriterProperties...).WithTransportSettings(transportSettings).WithMessageSettings(messageSettings) +func (b *_DataSetWriterDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, dataSetWriterId uint16, dataSetFieldContentMask DataSetFieldContentMask, keyFrameCount uint32, dataSetName PascalString, dataSetWriterProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject) DataSetWriterDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithDataSetWriterId(dataSetWriterId).WithDataSetFieldContentMask(dataSetFieldContentMask).WithKeyFrameCount(keyFrameCount).WithDataSetName(dataSetName).WithDataSetWriterProperties(dataSetWriterProperties...).WithTransportSettings(transportSettings).WithMessageSettings(messageSettings) } func (b *_DataSetWriterDataTypeBuilder) WithName(name PascalString) DataSetWriterDataTypeBuilder { @@ -240,12 +234,7 @@ func (b *_DataSetWriterDataTypeBuilder) WithDataSetNameBuilder(builderSupplier f return b } -func (b *_DataSetWriterDataTypeBuilder) WithNoOfDataSetWriterProperties(noOfDataSetWriterProperties int32) DataSetWriterDataTypeBuilder { - b.NoOfDataSetWriterProperties = noOfDataSetWriterProperties - return b -} - -func (b *_DataSetWriterDataTypeBuilder) WithDataSetWriterProperties(dataSetWriterProperties ...ExtensionObjectDefinition) DataSetWriterDataTypeBuilder { +func (b *_DataSetWriterDataTypeBuilder) WithDataSetWriterProperties(dataSetWriterProperties ...KeyValuePair) DataSetWriterDataTypeBuilder { b.DataSetWriterProperties = dataSetWriterProperties return b } @@ -360,8 +349,8 @@ func (b *_DataSetWriterDataType) CreateDataSetWriterDataTypeBuilder() DataSetWri /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataSetWriterDataType) GetIdentifier() string { - return "15599" +func (m *_DataSetWriterDataType) GetExtensionId() int32 { + return int32(15599) } /////////////////////// @@ -402,11 +391,7 @@ func (m *_DataSetWriterDataType) GetDataSetName() PascalString { return m.DataSetName } -func (m *_DataSetWriterDataType) GetNoOfDataSetWriterProperties() int32 { - return m.NoOfDataSetWriterProperties -} - -func (m *_DataSetWriterDataType) GetDataSetWriterProperties() []ExtensionObjectDefinition { +func (m *_DataSetWriterDataType) GetDataSetWriterProperties() []KeyValuePair { return m.DataSetWriterProperties } @@ -462,7 +447,7 @@ func (m *_DataSetWriterDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (dataSetName) lengthInBits += m.DataSetName.GetLengthInBits(ctx) - // Simple field (noOfDataSetWriterProperties) + // Implicit Field (noOfDataSetWriterProperties) lengthInBits += 32 // Array field @@ -488,7 +473,7 @@ func (m *_DataSetWriterDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DataSetWriterDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataSetWriterDataType DataSetWriterDataType, err error) { +func (m *_DataSetWriterDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetWriterDataType DataSetWriterDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -541,25 +526,25 @@ func (m *_DataSetWriterDataType) parse(ctx context.Context, readBuffer utils.Rea } m.DataSetName = dataSetName - noOfDataSetWriterProperties, err := ReadSimpleField(ctx, "noOfDataSetWriterProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfDataSetWriterProperties, err := ReadImplicitField[int32](ctx, "noOfDataSetWriterProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetWriterProperties' field")) } - m.NoOfDataSetWriterProperties = noOfDataSetWriterProperties + _ = noOfDataSetWriterProperties - dataSetWriterProperties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "dataSetWriterProperties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfDataSetWriterProperties)) + dataSetWriterProperties, err := ReadCountArrayField[KeyValuePair](ctx, "dataSetWriterProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfDataSetWriterProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetWriterProperties' field")) } m.DataSetWriterProperties = dataSetWriterProperties - transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transportSettings' field")) } m.TransportSettings = transportSettings - messageSettings, err := ReadSimpleField[ExtensionObject](ctx, "messageSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + messageSettings, err := ReadSimpleField[ExtensionObject](ctx, "messageSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageSettings' field")) } @@ -617,8 +602,8 @@ func (m *_DataSetWriterDataType) SerializeWithWriteBuffer(ctx context.Context, w if err := WriteSimpleField[PascalString](ctx, "dataSetName", m.GetDataSetName(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'dataSetName' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDataSetWriterProperties", m.GetNoOfDataSetWriterProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDataSetWriterProperties := int32(utils.InlineIf(bool((m.GetDataSetWriterProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetWriterProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetWriterProperties", noOfDataSetWriterProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDataSetWriterProperties' field") } @@ -660,8 +645,7 @@ func (m *_DataSetWriterDataType) deepCopy() *_DataSetWriterDataType { m.DataSetFieldContentMask, m.KeyFrameCount, m.DataSetName.DeepCopy().(PascalString), - m.NoOfDataSetWriterProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.DataSetWriterProperties), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.DataSetWriterProperties), m.TransportSettings.DeepCopy().(ExtensionObject), m.MessageSettings.DeepCopy().(ExtensionObject), m.reservedField0, diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetWriterMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetWriterMessageDataType.go index a1eb4f9d00d..f4e9b10abbc 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataSetWriterMessageDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/DataSetWriterMessageDataType.go @@ -150,8 +150,8 @@ func (b *_DataSetWriterMessageDataType) CreateDataSetWriterMessageDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataSetWriterMessageDataType) GetIdentifier() string { - return "15607" +func (m *_DataSetWriterMessageDataType) GetExtensionId() int32 { + return int32(15607) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DataSetWriterMessageDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_DataSetWriterMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataSetWriterMessageDataType DataSetWriterMessageDataType, err error) { +func (m *_DataSetWriterMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetWriterMessageDataType DataSetWriterMessageDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataSetWriterTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/DataSetWriterTransportDataType.go index b4556019544..4f4e48c8dcc 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataSetWriterTransportDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/DataSetWriterTransportDataType.go @@ -150,8 +150,8 @@ func (b *_DataSetWriterTransportDataType) CreateDataSetWriterTransportDataTypeBu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataSetWriterTransportDataType) GetIdentifier() string { - return "15600" +func (m *_DataSetWriterTransportDataType) GetExtensionId() int32 { + return int32(15600) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DataSetWriterTransportDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_DataSetWriterTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataSetWriterTransportDataType DataSetWriterTransportDataType, err error) { +func (m *_DataSetWriterTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataSetWriterTransportDataType DataSetWriterTransportDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataTypeAttributes.go b/plc4go/protocols/opcua/readwrite/model/DataTypeAttributes.go new file mode 100644 index 00000000000..db341b8854a --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DataTypeAttributes.go @@ -0,0 +1,515 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DataTypeAttributes is the corresponding interface of DataTypeAttributes +type DataTypeAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetIsAbstract returns IsAbstract (property field) + GetIsAbstract() bool + // IsDataTypeAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDataTypeAttributes() + // CreateBuilder creates a DataTypeAttributesBuilder + CreateDataTypeAttributesBuilder() DataTypeAttributesBuilder +} + +// _DataTypeAttributes is the data-structure of this message +type _DataTypeAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + IsAbstract bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ DataTypeAttributes = (*_DataTypeAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DataTypeAttributes)(nil) + +// NewDataTypeAttributes factory function for _DataTypeAttributes +func NewDataTypeAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) *_DataTypeAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for DataTypeAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for DataTypeAttributes must not be nil") + } + _result := &_DataTypeAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + IsAbstract: isAbstract, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DataTypeAttributesBuilder is a builder for DataTypeAttributes +type DataTypeAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) DataTypeAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) DataTypeAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) DataTypeAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) DataTypeAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) DataTypeAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) DataTypeAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) DataTypeAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) DataTypeAttributesBuilder + // WithIsAbstract adds IsAbstract (property field) + WithIsAbstract(bool) DataTypeAttributesBuilder + // Build builds the DataTypeAttributes or returns an error if something is wrong + Build() (DataTypeAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() DataTypeAttributes +} + +// NewDataTypeAttributesBuilder() creates a DataTypeAttributesBuilder +func NewDataTypeAttributesBuilder() DataTypeAttributesBuilder { + return &_DataTypeAttributesBuilder{_DataTypeAttributes: new(_DataTypeAttributes)} +} + +type _DataTypeAttributesBuilder struct { + *_DataTypeAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DataTypeAttributesBuilder) = (*_DataTypeAttributesBuilder)(nil) + +func (b *_DataTypeAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DataTypeAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) DataTypeAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithIsAbstract(isAbstract) +} + +func (b *_DataTypeAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) DataTypeAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_DataTypeAttributesBuilder) WithDisplayName(displayName LocalizedText) DataTypeAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_DataTypeAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) DataTypeAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_DataTypeAttributesBuilder) WithDescription(description LocalizedText) DataTypeAttributesBuilder { + b.Description = description + return b +} + +func (b *_DataTypeAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) DataTypeAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_DataTypeAttributesBuilder) WithWriteMask(writeMask uint32) DataTypeAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_DataTypeAttributesBuilder) WithUserWriteMask(userWriteMask uint32) DataTypeAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_DataTypeAttributesBuilder) WithIsAbstract(isAbstract bool) DataTypeAttributesBuilder { + b.IsAbstract = isAbstract + return b +} + +func (b *_DataTypeAttributesBuilder) Build() (DataTypeAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DataTypeAttributes.deepCopy(), nil +} + +func (b *_DataTypeAttributesBuilder) MustBuild() DataTypeAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DataTypeAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DataTypeAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DataTypeAttributesBuilder) DeepCopy() any { + _copy := b.CreateDataTypeAttributesBuilder().(*_DataTypeAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDataTypeAttributesBuilder creates a DataTypeAttributesBuilder +func (b *_DataTypeAttributes) CreateDataTypeAttributesBuilder() DataTypeAttributesBuilder { + if b == nil { + return NewDataTypeAttributesBuilder() + } + return &_DataTypeAttributesBuilder{_DataTypeAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DataTypeAttributes) GetExtensionId() int32 { + return int32(372) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DataTypeAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DataTypeAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_DataTypeAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_DataTypeAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_DataTypeAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_DataTypeAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_DataTypeAttributes) GetIsAbstract() bool { + return m.IsAbstract +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDataTypeAttributes(structType any) DataTypeAttributes { + if casted, ok := structType.(DataTypeAttributes); ok { + return casted + } + if casted, ok := structType.(*DataTypeAttributes); ok { + return *casted + } + return nil +} + +func (m *_DataTypeAttributes) GetTypeName() string { + return "DataTypeAttributes" +} + +func (m *_DataTypeAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (isAbstract) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_DataTypeAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DataTypeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataTypeAttributes DataTypeAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DataTypeAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DataTypeAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + isAbstract, err := ReadSimpleField(ctx, "isAbstract", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isAbstract' field")) + } + m.IsAbstract = isAbstract + + if closeErr := readBuffer.CloseContext("DataTypeAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DataTypeAttributes") + } + + return m, nil +} + +func (m *_DataTypeAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DataTypeAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DataTypeAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DataTypeAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "isAbstract", m.GetIsAbstract(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isAbstract' field") + } + + if popErr := writeBuffer.PopContext("DataTypeAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DataTypeAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DataTypeAttributes) IsDataTypeAttributes() {} + +func (m *_DataTypeAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DataTypeAttributes) deepCopy() *_DataTypeAttributes { + if m == nil { + return nil + } + _DataTypeAttributesCopy := &_DataTypeAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.IsAbstract, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DataTypeAttributesCopy +} + +func (m *_DataTypeAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DataTypeDefinition.go b/plc4go/protocols/opcua/readwrite/model/DataTypeDefinition.go index b7baf35843a..23d15629824 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataTypeDefinition.go +++ b/plc4go/protocols/opcua/readwrite/model/DataTypeDefinition.go @@ -150,8 +150,8 @@ func (b *_DataTypeDefinition) CreateDataTypeDefinitionBuilder() DataTypeDefiniti /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataTypeDefinition) GetIdentifier() string { - return "99" +func (m *_DataTypeDefinition) GetExtensionId() int32 { + return int32(99) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DataTypeDefinition) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DataTypeDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataTypeDefinition DataTypeDefinition, err error) { +func (m *_DataTypeDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataTypeDefinition DataTypeDefinition, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataTypeDescription.go b/plc4go/protocols/opcua/readwrite/model/DataTypeDescription.go index ad719769da6..825259a0001 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataTypeDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/DataTypeDescription.go @@ -222,8 +222,8 @@ func (b *_DataTypeDescription) CreateDataTypeDescriptionBuilder() DataTypeDescri /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataTypeDescription) GetIdentifier() string { - return "14527" +func (m *_DataTypeDescription) GetExtensionId() int32 { + return int32(14527) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_DataTypeDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DataTypeDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataTypeDescription DataTypeDescription, err error) { +func (m *_DataTypeDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataTypeDescription DataTypeDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DataTypeSchemaHeader.go b/plc4go/protocols/opcua/readwrite/model/DataTypeSchemaHeader.go index 7647e93dbf7..cafc5dac5e9 100644 --- a/plc4go/protocols/opcua/readwrite/model/DataTypeSchemaHeader.go +++ b/plc4go/protocols/opcua/readwrite/model/DataTypeSchemaHeader.go @@ -40,22 +40,14 @@ type DataTypeSchemaHeader interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfNamespaces returns NoOfNamespaces (property field) - GetNoOfNamespaces() int32 // GetNamespaces returns Namespaces (property field) GetNamespaces() []PascalString - // GetNoOfStructureDataTypes returns NoOfStructureDataTypes (property field) - GetNoOfStructureDataTypes() int32 // GetStructureDataTypes returns StructureDataTypes (property field) - GetStructureDataTypes() []DataTypeDescription - // GetNoOfEnumDataTypes returns NoOfEnumDataTypes (property field) - GetNoOfEnumDataTypes() int32 + GetStructureDataTypes() []StructureDescription // GetEnumDataTypes returns EnumDataTypes (property field) - GetEnumDataTypes() []DataTypeDescription - // GetNoOfSimpleDataTypes returns NoOfSimpleDataTypes (property field) - GetNoOfSimpleDataTypes() int32 + GetEnumDataTypes() []EnumDescription // GetSimpleDataTypes returns SimpleDataTypes (property field) - GetSimpleDataTypes() []DataTypeDescription + GetSimpleDataTypes() []SimpleTypeDescription // IsDataTypeSchemaHeader is a marker method to prevent unintentional type checks (interfaces of same signature) IsDataTypeSchemaHeader() // CreateBuilder creates a DataTypeSchemaHeaderBuilder @@ -65,30 +57,22 @@ type DataTypeSchemaHeader interface { // _DataTypeSchemaHeader is the data-structure of this message type _DataTypeSchemaHeader struct { ExtensionObjectDefinitionContract - NoOfNamespaces int32 - Namespaces []PascalString - NoOfStructureDataTypes int32 - StructureDataTypes []DataTypeDescription - NoOfEnumDataTypes int32 - EnumDataTypes []DataTypeDescription - NoOfSimpleDataTypes int32 - SimpleDataTypes []DataTypeDescription + Namespaces []PascalString + StructureDataTypes []StructureDescription + EnumDataTypes []EnumDescription + SimpleDataTypes []SimpleTypeDescription } var _ DataTypeSchemaHeader = (*_DataTypeSchemaHeader)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DataTypeSchemaHeader)(nil) // NewDataTypeSchemaHeader factory function for _DataTypeSchemaHeader -func NewDataTypeSchemaHeader(noOfNamespaces int32, namespaces []PascalString, noOfStructureDataTypes int32, structureDataTypes []DataTypeDescription, noOfEnumDataTypes int32, enumDataTypes []DataTypeDescription, noOfSimpleDataTypes int32, simpleDataTypes []DataTypeDescription) *_DataTypeSchemaHeader { +func NewDataTypeSchemaHeader(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription) *_DataTypeSchemaHeader { _result := &_DataTypeSchemaHeader{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfNamespaces: noOfNamespaces, Namespaces: namespaces, - NoOfStructureDataTypes: noOfStructureDataTypes, StructureDataTypes: structureDataTypes, - NoOfEnumDataTypes: noOfEnumDataTypes, EnumDataTypes: enumDataTypes, - NoOfSimpleDataTypes: noOfSimpleDataTypes, SimpleDataTypes: simpleDataTypes, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -104,23 +88,15 @@ func NewDataTypeSchemaHeader(noOfNamespaces int32, namespaces []PascalString, no type DataTypeSchemaHeaderBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfNamespaces int32, namespaces []PascalString, noOfStructureDataTypes int32, structureDataTypes []DataTypeDescription, noOfEnumDataTypes int32, enumDataTypes []DataTypeDescription, noOfSimpleDataTypes int32, simpleDataTypes []DataTypeDescription) DataTypeSchemaHeaderBuilder - // WithNoOfNamespaces adds NoOfNamespaces (property field) - WithNoOfNamespaces(int32) DataTypeSchemaHeaderBuilder + WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription) DataTypeSchemaHeaderBuilder // WithNamespaces adds Namespaces (property field) WithNamespaces(...PascalString) DataTypeSchemaHeaderBuilder - // WithNoOfStructureDataTypes adds NoOfStructureDataTypes (property field) - WithNoOfStructureDataTypes(int32) DataTypeSchemaHeaderBuilder // WithStructureDataTypes adds StructureDataTypes (property field) - WithStructureDataTypes(...DataTypeDescription) DataTypeSchemaHeaderBuilder - // WithNoOfEnumDataTypes adds NoOfEnumDataTypes (property field) - WithNoOfEnumDataTypes(int32) DataTypeSchemaHeaderBuilder + WithStructureDataTypes(...StructureDescription) DataTypeSchemaHeaderBuilder // WithEnumDataTypes adds EnumDataTypes (property field) - WithEnumDataTypes(...DataTypeDescription) DataTypeSchemaHeaderBuilder - // WithNoOfSimpleDataTypes adds NoOfSimpleDataTypes (property field) - WithNoOfSimpleDataTypes(int32) DataTypeSchemaHeaderBuilder + WithEnumDataTypes(...EnumDescription) DataTypeSchemaHeaderBuilder // WithSimpleDataTypes adds SimpleDataTypes (property field) - WithSimpleDataTypes(...DataTypeDescription) DataTypeSchemaHeaderBuilder + WithSimpleDataTypes(...SimpleTypeDescription) DataTypeSchemaHeaderBuilder // Build builds the DataTypeSchemaHeader or returns an error if something is wrong Build() (DataTypeSchemaHeader, error) // MustBuild does the same as Build but panics on error @@ -146,13 +122,8 @@ func (b *_DataTypeSchemaHeaderBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_DataTypeSchemaHeaderBuilder) WithMandatoryFields(noOfNamespaces int32, namespaces []PascalString, noOfStructureDataTypes int32, structureDataTypes []DataTypeDescription, noOfEnumDataTypes int32, enumDataTypes []DataTypeDescription, noOfSimpleDataTypes int32, simpleDataTypes []DataTypeDescription) DataTypeSchemaHeaderBuilder { - return b.WithNoOfNamespaces(noOfNamespaces).WithNamespaces(namespaces...).WithNoOfStructureDataTypes(noOfStructureDataTypes).WithStructureDataTypes(structureDataTypes...).WithNoOfEnumDataTypes(noOfEnumDataTypes).WithEnumDataTypes(enumDataTypes...).WithNoOfSimpleDataTypes(noOfSimpleDataTypes).WithSimpleDataTypes(simpleDataTypes...) -} - -func (b *_DataTypeSchemaHeaderBuilder) WithNoOfNamespaces(noOfNamespaces int32) DataTypeSchemaHeaderBuilder { - b.NoOfNamespaces = noOfNamespaces - return b +func (b *_DataTypeSchemaHeaderBuilder) WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription) DataTypeSchemaHeaderBuilder { + return b.WithNamespaces(namespaces...).WithStructureDataTypes(structureDataTypes...).WithEnumDataTypes(enumDataTypes...).WithSimpleDataTypes(simpleDataTypes...) } func (b *_DataTypeSchemaHeaderBuilder) WithNamespaces(namespaces ...PascalString) DataTypeSchemaHeaderBuilder { @@ -160,32 +131,17 @@ func (b *_DataTypeSchemaHeaderBuilder) WithNamespaces(namespaces ...PascalString return b } -func (b *_DataTypeSchemaHeaderBuilder) WithNoOfStructureDataTypes(noOfStructureDataTypes int32) DataTypeSchemaHeaderBuilder { - b.NoOfStructureDataTypes = noOfStructureDataTypes - return b -} - -func (b *_DataTypeSchemaHeaderBuilder) WithStructureDataTypes(structureDataTypes ...DataTypeDescription) DataTypeSchemaHeaderBuilder { +func (b *_DataTypeSchemaHeaderBuilder) WithStructureDataTypes(structureDataTypes ...StructureDescription) DataTypeSchemaHeaderBuilder { b.StructureDataTypes = structureDataTypes return b } -func (b *_DataTypeSchemaHeaderBuilder) WithNoOfEnumDataTypes(noOfEnumDataTypes int32) DataTypeSchemaHeaderBuilder { - b.NoOfEnumDataTypes = noOfEnumDataTypes - return b -} - -func (b *_DataTypeSchemaHeaderBuilder) WithEnumDataTypes(enumDataTypes ...DataTypeDescription) DataTypeSchemaHeaderBuilder { +func (b *_DataTypeSchemaHeaderBuilder) WithEnumDataTypes(enumDataTypes ...EnumDescription) DataTypeSchemaHeaderBuilder { b.EnumDataTypes = enumDataTypes return b } -func (b *_DataTypeSchemaHeaderBuilder) WithNoOfSimpleDataTypes(noOfSimpleDataTypes int32) DataTypeSchemaHeaderBuilder { - b.NoOfSimpleDataTypes = noOfSimpleDataTypes - return b -} - -func (b *_DataTypeSchemaHeaderBuilder) WithSimpleDataTypes(simpleDataTypes ...DataTypeDescription) DataTypeSchemaHeaderBuilder { +func (b *_DataTypeSchemaHeaderBuilder) WithSimpleDataTypes(simpleDataTypes ...SimpleTypeDescription) DataTypeSchemaHeaderBuilder { b.SimpleDataTypes = simpleDataTypes return b } @@ -240,8 +196,8 @@ func (b *_DataTypeSchemaHeader) CreateDataTypeSchemaHeaderBuilder() DataTypeSche /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DataTypeSchemaHeader) GetIdentifier() string { - return "15536" +func (m *_DataTypeSchemaHeader) GetExtensionId() int32 { + return int32(15536) } /////////////////////// @@ -258,35 +214,19 @@ func (m *_DataTypeSchemaHeader) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DataTypeSchemaHeader) GetNoOfNamespaces() int32 { - return m.NoOfNamespaces -} - func (m *_DataTypeSchemaHeader) GetNamespaces() []PascalString { return m.Namespaces } -func (m *_DataTypeSchemaHeader) GetNoOfStructureDataTypes() int32 { - return m.NoOfStructureDataTypes -} - -func (m *_DataTypeSchemaHeader) GetStructureDataTypes() []DataTypeDescription { +func (m *_DataTypeSchemaHeader) GetStructureDataTypes() []StructureDescription { return m.StructureDataTypes } -func (m *_DataTypeSchemaHeader) GetNoOfEnumDataTypes() int32 { - return m.NoOfEnumDataTypes -} - -func (m *_DataTypeSchemaHeader) GetEnumDataTypes() []DataTypeDescription { +func (m *_DataTypeSchemaHeader) GetEnumDataTypes() []EnumDescription { return m.EnumDataTypes } -func (m *_DataTypeSchemaHeader) GetNoOfSimpleDataTypes() int32 { - return m.NoOfSimpleDataTypes -} - -func (m *_DataTypeSchemaHeader) GetSimpleDataTypes() []DataTypeDescription { +func (m *_DataTypeSchemaHeader) GetSimpleDataTypes() []SimpleTypeDescription { return m.SimpleDataTypes } @@ -313,7 +253,7 @@ func (m *_DataTypeSchemaHeader) GetTypeName() string { func (m *_DataTypeSchemaHeader) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfNamespaces) + // Implicit Field (noOfNamespaces) lengthInBits += 32 // Array field @@ -326,7 +266,7 @@ func (m *_DataTypeSchemaHeader) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfStructureDataTypes) + // Implicit Field (noOfStructureDataTypes) lengthInBits += 32 // Array field @@ -339,7 +279,7 @@ func (m *_DataTypeSchemaHeader) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfEnumDataTypes) + // Implicit Field (noOfEnumDataTypes) lengthInBits += 32 // Array field @@ -352,7 +292,7 @@ func (m *_DataTypeSchemaHeader) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfSimpleDataTypes) + // Implicit Field (noOfSimpleDataTypes) lengthInBits += 32 // Array field @@ -372,7 +312,7 @@ func (m *_DataTypeSchemaHeader) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DataTypeSchemaHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__dataTypeSchemaHeader DataTypeSchemaHeader, err error) { +func (m *_DataTypeSchemaHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__dataTypeSchemaHeader DataTypeSchemaHeader, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -383,11 +323,11 @@ func (m *_DataTypeSchemaHeader) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - noOfNamespaces, err := ReadSimpleField(ctx, "noOfNamespaces", ReadSignedInt(readBuffer, uint8(32))) + noOfNamespaces, err := ReadImplicitField[int32](ctx, "noOfNamespaces", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNamespaces' field")) } - m.NoOfNamespaces = noOfNamespaces + _ = noOfNamespaces namespaces, err := ReadCountArrayField[PascalString](ctx, "namespaces", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfNamespaces)) if err != nil { @@ -395,37 +335,37 @@ func (m *_DataTypeSchemaHeader) parse(ctx context.Context, readBuffer utils.Read } m.Namespaces = namespaces - noOfStructureDataTypes, err := ReadSimpleField(ctx, "noOfStructureDataTypes", ReadSignedInt(readBuffer, uint8(32))) + noOfStructureDataTypes, err := ReadImplicitField[int32](ctx, "noOfStructureDataTypes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfStructureDataTypes' field")) } - m.NoOfStructureDataTypes = noOfStructureDataTypes + _ = noOfStructureDataTypes - structureDataTypes, err := ReadCountArrayField[DataTypeDescription](ctx, "structureDataTypes", ReadComplex[DataTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[DataTypeDescription]((string)("14525")), readBuffer), uint64(noOfStructureDataTypes)) + structureDataTypes, err := ReadCountArrayField[StructureDescription](ctx, "structureDataTypes", ReadComplex[StructureDescription](ExtensionObjectDefinitionParseWithBufferProducer[StructureDescription]((int32)(int32(15489))), readBuffer), uint64(noOfStructureDataTypes)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'structureDataTypes' field")) } m.StructureDataTypes = structureDataTypes - noOfEnumDataTypes, err := ReadSimpleField(ctx, "noOfEnumDataTypes", ReadSignedInt(readBuffer, uint8(32))) + noOfEnumDataTypes, err := ReadImplicitField[int32](ctx, "noOfEnumDataTypes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEnumDataTypes' field")) } - m.NoOfEnumDataTypes = noOfEnumDataTypes + _ = noOfEnumDataTypes - enumDataTypes, err := ReadCountArrayField[DataTypeDescription](ctx, "enumDataTypes", ReadComplex[DataTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[DataTypeDescription]((string)("14525")), readBuffer), uint64(noOfEnumDataTypes)) + enumDataTypes, err := ReadCountArrayField[EnumDescription](ctx, "enumDataTypes", ReadComplex[EnumDescription](ExtensionObjectDefinitionParseWithBufferProducer[EnumDescription]((int32)(int32(15490))), readBuffer), uint64(noOfEnumDataTypes)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enumDataTypes' field")) } m.EnumDataTypes = enumDataTypes - noOfSimpleDataTypes, err := ReadSimpleField(ctx, "noOfSimpleDataTypes", ReadSignedInt(readBuffer, uint8(32))) + noOfSimpleDataTypes, err := ReadImplicitField[int32](ctx, "noOfSimpleDataTypes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSimpleDataTypes' field")) } - m.NoOfSimpleDataTypes = noOfSimpleDataTypes + _ = noOfSimpleDataTypes - simpleDataTypes, err := ReadCountArrayField[DataTypeDescription](ctx, "simpleDataTypes", ReadComplex[DataTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[DataTypeDescription]((string)("14525")), readBuffer), uint64(noOfSimpleDataTypes)) + simpleDataTypes, err := ReadCountArrayField[SimpleTypeDescription](ctx, "simpleDataTypes", ReadComplex[SimpleTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[SimpleTypeDescription]((int32)(int32(15007))), readBuffer), uint64(noOfSimpleDataTypes)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'simpleDataTypes' field")) } @@ -455,32 +395,32 @@ func (m *_DataTypeSchemaHeader) SerializeWithWriteBuffer(ctx context.Context, wr if pushErr := writeBuffer.PushContext("DataTypeSchemaHeader"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for DataTypeSchemaHeader") } - - if err := WriteSimpleField[int32](ctx, "noOfNamespaces", m.GetNoOfNamespaces(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNamespaces := int32(utils.InlineIf(bool((m.GetNamespaces()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNamespaces()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNamespaces", noOfNamespaces, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNamespaces' field") } if err := WriteComplexTypeArrayField(ctx, "namespaces", m.GetNamespaces(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'namespaces' field") } - - if err := WriteSimpleField[int32](ctx, "noOfStructureDataTypes", m.GetNoOfStructureDataTypes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfStructureDataTypes := int32(utils.InlineIf(bool((m.GetStructureDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetStructureDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfStructureDataTypes", noOfStructureDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfStructureDataTypes' field") } if err := WriteComplexTypeArrayField(ctx, "structureDataTypes", m.GetStructureDataTypes(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'structureDataTypes' field") } - - if err := WriteSimpleField[int32](ctx, "noOfEnumDataTypes", m.GetNoOfEnumDataTypes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEnumDataTypes := int32(utils.InlineIf(bool((m.GetEnumDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEnumDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEnumDataTypes", noOfEnumDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEnumDataTypes' field") } if err := WriteComplexTypeArrayField(ctx, "enumDataTypes", m.GetEnumDataTypes(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'enumDataTypes' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSimpleDataTypes", m.GetNoOfSimpleDataTypes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSimpleDataTypes := int32(utils.InlineIf(bool((m.GetSimpleDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSimpleDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSimpleDataTypes", noOfSimpleDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSimpleDataTypes' field") } @@ -508,14 +448,10 @@ func (m *_DataTypeSchemaHeader) deepCopy() *_DataTypeSchemaHeader { } _DataTypeSchemaHeaderCopy := &_DataTypeSchemaHeader{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfNamespaces, utils.DeepCopySlice[PascalString, PascalString](m.Namespaces), - m.NoOfStructureDataTypes, - utils.DeepCopySlice[DataTypeDescription, DataTypeDescription](m.StructureDataTypes), - m.NoOfEnumDataTypes, - utils.DeepCopySlice[DataTypeDescription, DataTypeDescription](m.EnumDataTypes), - m.NoOfSimpleDataTypes, - utils.DeepCopySlice[DataTypeDescription, DataTypeDescription](m.SimpleDataTypes), + utils.DeepCopySlice[StructureDescription, StructureDescription](m.StructureDataTypes), + utils.DeepCopySlice[EnumDescription, EnumDescription](m.EnumDataTypes), + utils.DeepCopySlice[SimpleTypeDescription, SimpleTypeDescription](m.SimpleDataTypes), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _DataTypeSchemaHeaderCopy diff --git a/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransport2DataType.go b/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransport2DataType.go new file mode 100644 index 00000000000..dc45b3aedf3 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransport2DataType.go @@ -0,0 +1,490 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DatagramConnectionTransport2DataType is the corresponding interface of DatagramConnectionTransport2DataType +type DatagramConnectionTransport2DataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDiscoveryAddress returns DiscoveryAddress (property field) + GetDiscoveryAddress() ExtensionObject + // GetDiscoveryAnnounceRate returns DiscoveryAnnounceRate (property field) + GetDiscoveryAnnounceRate() uint32 + // GetDiscoveryMaxMessageSize returns DiscoveryMaxMessageSize (property field) + GetDiscoveryMaxMessageSize() uint32 + // GetQosCategory returns QosCategory (property field) + GetQosCategory() PascalString + // GetDatagramQos returns DatagramQos (property field) + GetDatagramQos() []ExtensionObject + // IsDatagramConnectionTransport2DataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDatagramConnectionTransport2DataType() + // CreateBuilder creates a DatagramConnectionTransport2DataTypeBuilder + CreateDatagramConnectionTransport2DataTypeBuilder() DatagramConnectionTransport2DataTypeBuilder +} + +// _DatagramConnectionTransport2DataType is the data-structure of this message +type _DatagramConnectionTransport2DataType struct { + ExtensionObjectDefinitionContract + DiscoveryAddress ExtensionObject + DiscoveryAnnounceRate uint32 + DiscoveryMaxMessageSize uint32 + QosCategory PascalString + DatagramQos []ExtensionObject +} + +var _ DatagramConnectionTransport2DataType = (*_DatagramConnectionTransport2DataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DatagramConnectionTransport2DataType)(nil) + +// NewDatagramConnectionTransport2DataType factory function for _DatagramConnectionTransport2DataType +func NewDatagramConnectionTransport2DataType(discoveryAddress ExtensionObject, discoveryAnnounceRate uint32, discoveryMaxMessageSize uint32, qosCategory PascalString, datagramQos []ExtensionObject) *_DatagramConnectionTransport2DataType { + if discoveryAddress == nil { + panic("discoveryAddress of type ExtensionObject for DatagramConnectionTransport2DataType must not be nil") + } + if qosCategory == nil { + panic("qosCategory of type PascalString for DatagramConnectionTransport2DataType must not be nil") + } + _result := &_DatagramConnectionTransport2DataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DiscoveryAddress: discoveryAddress, + DiscoveryAnnounceRate: discoveryAnnounceRate, + DiscoveryMaxMessageSize: discoveryMaxMessageSize, + QosCategory: qosCategory, + DatagramQos: datagramQos, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DatagramConnectionTransport2DataTypeBuilder is a builder for DatagramConnectionTransport2DataType +type DatagramConnectionTransport2DataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(discoveryAddress ExtensionObject, discoveryAnnounceRate uint32, discoveryMaxMessageSize uint32, qosCategory PascalString, datagramQos []ExtensionObject) DatagramConnectionTransport2DataTypeBuilder + // WithDiscoveryAddress adds DiscoveryAddress (property field) + WithDiscoveryAddress(ExtensionObject) DatagramConnectionTransport2DataTypeBuilder + // WithDiscoveryAddressBuilder adds DiscoveryAddress (property field) which is build by the builder + WithDiscoveryAddressBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramConnectionTransport2DataTypeBuilder + // WithDiscoveryAnnounceRate adds DiscoveryAnnounceRate (property field) + WithDiscoveryAnnounceRate(uint32) DatagramConnectionTransport2DataTypeBuilder + // WithDiscoveryMaxMessageSize adds DiscoveryMaxMessageSize (property field) + WithDiscoveryMaxMessageSize(uint32) DatagramConnectionTransport2DataTypeBuilder + // WithQosCategory adds QosCategory (property field) + WithQosCategory(PascalString) DatagramConnectionTransport2DataTypeBuilder + // WithQosCategoryBuilder adds QosCategory (property field) which is build by the builder + WithQosCategoryBuilder(func(PascalStringBuilder) PascalStringBuilder) DatagramConnectionTransport2DataTypeBuilder + // WithDatagramQos adds DatagramQos (property field) + WithDatagramQos(...ExtensionObject) DatagramConnectionTransport2DataTypeBuilder + // Build builds the DatagramConnectionTransport2DataType or returns an error if something is wrong + Build() (DatagramConnectionTransport2DataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DatagramConnectionTransport2DataType +} + +// NewDatagramConnectionTransport2DataTypeBuilder() creates a DatagramConnectionTransport2DataTypeBuilder +func NewDatagramConnectionTransport2DataTypeBuilder() DatagramConnectionTransport2DataTypeBuilder { + return &_DatagramConnectionTransport2DataTypeBuilder{_DatagramConnectionTransport2DataType: new(_DatagramConnectionTransport2DataType)} +} + +type _DatagramConnectionTransport2DataTypeBuilder struct { + *_DatagramConnectionTransport2DataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DatagramConnectionTransport2DataTypeBuilder) = (*_DatagramConnectionTransport2DataTypeBuilder)(nil) + +func (b *_DatagramConnectionTransport2DataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithMandatoryFields(discoveryAddress ExtensionObject, discoveryAnnounceRate uint32, discoveryMaxMessageSize uint32, qosCategory PascalString, datagramQos []ExtensionObject) DatagramConnectionTransport2DataTypeBuilder { + return b.WithDiscoveryAddress(discoveryAddress).WithDiscoveryAnnounceRate(discoveryAnnounceRate).WithDiscoveryMaxMessageSize(discoveryMaxMessageSize).WithQosCategory(qosCategory).WithDatagramQos(datagramQos...) +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithDiscoveryAddress(discoveryAddress ExtensionObject) DatagramConnectionTransport2DataTypeBuilder { + b.DiscoveryAddress = discoveryAddress + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithDiscoveryAddressBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramConnectionTransport2DataTypeBuilder { + builder := builderSupplier(b.DiscoveryAddress.CreateExtensionObjectBuilder()) + var err error + b.DiscoveryAddress, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithDiscoveryAnnounceRate(discoveryAnnounceRate uint32) DatagramConnectionTransport2DataTypeBuilder { + b.DiscoveryAnnounceRate = discoveryAnnounceRate + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithDiscoveryMaxMessageSize(discoveryMaxMessageSize uint32) DatagramConnectionTransport2DataTypeBuilder { + b.DiscoveryMaxMessageSize = discoveryMaxMessageSize + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithQosCategory(qosCategory PascalString) DatagramConnectionTransport2DataTypeBuilder { + b.QosCategory = qosCategory + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithQosCategoryBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DatagramConnectionTransport2DataTypeBuilder { + builder := builderSupplier(b.QosCategory.CreatePascalStringBuilder()) + var err error + b.QosCategory, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) WithDatagramQos(datagramQos ...ExtensionObject) DatagramConnectionTransport2DataTypeBuilder { + b.DatagramQos = datagramQos + return b +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) Build() (DatagramConnectionTransport2DataType, error) { + if b.DiscoveryAddress == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'discoveryAddress' not set")) + } + if b.QosCategory == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'qosCategory' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DatagramConnectionTransport2DataType.deepCopy(), nil +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) MustBuild() DatagramConnectionTransport2DataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DatagramConnectionTransport2DataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DatagramConnectionTransport2DataTypeBuilder) DeepCopy() any { + _copy := b.CreateDatagramConnectionTransport2DataTypeBuilder().(*_DatagramConnectionTransport2DataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDatagramConnectionTransport2DataTypeBuilder creates a DatagramConnectionTransport2DataTypeBuilder +func (b *_DatagramConnectionTransport2DataType) CreateDatagramConnectionTransport2DataTypeBuilder() DatagramConnectionTransport2DataTypeBuilder { + if b == nil { + return NewDatagramConnectionTransport2DataTypeBuilder() + } + return &_DatagramConnectionTransport2DataTypeBuilder{_DatagramConnectionTransport2DataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DatagramConnectionTransport2DataType) GetExtensionId() int32 { + return int32(23614) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DatagramConnectionTransport2DataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DatagramConnectionTransport2DataType) GetDiscoveryAddress() ExtensionObject { + return m.DiscoveryAddress +} + +func (m *_DatagramConnectionTransport2DataType) GetDiscoveryAnnounceRate() uint32 { + return m.DiscoveryAnnounceRate +} + +func (m *_DatagramConnectionTransport2DataType) GetDiscoveryMaxMessageSize() uint32 { + return m.DiscoveryMaxMessageSize +} + +func (m *_DatagramConnectionTransport2DataType) GetQosCategory() PascalString { + return m.QosCategory +} + +func (m *_DatagramConnectionTransport2DataType) GetDatagramQos() []ExtensionObject { + return m.DatagramQos +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDatagramConnectionTransport2DataType(structType any) DatagramConnectionTransport2DataType { + if casted, ok := structType.(DatagramConnectionTransport2DataType); ok { + return casted + } + if casted, ok := structType.(*DatagramConnectionTransport2DataType); ok { + return *casted + } + return nil +} + +func (m *_DatagramConnectionTransport2DataType) GetTypeName() string { + return "DatagramConnectionTransport2DataType" +} + +func (m *_DatagramConnectionTransport2DataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (discoveryAddress) + lengthInBits += m.DiscoveryAddress.GetLengthInBits(ctx) + + // Simple field (discoveryAnnounceRate) + lengthInBits += 32 + + // Simple field (discoveryMaxMessageSize) + lengthInBits += 32 + + // Simple field (qosCategory) + lengthInBits += m.QosCategory.GetLengthInBits(ctx) + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32 + + // Array field + if len(m.DatagramQos) > 0 { + for _curItem, element := range m.DatagramQos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DatagramQos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_DatagramConnectionTransport2DataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DatagramConnectionTransport2DataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__datagramConnectionTransport2DataType DatagramConnectionTransport2DataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DatagramConnectionTransport2DataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DatagramConnectionTransport2DataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + discoveryAddress, err := ReadSimpleField[ExtensionObject](ctx, "discoveryAddress", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryAddress' field")) + } + m.DiscoveryAddress = discoveryAddress + + discoveryAnnounceRate, err := ReadSimpleField(ctx, "discoveryAnnounceRate", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryAnnounceRate' field")) + } + m.DiscoveryAnnounceRate = discoveryAnnounceRate + + discoveryMaxMessageSize, err := ReadSimpleField(ctx, "discoveryMaxMessageSize", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryMaxMessageSize' field")) + } + m.DiscoveryMaxMessageSize = discoveryMaxMessageSize + + qosCategory, err := ReadSimpleField[PascalString](ctx, "qosCategory", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'qosCategory' field")) + } + m.QosCategory = qosCategory + + noOfDatagramQos, err := ReadImplicitField[int32](ctx, "noOfDatagramQos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDatagramQos' field")) + } + _ = noOfDatagramQos + + datagramQos, err := ReadCountArrayField[ExtensionObject](ctx, "datagramQos", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfDatagramQos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'datagramQos' field")) + } + m.DatagramQos = datagramQos + + if closeErr := readBuffer.CloseContext("DatagramConnectionTransport2DataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DatagramConnectionTransport2DataType") + } + + return m, nil +} + +func (m *_DatagramConnectionTransport2DataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DatagramConnectionTransport2DataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DatagramConnectionTransport2DataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DatagramConnectionTransport2DataType") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "discoveryAddress", m.GetDiscoveryAddress(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'discoveryAddress' field") + } + + if err := WriteSimpleField[uint32](ctx, "discoveryAnnounceRate", m.GetDiscoveryAnnounceRate(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'discoveryAnnounceRate' field") + } + + if err := WriteSimpleField[uint32](ctx, "discoveryMaxMessageSize", m.GetDiscoveryMaxMessageSize(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'discoveryMaxMessageSize' field") + } + + if err := WriteSimpleField[PascalString](ctx, "qosCategory", m.GetQosCategory(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'qosCategory' field") + } + noOfDatagramQos := int32(utils.InlineIf(bool((m.GetDatagramQos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDatagramQos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDatagramQos", noOfDatagramQos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDatagramQos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "datagramQos", m.GetDatagramQos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'datagramQos' field") + } + + if popErr := writeBuffer.PopContext("DatagramConnectionTransport2DataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DatagramConnectionTransport2DataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DatagramConnectionTransport2DataType) IsDatagramConnectionTransport2DataType() {} + +func (m *_DatagramConnectionTransport2DataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DatagramConnectionTransport2DataType) deepCopy() *_DatagramConnectionTransport2DataType { + if m == nil { + return nil + } + _DatagramConnectionTransport2DataTypeCopy := &_DatagramConnectionTransport2DataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DiscoveryAddress.DeepCopy().(ExtensionObject), + m.DiscoveryAnnounceRate, + m.DiscoveryMaxMessageSize, + m.QosCategory.DeepCopy().(PascalString), + utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.DatagramQos), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DatagramConnectionTransport2DataTypeCopy +} + +func (m *_DatagramConnectionTransport2DataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransportDataType.go new file mode 100644 index 00000000000..b23592696a0 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DatagramConnectionTransportDataType.go @@ -0,0 +1,330 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DatagramConnectionTransportDataType is the corresponding interface of DatagramConnectionTransportDataType +type DatagramConnectionTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDiscoveryAddress returns DiscoveryAddress (property field) + GetDiscoveryAddress() ExtensionObject + // IsDatagramConnectionTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDatagramConnectionTransportDataType() + // CreateBuilder creates a DatagramConnectionTransportDataTypeBuilder + CreateDatagramConnectionTransportDataTypeBuilder() DatagramConnectionTransportDataTypeBuilder +} + +// _DatagramConnectionTransportDataType is the data-structure of this message +type _DatagramConnectionTransportDataType struct { + ExtensionObjectDefinitionContract + DiscoveryAddress ExtensionObject +} + +var _ DatagramConnectionTransportDataType = (*_DatagramConnectionTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DatagramConnectionTransportDataType)(nil) + +// NewDatagramConnectionTransportDataType factory function for _DatagramConnectionTransportDataType +func NewDatagramConnectionTransportDataType(discoveryAddress ExtensionObject) *_DatagramConnectionTransportDataType { + if discoveryAddress == nil { + panic("discoveryAddress of type ExtensionObject for DatagramConnectionTransportDataType must not be nil") + } + _result := &_DatagramConnectionTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DiscoveryAddress: discoveryAddress, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DatagramConnectionTransportDataTypeBuilder is a builder for DatagramConnectionTransportDataType +type DatagramConnectionTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(discoveryAddress ExtensionObject) DatagramConnectionTransportDataTypeBuilder + // WithDiscoveryAddress adds DiscoveryAddress (property field) + WithDiscoveryAddress(ExtensionObject) DatagramConnectionTransportDataTypeBuilder + // WithDiscoveryAddressBuilder adds DiscoveryAddress (property field) which is build by the builder + WithDiscoveryAddressBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramConnectionTransportDataTypeBuilder + // Build builds the DatagramConnectionTransportDataType or returns an error if something is wrong + Build() (DatagramConnectionTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DatagramConnectionTransportDataType +} + +// NewDatagramConnectionTransportDataTypeBuilder() creates a DatagramConnectionTransportDataTypeBuilder +func NewDatagramConnectionTransportDataTypeBuilder() DatagramConnectionTransportDataTypeBuilder { + return &_DatagramConnectionTransportDataTypeBuilder{_DatagramConnectionTransportDataType: new(_DatagramConnectionTransportDataType)} +} + +type _DatagramConnectionTransportDataTypeBuilder struct { + *_DatagramConnectionTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DatagramConnectionTransportDataTypeBuilder) = (*_DatagramConnectionTransportDataTypeBuilder)(nil) + +func (b *_DatagramConnectionTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) WithMandatoryFields(discoveryAddress ExtensionObject) DatagramConnectionTransportDataTypeBuilder { + return b.WithDiscoveryAddress(discoveryAddress) +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) WithDiscoveryAddress(discoveryAddress ExtensionObject) DatagramConnectionTransportDataTypeBuilder { + b.DiscoveryAddress = discoveryAddress + return b +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) WithDiscoveryAddressBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramConnectionTransportDataTypeBuilder { + builder := builderSupplier(b.DiscoveryAddress.CreateExtensionObjectBuilder()) + var err error + b.DiscoveryAddress, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) Build() (DatagramConnectionTransportDataType, error) { + if b.DiscoveryAddress == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'discoveryAddress' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DatagramConnectionTransportDataType.deepCopy(), nil +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) MustBuild() DatagramConnectionTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DatagramConnectionTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DatagramConnectionTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateDatagramConnectionTransportDataTypeBuilder().(*_DatagramConnectionTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDatagramConnectionTransportDataTypeBuilder creates a DatagramConnectionTransportDataTypeBuilder +func (b *_DatagramConnectionTransportDataType) CreateDatagramConnectionTransportDataTypeBuilder() DatagramConnectionTransportDataTypeBuilder { + if b == nil { + return NewDatagramConnectionTransportDataTypeBuilder() + } + return &_DatagramConnectionTransportDataTypeBuilder{_DatagramConnectionTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DatagramConnectionTransportDataType) GetExtensionId() int32 { + return int32(17469) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DatagramConnectionTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DatagramConnectionTransportDataType) GetDiscoveryAddress() ExtensionObject { + return m.DiscoveryAddress +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDatagramConnectionTransportDataType(structType any) DatagramConnectionTransportDataType { + if casted, ok := structType.(DatagramConnectionTransportDataType); ok { + return casted + } + if casted, ok := structType.(*DatagramConnectionTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_DatagramConnectionTransportDataType) GetTypeName() string { + return "DatagramConnectionTransportDataType" +} + +func (m *_DatagramConnectionTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (discoveryAddress) + lengthInBits += m.DiscoveryAddress.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_DatagramConnectionTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DatagramConnectionTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__datagramConnectionTransportDataType DatagramConnectionTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DatagramConnectionTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DatagramConnectionTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + discoveryAddress, err := ReadSimpleField[ExtensionObject](ctx, "discoveryAddress", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryAddress' field")) + } + m.DiscoveryAddress = discoveryAddress + + if closeErr := readBuffer.CloseContext("DatagramConnectionTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DatagramConnectionTransportDataType") + } + + return m, nil +} + +func (m *_DatagramConnectionTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DatagramConnectionTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DatagramConnectionTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DatagramConnectionTransportDataType") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "discoveryAddress", m.GetDiscoveryAddress(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'discoveryAddress' field") + } + + if popErr := writeBuffer.PopContext("DatagramConnectionTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DatagramConnectionTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DatagramConnectionTransportDataType) IsDatagramConnectionTransportDataType() {} + +func (m *_DatagramConnectionTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DatagramConnectionTransportDataType) deepCopy() *_DatagramConnectionTransportDataType { + if m == nil { + return nil + } + _DatagramConnectionTransportDataTypeCopy := &_DatagramConnectionTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DiscoveryAddress.DeepCopy().(ExtensionObject), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DatagramConnectionTransportDataTypeCopy +} + +func (m *_DatagramConnectionTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DatagramDataSetReaderTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/DatagramDataSetReaderTransportDataType.go new file mode 100644 index 00000000000..ae884e3bc84 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DatagramDataSetReaderTransportDataType.go @@ -0,0 +1,485 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DatagramDataSetReaderTransportDataType is the corresponding interface of DatagramDataSetReaderTransportDataType +type DatagramDataSetReaderTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetAddress returns Address (property field) + GetAddress() ExtensionObject + // GetQosCategory returns QosCategory (property field) + GetQosCategory() PascalString + // GetDatagramQos returns DatagramQos (property field) + GetDatagramQos() []ExtensionObject + // GetTopic returns Topic (property field) + GetTopic() PascalString + // IsDatagramDataSetReaderTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDatagramDataSetReaderTransportDataType() + // CreateBuilder creates a DatagramDataSetReaderTransportDataTypeBuilder + CreateDatagramDataSetReaderTransportDataTypeBuilder() DatagramDataSetReaderTransportDataTypeBuilder +} + +// _DatagramDataSetReaderTransportDataType is the data-structure of this message +type _DatagramDataSetReaderTransportDataType struct { + ExtensionObjectDefinitionContract + Address ExtensionObject + QosCategory PascalString + DatagramQos []ExtensionObject + Topic PascalString +} + +var _ DatagramDataSetReaderTransportDataType = (*_DatagramDataSetReaderTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DatagramDataSetReaderTransportDataType)(nil) + +// NewDatagramDataSetReaderTransportDataType factory function for _DatagramDataSetReaderTransportDataType +func NewDatagramDataSetReaderTransportDataType(address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, topic PascalString) *_DatagramDataSetReaderTransportDataType { + if address == nil { + panic("address of type ExtensionObject for DatagramDataSetReaderTransportDataType must not be nil") + } + if qosCategory == nil { + panic("qosCategory of type PascalString for DatagramDataSetReaderTransportDataType must not be nil") + } + if topic == nil { + panic("topic of type PascalString for DatagramDataSetReaderTransportDataType must not be nil") + } + _result := &_DatagramDataSetReaderTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Address: address, + QosCategory: qosCategory, + DatagramQos: datagramQos, + Topic: topic, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DatagramDataSetReaderTransportDataTypeBuilder is a builder for DatagramDataSetReaderTransportDataType +type DatagramDataSetReaderTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, topic PascalString) DatagramDataSetReaderTransportDataTypeBuilder + // WithAddress adds Address (property field) + WithAddress(ExtensionObject) DatagramDataSetReaderTransportDataTypeBuilder + // WithAddressBuilder adds Address (property field) which is build by the builder + WithAddressBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramDataSetReaderTransportDataTypeBuilder + // WithQosCategory adds QosCategory (property field) + WithQosCategory(PascalString) DatagramDataSetReaderTransportDataTypeBuilder + // WithQosCategoryBuilder adds QosCategory (property field) which is build by the builder + WithQosCategoryBuilder(func(PascalStringBuilder) PascalStringBuilder) DatagramDataSetReaderTransportDataTypeBuilder + // WithDatagramQos adds DatagramQos (property field) + WithDatagramQos(...ExtensionObject) DatagramDataSetReaderTransportDataTypeBuilder + // WithTopic adds Topic (property field) + WithTopic(PascalString) DatagramDataSetReaderTransportDataTypeBuilder + // WithTopicBuilder adds Topic (property field) which is build by the builder + WithTopicBuilder(func(PascalStringBuilder) PascalStringBuilder) DatagramDataSetReaderTransportDataTypeBuilder + // Build builds the DatagramDataSetReaderTransportDataType or returns an error if something is wrong + Build() (DatagramDataSetReaderTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DatagramDataSetReaderTransportDataType +} + +// NewDatagramDataSetReaderTransportDataTypeBuilder() creates a DatagramDataSetReaderTransportDataTypeBuilder +func NewDatagramDataSetReaderTransportDataTypeBuilder() DatagramDataSetReaderTransportDataTypeBuilder { + return &_DatagramDataSetReaderTransportDataTypeBuilder{_DatagramDataSetReaderTransportDataType: new(_DatagramDataSetReaderTransportDataType)} +} + +type _DatagramDataSetReaderTransportDataTypeBuilder struct { + *_DatagramDataSetReaderTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DatagramDataSetReaderTransportDataTypeBuilder) = (*_DatagramDataSetReaderTransportDataTypeBuilder)(nil) + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithMandatoryFields(address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, topic PascalString) DatagramDataSetReaderTransportDataTypeBuilder { + return b.WithAddress(address).WithQosCategory(qosCategory).WithDatagramQos(datagramQos...).WithTopic(topic) +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithAddress(address ExtensionObject) DatagramDataSetReaderTransportDataTypeBuilder { + b.Address = address + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithAddressBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.Address.CreateExtensionObjectBuilder()) + var err error + b.Address, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithQosCategory(qosCategory PascalString) DatagramDataSetReaderTransportDataTypeBuilder { + b.QosCategory = qosCategory + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithQosCategoryBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DatagramDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.QosCategory.CreatePascalStringBuilder()) + var err error + b.QosCategory, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithDatagramQos(datagramQos ...ExtensionObject) DatagramDataSetReaderTransportDataTypeBuilder { + b.DatagramQos = datagramQos + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithTopic(topic PascalString) DatagramDataSetReaderTransportDataTypeBuilder { + b.Topic = topic + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) WithTopicBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DatagramDataSetReaderTransportDataTypeBuilder { + builder := builderSupplier(b.Topic.CreatePascalStringBuilder()) + var err error + b.Topic, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) Build() (DatagramDataSetReaderTransportDataType, error) { + if b.Address == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'address' not set")) + } + if b.QosCategory == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'qosCategory' not set")) + } + if b.Topic == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'topic' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DatagramDataSetReaderTransportDataType.deepCopy(), nil +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) MustBuild() DatagramDataSetReaderTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DatagramDataSetReaderTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateDatagramDataSetReaderTransportDataTypeBuilder().(*_DatagramDataSetReaderTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDatagramDataSetReaderTransportDataTypeBuilder creates a DatagramDataSetReaderTransportDataTypeBuilder +func (b *_DatagramDataSetReaderTransportDataType) CreateDatagramDataSetReaderTransportDataTypeBuilder() DatagramDataSetReaderTransportDataTypeBuilder { + if b == nil { + return NewDatagramDataSetReaderTransportDataTypeBuilder() + } + return &_DatagramDataSetReaderTransportDataTypeBuilder{_DatagramDataSetReaderTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DatagramDataSetReaderTransportDataType) GetExtensionId() int32 { + return int32(23616) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DatagramDataSetReaderTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DatagramDataSetReaderTransportDataType) GetAddress() ExtensionObject { + return m.Address +} + +func (m *_DatagramDataSetReaderTransportDataType) GetQosCategory() PascalString { + return m.QosCategory +} + +func (m *_DatagramDataSetReaderTransportDataType) GetDatagramQos() []ExtensionObject { + return m.DatagramQos +} + +func (m *_DatagramDataSetReaderTransportDataType) GetTopic() PascalString { + return m.Topic +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDatagramDataSetReaderTransportDataType(structType any) DatagramDataSetReaderTransportDataType { + if casted, ok := structType.(DatagramDataSetReaderTransportDataType); ok { + return casted + } + if casted, ok := structType.(*DatagramDataSetReaderTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_DatagramDataSetReaderTransportDataType) GetTypeName() string { + return "DatagramDataSetReaderTransportDataType" +} + +func (m *_DatagramDataSetReaderTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (address) + lengthInBits += m.Address.GetLengthInBits(ctx) + + // Simple field (qosCategory) + lengthInBits += m.QosCategory.GetLengthInBits(ctx) + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32 + + // Array field + if len(m.DatagramQos) > 0 { + for _curItem, element := range m.DatagramQos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DatagramQos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (topic) + lengthInBits += m.Topic.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_DatagramDataSetReaderTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DatagramDataSetReaderTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__datagramDataSetReaderTransportDataType DatagramDataSetReaderTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DatagramDataSetReaderTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DatagramDataSetReaderTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + address, err := ReadSimpleField[ExtensionObject](ctx, "address", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'address' field")) + } + m.Address = address + + qosCategory, err := ReadSimpleField[PascalString](ctx, "qosCategory", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'qosCategory' field")) + } + m.QosCategory = qosCategory + + noOfDatagramQos, err := ReadImplicitField[int32](ctx, "noOfDatagramQos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDatagramQos' field")) + } + _ = noOfDatagramQos + + datagramQos, err := ReadCountArrayField[ExtensionObject](ctx, "datagramQos", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfDatagramQos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'datagramQos' field")) + } + m.DatagramQos = datagramQos + + topic, err := ReadSimpleField[PascalString](ctx, "topic", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'topic' field")) + } + m.Topic = topic + + if closeErr := readBuffer.CloseContext("DatagramDataSetReaderTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DatagramDataSetReaderTransportDataType") + } + + return m, nil +} + +func (m *_DatagramDataSetReaderTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DatagramDataSetReaderTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DatagramDataSetReaderTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DatagramDataSetReaderTransportDataType") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "address", m.GetAddress(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'address' field") + } + + if err := WriteSimpleField[PascalString](ctx, "qosCategory", m.GetQosCategory(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'qosCategory' field") + } + noOfDatagramQos := int32(utils.InlineIf(bool((m.GetDatagramQos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDatagramQos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDatagramQos", noOfDatagramQos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDatagramQos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "datagramQos", m.GetDatagramQos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'datagramQos' field") + } + + if err := WriteSimpleField[PascalString](ctx, "topic", m.GetTopic(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'topic' field") + } + + if popErr := writeBuffer.PopContext("DatagramDataSetReaderTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DatagramDataSetReaderTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DatagramDataSetReaderTransportDataType) IsDatagramDataSetReaderTransportDataType() {} + +func (m *_DatagramDataSetReaderTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DatagramDataSetReaderTransportDataType) deepCopy() *_DatagramDataSetReaderTransportDataType { + if m == nil { + return nil + } + _DatagramDataSetReaderTransportDataTypeCopy := &_DatagramDataSetReaderTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Address.DeepCopy().(ExtensionObject), + m.QosCategory.DeepCopy().(PascalString), + utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.DatagramQos), + m.Topic.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DatagramDataSetReaderTransportDataTypeCopy +} + +func (m *_DatagramDataSetReaderTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransport2DataType.go b/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransport2DataType.go new file mode 100644 index 00000000000..7618004e991 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransport2DataType.go @@ -0,0 +1,572 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DatagramWriterGroupTransport2DataType is the corresponding interface of DatagramWriterGroupTransport2DataType +type DatagramWriterGroupTransport2DataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetMessageRepeatCount returns MessageRepeatCount (property field) + GetMessageRepeatCount() uint8 + // GetMessageRepeatDelay returns MessageRepeatDelay (property field) + GetMessageRepeatDelay() float64 + // GetAddress returns Address (property field) + GetAddress() ExtensionObject + // GetQosCategory returns QosCategory (property field) + GetQosCategory() PascalString + // GetDatagramQos returns DatagramQos (property field) + GetDatagramQos() []ExtensionObject + // GetDiscoveryAnnounceRate returns DiscoveryAnnounceRate (property field) + GetDiscoveryAnnounceRate() uint32 + // GetTopic returns Topic (property field) + GetTopic() PascalString + // IsDatagramWriterGroupTransport2DataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDatagramWriterGroupTransport2DataType() + // CreateBuilder creates a DatagramWriterGroupTransport2DataTypeBuilder + CreateDatagramWriterGroupTransport2DataTypeBuilder() DatagramWriterGroupTransport2DataTypeBuilder +} + +// _DatagramWriterGroupTransport2DataType is the data-structure of this message +type _DatagramWriterGroupTransport2DataType struct { + ExtensionObjectDefinitionContract + MessageRepeatCount uint8 + MessageRepeatDelay float64 + Address ExtensionObject + QosCategory PascalString + DatagramQos []ExtensionObject + DiscoveryAnnounceRate uint32 + Topic PascalString +} + +var _ DatagramWriterGroupTransport2DataType = (*_DatagramWriterGroupTransport2DataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DatagramWriterGroupTransport2DataType)(nil) + +// NewDatagramWriterGroupTransport2DataType factory function for _DatagramWriterGroupTransport2DataType +func NewDatagramWriterGroupTransport2DataType(messageRepeatCount uint8, messageRepeatDelay float64, address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, discoveryAnnounceRate uint32, topic PascalString) *_DatagramWriterGroupTransport2DataType { + if address == nil { + panic("address of type ExtensionObject for DatagramWriterGroupTransport2DataType must not be nil") + } + if qosCategory == nil { + panic("qosCategory of type PascalString for DatagramWriterGroupTransport2DataType must not be nil") + } + if topic == nil { + panic("topic of type PascalString for DatagramWriterGroupTransport2DataType must not be nil") + } + _result := &_DatagramWriterGroupTransport2DataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + MessageRepeatCount: messageRepeatCount, + MessageRepeatDelay: messageRepeatDelay, + Address: address, + QosCategory: qosCategory, + DatagramQos: datagramQos, + DiscoveryAnnounceRate: discoveryAnnounceRate, + Topic: topic, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DatagramWriterGroupTransport2DataTypeBuilder is a builder for DatagramWriterGroupTransport2DataType +type DatagramWriterGroupTransport2DataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(messageRepeatCount uint8, messageRepeatDelay float64, address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, discoveryAnnounceRate uint32, topic PascalString) DatagramWriterGroupTransport2DataTypeBuilder + // WithMessageRepeatCount adds MessageRepeatCount (property field) + WithMessageRepeatCount(uint8) DatagramWriterGroupTransport2DataTypeBuilder + // WithMessageRepeatDelay adds MessageRepeatDelay (property field) + WithMessageRepeatDelay(float64) DatagramWriterGroupTransport2DataTypeBuilder + // WithAddress adds Address (property field) + WithAddress(ExtensionObject) DatagramWriterGroupTransport2DataTypeBuilder + // WithAddressBuilder adds Address (property field) which is build by the builder + WithAddressBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramWriterGroupTransport2DataTypeBuilder + // WithQosCategory adds QosCategory (property field) + WithQosCategory(PascalString) DatagramWriterGroupTransport2DataTypeBuilder + // WithQosCategoryBuilder adds QosCategory (property field) which is build by the builder + WithQosCategoryBuilder(func(PascalStringBuilder) PascalStringBuilder) DatagramWriterGroupTransport2DataTypeBuilder + // WithDatagramQos adds DatagramQos (property field) + WithDatagramQos(...ExtensionObject) DatagramWriterGroupTransport2DataTypeBuilder + // WithDiscoveryAnnounceRate adds DiscoveryAnnounceRate (property field) + WithDiscoveryAnnounceRate(uint32) DatagramWriterGroupTransport2DataTypeBuilder + // WithTopic adds Topic (property field) + WithTopic(PascalString) DatagramWriterGroupTransport2DataTypeBuilder + // WithTopicBuilder adds Topic (property field) which is build by the builder + WithTopicBuilder(func(PascalStringBuilder) PascalStringBuilder) DatagramWriterGroupTransport2DataTypeBuilder + // Build builds the DatagramWriterGroupTransport2DataType or returns an error if something is wrong + Build() (DatagramWriterGroupTransport2DataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DatagramWriterGroupTransport2DataType +} + +// NewDatagramWriterGroupTransport2DataTypeBuilder() creates a DatagramWriterGroupTransport2DataTypeBuilder +func NewDatagramWriterGroupTransport2DataTypeBuilder() DatagramWriterGroupTransport2DataTypeBuilder { + return &_DatagramWriterGroupTransport2DataTypeBuilder{_DatagramWriterGroupTransport2DataType: new(_DatagramWriterGroupTransport2DataType)} +} + +type _DatagramWriterGroupTransport2DataTypeBuilder struct { + *_DatagramWriterGroupTransport2DataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DatagramWriterGroupTransport2DataTypeBuilder) = (*_DatagramWriterGroupTransport2DataTypeBuilder)(nil) + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithMandatoryFields(messageRepeatCount uint8, messageRepeatDelay float64, address ExtensionObject, qosCategory PascalString, datagramQos []ExtensionObject, discoveryAnnounceRate uint32, topic PascalString) DatagramWriterGroupTransport2DataTypeBuilder { + return b.WithMessageRepeatCount(messageRepeatCount).WithMessageRepeatDelay(messageRepeatDelay).WithAddress(address).WithQosCategory(qosCategory).WithDatagramQos(datagramQos...).WithDiscoveryAnnounceRate(discoveryAnnounceRate).WithTopic(topic) +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithMessageRepeatCount(messageRepeatCount uint8) DatagramWriterGroupTransport2DataTypeBuilder { + b.MessageRepeatCount = messageRepeatCount + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithMessageRepeatDelay(messageRepeatDelay float64) DatagramWriterGroupTransport2DataTypeBuilder { + b.MessageRepeatDelay = messageRepeatDelay + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithAddress(address ExtensionObject) DatagramWriterGroupTransport2DataTypeBuilder { + b.Address = address + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithAddressBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) DatagramWriterGroupTransport2DataTypeBuilder { + builder := builderSupplier(b.Address.CreateExtensionObjectBuilder()) + var err error + b.Address, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithQosCategory(qosCategory PascalString) DatagramWriterGroupTransport2DataTypeBuilder { + b.QosCategory = qosCategory + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithQosCategoryBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DatagramWriterGroupTransport2DataTypeBuilder { + builder := builderSupplier(b.QosCategory.CreatePascalStringBuilder()) + var err error + b.QosCategory, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithDatagramQos(datagramQos ...ExtensionObject) DatagramWriterGroupTransport2DataTypeBuilder { + b.DatagramQos = datagramQos + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithDiscoveryAnnounceRate(discoveryAnnounceRate uint32) DatagramWriterGroupTransport2DataTypeBuilder { + b.DiscoveryAnnounceRate = discoveryAnnounceRate + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithTopic(topic PascalString) DatagramWriterGroupTransport2DataTypeBuilder { + b.Topic = topic + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) WithTopicBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) DatagramWriterGroupTransport2DataTypeBuilder { + builder := builderSupplier(b.Topic.CreatePascalStringBuilder()) + var err error + b.Topic, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) Build() (DatagramWriterGroupTransport2DataType, error) { + if b.Address == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'address' not set")) + } + if b.QosCategory == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'qosCategory' not set")) + } + if b.Topic == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'topic' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DatagramWriterGroupTransport2DataType.deepCopy(), nil +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) MustBuild() DatagramWriterGroupTransport2DataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DatagramWriterGroupTransport2DataTypeBuilder) DeepCopy() any { + _copy := b.CreateDatagramWriterGroupTransport2DataTypeBuilder().(*_DatagramWriterGroupTransport2DataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDatagramWriterGroupTransport2DataTypeBuilder creates a DatagramWriterGroupTransport2DataTypeBuilder +func (b *_DatagramWriterGroupTransport2DataType) CreateDatagramWriterGroupTransport2DataTypeBuilder() DatagramWriterGroupTransport2DataTypeBuilder { + if b == nil { + return NewDatagramWriterGroupTransport2DataTypeBuilder() + } + return &_DatagramWriterGroupTransport2DataTypeBuilder{_DatagramWriterGroupTransport2DataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DatagramWriterGroupTransport2DataType) GetExtensionId() int32 { + return int32(23615) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DatagramWriterGroupTransport2DataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DatagramWriterGroupTransport2DataType) GetMessageRepeatCount() uint8 { + return m.MessageRepeatCount +} + +func (m *_DatagramWriterGroupTransport2DataType) GetMessageRepeatDelay() float64 { + return m.MessageRepeatDelay +} + +func (m *_DatagramWriterGroupTransport2DataType) GetAddress() ExtensionObject { + return m.Address +} + +func (m *_DatagramWriterGroupTransport2DataType) GetQosCategory() PascalString { + return m.QosCategory +} + +func (m *_DatagramWriterGroupTransport2DataType) GetDatagramQos() []ExtensionObject { + return m.DatagramQos +} + +func (m *_DatagramWriterGroupTransport2DataType) GetDiscoveryAnnounceRate() uint32 { + return m.DiscoveryAnnounceRate +} + +func (m *_DatagramWriterGroupTransport2DataType) GetTopic() PascalString { + return m.Topic +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDatagramWriterGroupTransport2DataType(structType any) DatagramWriterGroupTransport2DataType { + if casted, ok := structType.(DatagramWriterGroupTransport2DataType); ok { + return casted + } + if casted, ok := structType.(*DatagramWriterGroupTransport2DataType); ok { + return *casted + } + return nil +} + +func (m *_DatagramWriterGroupTransport2DataType) GetTypeName() string { + return "DatagramWriterGroupTransport2DataType" +} + +func (m *_DatagramWriterGroupTransport2DataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (messageRepeatCount) + lengthInBits += 8 + + // Simple field (messageRepeatDelay) + lengthInBits += 64 + + // Simple field (address) + lengthInBits += m.Address.GetLengthInBits(ctx) + + // Simple field (qosCategory) + lengthInBits += m.QosCategory.GetLengthInBits(ctx) + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32 + + // Array field + if len(m.DatagramQos) > 0 { + for _curItem, element := range m.DatagramQos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DatagramQos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (discoveryAnnounceRate) + lengthInBits += 32 + + // Simple field (topic) + lengthInBits += m.Topic.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_DatagramWriterGroupTransport2DataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DatagramWriterGroupTransport2DataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__datagramWriterGroupTransport2DataType DatagramWriterGroupTransport2DataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DatagramWriterGroupTransport2DataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DatagramWriterGroupTransport2DataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + messageRepeatCount, err := ReadSimpleField(ctx, "messageRepeatCount", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageRepeatCount' field")) + } + m.MessageRepeatCount = messageRepeatCount + + messageRepeatDelay, err := ReadSimpleField(ctx, "messageRepeatDelay", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageRepeatDelay' field")) + } + m.MessageRepeatDelay = messageRepeatDelay + + address, err := ReadSimpleField[ExtensionObject](ctx, "address", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'address' field")) + } + m.Address = address + + qosCategory, err := ReadSimpleField[PascalString](ctx, "qosCategory", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'qosCategory' field")) + } + m.QosCategory = qosCategory + + noOfDatagramQos, err := ReadImplicitField[int32](ctx, "noOfDatagramQos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDatagramQos' field")) + } + _ = noOfDatagramQos + + datagramQos, err := ReadCountArrayField[ExtensionObject](ctx, "datagramQos", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfDatagramQos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'datagramQos' field")) + } + m.DatagramQos = datagramQos + + discoveryAnnounceRate, err := ReadSimpleField(ctx, "discoveryAnnounceRate", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryAnnounceRate' field")) + } + m.DiscoveryAnnounceRate = discoveryAnnounceRate + + topic, err := ReadSimpleField[PascalString](ctx, "topic", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'topic' field")) + } + m.Topic = topic + + if closeErr := readBuffer.CloseContext("DatagramWriterGroupTransport2DataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DatagramWriterGroupTransport2DataType") + } + + return m, nil +} + +func (m *_DatagramWriterGroupTransport2DataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DatagramWriterGroupTransport2DataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DatagramWriterGroupTransport2DataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DatagramWriterGroupTransport2DataType") + } + + if err := WriteSimpleField[uint8](ctx, "messageRepeatCount", m.GetMessageRepeatCount(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'messageRepeatCount' field") + } + + if err := WriteSimpleField[float64](ctx, "messageRepeatDelay", m.GetMessageRepeatDelay(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'messageRepeatDelay' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "address", m.GetAddress(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'address' field") + } + + if err := WriteSimpleField[PascalString](ctx, "qosCategory", m.GetQosCategory(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'qosCategory' field") + } + noOfDatagramQos := int32(utils.InlineIf(bool((m.GetDatagramQos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDatagramQos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDatagramQos", noOfDatagramQos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDatagramQos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "datagramQos", m.GetDatagramQos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'datagramQos' field") + } + + if err := WriteSimpleField[uint32](ctx, "discoveryAnnounceRate", m.GetDiscoveryAnnounceRate(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'discoveryAnnounceRate' field") + } + + if err := WriteSimpleField[PascalString](ctx, "topic", m.GetTopic(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'topic' field") + } + + if popErr := writeBuffer.PopContext("DatagramWriterGroupTransport2DataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DatagramWriterGroupTransport2DataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DatagramWriterGroupTransport2DataType) IsDatagramWriterGroupTransport2DataType() {} + +func (m *_DatagramWriterGroupTransport2DataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DatagramWriterGroupTransport2DataType) deepCopy() *_DatagramWriterGroupTransport2DataType { + if m == nil { + return nil + } + _DatagramWriterGroupTransport2DataTypeCopy := &_DatagramWriterGroupTransport2DataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.MessageRepeatCount, + m.MessageRepeatDelay, + m.Address.DeepCopy().(ExtensionObject), + m.QosCategory.DeepCopy().(PascalString), + utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.DatagramQos), + m.DiscoveryAnnounceRate, + m.Topic.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DatagramWriterGroupTransport2DataTypeCopy +} + +func (m *_DatagramWriterGroupTransport2DataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransportDataType.go new file mode 100644 index 00000000000..b30479d4da3 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DatagramWriterGroupTransportDataType.go @@ -0,0 +1,335 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DatagramWriterGroupTransportDataType is the corresponding interface of DatagramWriterGroupTransportDataType +type DatagramWriterGroupTransportDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetMessageRepeatCount returns MessageRepeatCount (property field) + GetMessageRepeatCount() uint8 + // GetMessageRepeatDelay returns MessageRepeatDelay (property field) + GetMessageRepeatDelay() float64 + // IsDatagramWriterGroupTransportDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDatagramWriterGroupTransportDataType() + // CreateBuilder creates a DatagramWriterGroupTransportDataTypeBuilder + CreateDatagramWriterGroupTransportDataTypeBuilder() DatagramWriterGroupTransportDataTypeBuilder +} + +// _DatagramWriterGroupTransportDataType is the data-structure of this message +type _DatagramWriterGroupTransportDataType struct { + ExtensionObjectDefinitionContract + MessageRepeatCount uint8 + MessageRepeatDelay float64 +} + +var _ DatagramWriterGroupTransportDataType = (*_DatagramWriterGroupTransportDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DatagramWriterGroupTransportDataType)(nil) + +// NewDatagramWriterGroupTransportDataType factory function for _DatagramWriterGroupTransportDataType +func NewDatagramWriterGroupTransportDataType(messageRepeatCount uint8, messageRepeatDelay float64) *_DatagramWriterGroupTransportDataType { + _result := &_DatagramWriterGroupTransportDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + MessageRepeatCount: messageRepeatCount, + MessageRepeatDelay: messageRepeatDelay, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DatagramWriterGroupTransportDataTypeBuilder is a builder for DatagramWriterGroupTransportDataType +type DatagramWriterGroupTransportDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(messageRepeatCount uint8, messageRepeatDelay float64) DatagramWriterGroupTransportDataTypeBuilder + // WithMessageRepeatCount adds MessageRepeatCount (property field) + WithMessageRepeatCount(uint8) DatagramWriterGroupTransportDataTypeBuilder + // WithMessageRepeatDelay adds MessageRepeatDelay (property field) + WithMessageRepeatDelay(float64) DatagramWriterGroupTransportDataTypeBuilder + // Build builds the DatagramWriterGroupTransportDataType or returns an error if something is wrong + Build() (DatagramWriterGroupTransportDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() DatagramWriterGroupTransportDataType +} + +// NewDatagramWriterGroupTransportDataTypeBuilder() creates a DatagramWriterGroupTransportDataTypeBuilder +func NewDatagramWriterGroupTransportDataTypeBuilder() DatagramWriterGroupTransportDataTypeBuilder { + return &_DatagramWriterGroupTransportDataTypeBuilder{_DatagramWriterGroupTransportDataType: new(_DatagramWriterGroupTransportDataType)} +} + +type _DatagramWriterGroupTransportDataTypeBuilder struct { + *_DatagramWriterGroupTransportDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DatagramWriterGroupTransportDataTypeBuilder) = (*_DatagramWriterGroupTransportDataTypeBuilder)(nil) + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) WithMandatoryFields(messageRepeatCount uint8, messageRepeatDelay float64) DatagramWriterGroupTransportDataTypeBuilder { + return b.WithMessageRepeatCount(messageRepeatCount).WithMessageRepeatDelay(messageRepeatDelay) +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) WithMessageRepeatCount(messageRepeatCount uint8) DatagramWriterGroupTransportDataTypeBuilder { + b.MessageRepeatCount = messageRepeatCount + return b +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) WithMessageRepeatDelay(messageRepeatDelay float64) DatagramWriterGroupTransportDataTypeBuilder { + b.MessageRepeatDelay = messageRepeatDelay + return b +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) Build() (DatagramWriterGroupTransportDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DatagramWriterGroupTransportDataType.deepCopy(), nil +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) MustBuild() DatagramWriterGroupTransportDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DatagramWriterGroupTransportDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DatagramWriterGroupTransportDataTypeBuilder) DeepCopy() any { + _copy := b.CreateDatagramWriterGroupTransportDataTypeBuilder().(*_DatagramWriterGroupTransportDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDatagramWriterGroupTransportDataTypeBuilder creates a DatagramWriterGroupTransportDataTypeBuilder +func (b *_DatagramWriterGroupTransportDataType) CreateDatagramWriterGroupTransportDataTypeBuilder() DatagramWriterGroupTransportDataTypeBuilder { + if b == nil { + return NewDatagramWriterGroupTransportDataTypeBuilder() + } + return &_DatagramWriterGroupTransportDataTypeBuilder{_DatagramWriterGroupTransportDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DatagramWriterGroupTransportDataType) GetExtensionId() int32 { + return int32(15534) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DatagramWriterGroupTransportDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DatagramWriterGroupTransportDataType) GetMessageRepeatCount() uint8 { + return m.MessageRepeatCount +} + +func (m *_DatagramWriterGroupTransportDataType) GetMessageRepeatDelay() float64 { + return m.MessageRepeatDelay +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDatagramWriterGroupTransportDataType(structType any) DatagramWriterGroupTransportDataType { + if casted, ok := structType.(DatagramWriterGroupTransportDataType); ok { + return casted + } + if casted, ok := structType.(*DatagramWriterGroupTransportDataType); ok { + return *casted + } + return nil +} + +func (m *_DatagramWriterGroupTransportDataType) GetTypeName() string { + return "DatagramWriterGroupTransportDataType" +} + +func (m *_DatagramWriterGroupTransportDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (messageRepeatCount) + lengthInBits += 8 + + // Simple field (messageRepeatDelay) + lengthInBits += 64 + + return lengthInBits +} + +func (m *_DatagramWriterGroupTransportDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DatagramWriterGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__datagramWriterGroupTransportDataType DatagramWriterGroupTransportDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DatagramWriterGroupTransportDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DatagramWriterGroupTransportDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + messageRepeatCount, err := ReadSimpleField(ctx, "messageRepeatCount", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageRepeatCount' field")) + } + m.MessageRepeatCount = messageRepeatCount + + messageRepeatDelay, err := ReadSimpleField(ctx, "messageRepeatDelay", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageRepeatDelay' field")) + } + m.MessageRepeatDelay = messageRepeatDelay + + if closeErr := readBuffer.CloseContext("DatagramWriterGroupTransportDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DatagramWriterGroupTransportDataType") + } + + return m, nil +} + +func (m *_DatagramWriterGroupTransportDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DatagramWriterGroupTransportDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DatagramWriterGroupTransportDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DatagramWriterGroupTransportDataType") + } + + if err := WriteSimpleField[uint8](ctx, "messageRepeatCount", m.GetMessageRepeatCount(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'messageRepeatCount' field") + } + + if err := WriteSimpleField[float64](ctx, "messageRepeatDelay", m.GetMessageRepeatDelay(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'messageRepeatDelay' field") + } + + if popErr := writeBuffer.PopContext("DatagramWriterGroupTransportDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DatagramWriterGroupTransportDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DatagramWriterGroupTransportDataType) IsDatagramWriterGroupTransportDataType() {} + +func (m *_DatagramWriterGroupTransportDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DatagramWriterGroupTransportDataType) deepCopy() *_DatagramWriterGroupTransportDataType { + if m == nil { + return nil + } + _DatagramWriterGroupTransportDataTypeCopy := &_DatagramWriterGroupTransportDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.MessageRepeatCount, + m.MessageRepeatDelay, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DatagramWriterGroupTransportDataTypeCopy +} + +func (m *_DatagramWriterGroupTransportDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/Date.go b/plc4go/protocols/opcua/readwrite/model/Date.go deleted file mode 100644 index efbc81301c7..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/Date.go +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// Date is the corresponding interface of Date -type Date interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -// DateExactly can be used when we want exactly this type and not a type which fulfills Date. -// This is useful for switch cases. -type DateExactly interface { - Date - isDate() bool -} - -// _Date is the data-structure of this message -type _Date struct { -} - -// NewDate factory function for _Date -func NewDate() *_Date { - return &_Date{} -} - -// Deprecated: use the interface for direct cast -func CastDate(structType any) Date { - if casted, ok := structType.(Date); ok { - return casted - } - if casted, ok := structType.(*Date); ok { - return *casted - } - return nil -} - -func (m *_Date) GetTypeName() string { - return "Date" -} - -func (m *_Date) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(0) - - return lengthInBits -} - -func (m *_Date) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func DateParse(ctx context.Context, theBytes []byte) (Date, error) { - return DateParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func DateParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (Date, error) { - positionAware := readBuffer - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pullErr := readBuffer.PullContext("Date"); pullErr != nil { - return nil, errors.Wrap(pullErr, "Error pulling for Date") - } - currentPos := positionAware.GetPos() - _ = currentPos - - if closeErr := readBuffer.CloseContext("Date"); closeErr != nil { - return nil, errors.Wrap(closeErr, "Error closing for Date") - } - - // Create the instance - return &_Date{}, nil -} - -func (m *_Date) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) - if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (m *_Date) SerializeWithWriteBuffer(ctx context.Context, wb utils.WriteBuffer) error { - positionAware := wb - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pushErr := wb.PushContext("Date"); pushErr != nil { - return errors.Wrap(pushErr, "Error pushing for Date") - } - - if popErr := wb.PopContext("Date"); popErr != nil { - return errors.Wrap(popErr, "Error popping for Date") - } - return nil -} - -func (m *_Date) isDate() bool { - return true -} - -func (m *_Date) String() string { - if m == nil { - return "" - } - wb := utils.NewWriteBufferBoxBased(utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), utils.WithWriteBufferBoxBasedMergeSingleBoxes()) - if err := wb.WriteSerializable(context.Background(), m); err != nil { - return err.Error() - } - return wb.GetBox().String() -} diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteAtTimeDetails.go b/plc4go/protocols/opcua/readwrite/model/DeleteAtTimeDetails.go new file mode 100644 index 00000000000..e82fcbd386d --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DeleteAtTimeDetails.go @@ -0,0 +1,374 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DeleteAtTimeDetails is the corresponding interface of DeleteAtTimeDetails +type DeleteAtTimeDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetReqTimes returns ReqTimes (property field) + GetReqTimes() []int64 + // IsDeleteAtTimeDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDeleteAtTimeDetails() + // CreateBuilder creates a DeleteAtTimeDetailsBuilder + CreateDeleteAtTimeDetailsBuilder() DeleteAtTimeDetailsBuilder +} + +// _DeleteAtTimeDetails is the data-structure of this message +type _DeleteAtTimeDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + ReqTimes []int64 +} + +var _ DeleteAtTimeDetails = (*_DeleteAtTimeDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DeleteAtTimeDetails)(nil) + +// NewDeleteAtTimeDetails factory function for _DeleteAtTimeDetails +func NewDeleteAtTimeDetails(nodeId NodeId, reqTimes []int64) *_DeleteAtTimeDetails { + if nodeId == nil { + panic("nodeId of type NodeId for DeleteAtTimeDetails must not be nil") + } + _result := &_DeleteAtTimeDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + ReqTimes: reqTimes, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DeleteAtTimeDetailsBuilder is a builder for DeleteAtTimeDetails +type DeleteAtTimeDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, reqTimes []int64) DeleteAtTimeDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) DeleteAtTimeDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) DeleteAtTimeDetailsBuilder + // WithReqTimes adds ReqTimes (property field) + WithReqTimes(...int64) DeleteAtTimeDetailsBuilder + // Build builds the DeleteAtTimeDetails or returns an error if something is wrong + Build() (DeleteAtTimeDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() DeleteAtTimeDetails +} + +// NewDeleteAtTimeDetailsBuilder() creates a DeleteAtTimeDetailsBuilder +func NewDeleteAtTimeDetailsBuilder() DeleteAtTimeDetailsBuilder { + return &_DeleteAtTimeDetailsBuilder{_DeleteAtTimeDetails: new(_DeleteAtTimeDetails)} +} + +type _DeleteAtTimeDetailsBuilder struct { + *_DeleteAtTimeDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DeleteAtTimeDetailsBuilder) = (*_DeleteAtTimeDetailsBuilder)(nil) + +func (b *_DeleteAtTimeDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DeleteAtTimeDetailsBuilder) WithMandatoryFields(nodeId NodeId, reqTimes []int64) DeleteAtTimeDetailsBuilder { + return b.WithNodeId(nodeId).WithReqTimes(reqTimes...) +} + +func (b *_DeleteAtTimeDetailsBuilder) WithNodeId(nodeId NodeId) DeleteAtTimeDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_DeleteAtTimeDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) DeleteAtTimeDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_DeleteAtTimeDetailsBuilder) WithReqTimes(reqTimes ...int64) DeleteAtTimeDetailsBuilder { + b.ReqTimes = reqTimes + return b +} + +func (b *_DeleteAtTimeDetailsBuilder) Build() (DeleteAtTimeDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DeleteAtTimeDetails.deepCopy(), nil +} + +func (b *_DeleteAtTimeDetailsBuilder) MustBuild() DeleteAtTimeDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DeleteAtTimeDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DeleteAtTimeDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DeleteAtTimeDetailsBuilder) DeepCopy() any { + _copy := b.CreateDeleteAtTimeDetailsBuilder().(*_DeleteAtTimeDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDeleteAtTimeDetailsBuilder creates a DeleteAtTimeDetailsBuilder +func (b *_DeleteAtTimeDetails) CreateDeleteAtTimeDetailsBuilder() DeleteAtTimeDetailsBuilder { + if b == nil { + return NewDeleteAtTimeDetailsBuilder() + } + return &_DeleteAtTimeDetailsBuilder{_DeleteAtTimeDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DeleteAtTimeDetails) GetExtensionId() int32 { + return int32(691) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DeleteAtTimeDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DeleteAtTimeDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_DeleteAtTimeDetails) GetReqTimes() []int64 { + return m.ReqTimes +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDeleteAtTimeDetails(structType any) DeleteAtTimeDetails { + if casted, ok := structType.(DeleteAtTimeDetails); ok { + return casted + } + if casted, ok := structType.(*DeleteAtTimeDetails); ok { + return *casted + } + return nil +} + +func (m *_DeleteAtTimeDetails) GetTypeName() string { + return "DeleteAtTimeDetails" +} + +func (m *_DeleteAtTimeDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Implicit Field (noOfReqTimes) + lengthInBits += 32 + + // Array field + if len(m.ReqTimes) > 0 { + lengthInBits += 64 * uint16(len(m.ReqTimes)) + } + + return lengthInBits +} + +func (m *_DeleteAtTimeDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DeleteAtTimeDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteAtTimeDetails DeleteAtTimeDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DeleteAtTimeDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DeleteAtTimeDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + noOfReqTimes, err := ReadImplicitField[int32](ctx, "noOfReqTimes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReqTimes' field")) + } + _ = noOfReqTimes + + reqTimes, err := ReadCountArrayField[int64](ctx, "reqTimes", ReadSignedLong(readBuffer, uint8(64)), uint64(noOfReqTimes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'reqTimes' field")) + } + m.ReqTimes = reqTimes + + if closeErr := readBuffer.CloseContext("DeleteAtTimeDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DeleteAtTimeDetails") + } + + return m, nil +} + +func (m *_DeleteAtTimeDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DeleteAtTimeDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DeleteAtTimeDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DeleteAtTimeDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + noOfReqTimes := int32(utils.InlineIf(bool((m.GetReqTimes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReqTimes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReqTimes", noOfReqTimes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfReqTimes' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "reqTimes", m.GetReqTimes(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'reqTimes' field") + } + + if popErr := writeBuffer.PopContext("DeleteAtTimeDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DeleteAtTimeDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DeleteAtTimeDetails) IsDeleteAtTimeDetails() {} + +func (m *_DeleteAtTimeDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DeleteAtTimeDetails) deepCopy() *_DeleteAtTimeDetails { + if m == nil { + return nil + } + _DeleteAtTimeDetailsCopy := &_DeleteAtTimeDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + utils.DeepCopySlice[int64, int64](m.ReqTimes), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DeleteAtTimeDetailsCopy +} + +func (m *_DeleteAtTimeDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteEventDetails.go b/plc4go/protocols/opcua/readwrite/model/DeleteEventDetails.go new file mode 100644 index 00000000000..77363ae26da --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DeleteEventDetails.go @@ -0,0 +1,379 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DeleteEventDetails is the corresponding interface of DeleteEventDetails +type DeleteEventDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetEventIds returns EventIds (property field) + GetEventIds() []PascalByteString + // IsDeleteEventDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDeleteEventDetails() + // CreateBuilder creates a DeleteEventDetailsBuilder + CreateDeleteEventDetailsBuilder() DeleteEventDetailsBuilder +} + +// _DeleteEventDetails is the data-structure of this message +type _DeleteEventDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + EventIds []PascalByteString +} + +var _ DeleteEventDetails = (*_DeleteEventDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DeleteEventDetails)(nil) + +// NewDeleteEventDetails factory function for _DeleteEventDetails +func NewDeleteEventDetails(nodeId NodeId, eventIds []PascalByteString) *_DeleteEventDetails { + if nodeId == nil { + panic("nodeId of type NodeId for DeleteEventDetails must not be nil") + } + _result := &_DeleteEventDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + EventIds: eventIds, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DeleteEventDetailsBuilder is a builder for DeleteEventDetails +type DeleteEventDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, eventIds []PascalByteString) DeleteEventDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) DeleteEventDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) DeleteEventDetailsBuilder + // WithEventIds adds EventIds (property field) + WithEventIds(...PascalByteString) DeleteEventDetailsBuilder + // Build builds the DeleteEventDetails or returns an error if something is wrong + Build() (DeleteEventDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() DeleteEventDetails +} + +// NewDeleteEventDetailsBuilder() creates a DeleteEventDetailsBuilder +func NewDeleteEventDetailsBuilder() DeleteEventDetailsBuilder { + return &_DeleteEventDetailsBuilder{_DeleteEventDetails: new(_DeleteEventDetails)} +} + +type _DeleteEventDetailsBuilder struct { + *_DeleteEventDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DeleteEventDetailsBuilder) = (*_DeleteEventDetailsBuilder)(nil) + +func (b *_DeleteEventDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DeleteEventDetailsBuilder) WithMandatoryFields(nodeId NodeId, eventIds []PascalByteString) DeleteEventDetailsBuilder { + return b.WithNodeId(nodeId).WithEventIds(eventIds...) +} + +func (b *_DeleteEventDetailsBuilder) WithNodeId(nodeId NodeId) DeleteEventDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_DeleteEventDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) DeleteEventDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_DeleteEventDetailsBuilder) WithEventIds(eventIds ...PascalByteString) DeleteEventDetailsBuilder { + b.EventIds = eventIds + return b +} + +func (b *_DeleteEventDetailsBuilder) Build() (DeleteEventDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DeleteEventDetails.deepCopy(), nil +} + +func (b *_DeleteEventDetailsBuilder) MustBuild() DeleteEventDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DeleteEventDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DeleteEventDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DeleteEventDetailsBuilder) DeepCopy() any { + _copy := b.CreateDeleteEventDetailsBuilder().(*_DeleteEventDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDeleteEventDetailsBuilder creates a DeleteEventDetailsBuilder +func (b *_DeleteEventDetails) CreateDeleteEventDetailsBuilder() DeleteEventDetailsBuilder { + if b == nil { + return NewDeleteEventDetailsBuilder() + } + return &_DeleteEventDetailsBuilder{_DeleteEventDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DeleteEventDetails) GetExtensionId() int32 { + return int32(694) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DeleteEventDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DeleteEventDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_DeleteEventDetails) GetEventIds() []PascalByteString { + return m.EventIds +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDeleteEventDetails(structType any) DeleteEventDetails { + if casted, ok := structType.(DeleteEventDetails); ok { + return casted + } + if casted, ok := structType.(*DeleteEventDetails); ok { + return *casted + } + return nil +} + +func (m *_DeleteEventDetails) GetTypeName() string { + return "DeleteEventDetails" +} + +func (m *_DeleteEventDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Implicit Field (noOfEventIds) + lengthInBits += 32 + + // Array field + if len(m.EventIds) > 0 { + for _curItem, element := range m.EventIds { + arrayCtx := utils.CreateArrayContext(ctx, len(m.EventIds), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_DeleteEventDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DeleteEventDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteEventDetails DeleteEventDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DeleteEventDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DeleteEventDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + noOfEventIds, err := ReadImplicitField[int32](ctx, "noOfEventIds", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEventIds' field")) + } + _ = noOfEventIds + + eventIds, err := ReadCountArrayField[PascalByteString](ctx, "eventIds", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfEventIds)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eventIds' field")) + } + m.EventIds = eventIds + + if closeErr := readBuffer.CloseContext("DeleteEventDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DeleteEventDetails") + } + + return m, nil +} + +func (m *_DeleteEventDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DeleteEventDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DeleteEventDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DeleteEventDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + noOfEventIds := int32(utils.InlineIf(bool((m.GetEventIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEventIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEventIds", noOfEventIds, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfEventIds' field") + } + + if err := WriteComplexTypeArrayField(ctx, "eventIds", m.GetEventIds(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'eventIds' field") + } + + if popErr := writeBuffer.PopContext("DeleteEventDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DeleteEventDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DeleteEventDetails) IsDeleteEventDetails() {} + +func (m *_DeleteEventDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DeleteEventDetails) deepCopy() *_DeleteEventDetails { + if m == nil { + return nil + } + _DeleteEventDetailsCopy := &_DeleteEventDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + utils.DeepCopySlice[PascalByteString, PascalByteString](m.EventIds), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DeleteEventDetailsCopy +} + +func (m *_DeleteEventDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsRequest.go b/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsRequest.go index 6a982c94ed1..782df8df5c3 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsRequest.go @@ -41,11 +41,9 @@ type DeleteMonitoredItemsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 - // GetNoOfMonitoredItemIds returns NoOfMonitoredItemIds (property field) - GetNoOfMonitoredItemIds() int32 // GetMonitoredItemIds returns MonitoredItemIds (property field) GetMonitoredItemIds() []uint32 // IsDeleteMonitoredItemsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,25 +55,23 @@ type DeleteMonitoredItemsRequest interface { // _DeleteMonitoredItemsRequest is the data-structure of this message type _DeleteMonitoredItemsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - SubscriptionId uint32 - NoOfMonitoredItemIds int32 - MonitoredItemIds []uint32 + RequestHeader RequestHeader + SubscriptionId uint32 + MonitoredItemIds []uint32 } var _ DeleteMonitoredItemsRequest = (*_DeleteMonitoredItemsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteMonitoredItemsRequest)(nil) // NewDeleteMonitoredItemsRequest factory function for _DeleteMonitoredItemsRequest -func NewDeleteMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, noOfMonitoredItemIds int32, monitoredItemIds []uint32) *_DeleteMonitoredItemsRequest { +func NewDeleteMonitoredItemsRequest(requestHeader RequestHeader, subscriptionId uint32, monitoredItemIds []uint32) *_DeleteMonitoredItemsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for DeleteMonitoredItemsRequest must not be nil") + panic("requestHeader of type RequestHeader for DeleteMonitoredItemsRequest must not be nil") } _result := &_DeleteMonitoredItemsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, SubscriptionId: subscriptionId, - NoOfMonitoredItemIds: noOfMonitoredItemIds, MonitoredItemIds: monitoredItemIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -91,15 +87,13 @@ func NewDeleteMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, sub type DeleteMonitoredItemsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, noOfMonitoredItemIds int32, monitoredItemIds []uint32) DeleteMonitoredItemsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, monitoredItemIds []uint32) DeleteMonitoredItemsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) DeleteMonitoredItemsRequestBuilder + WithRequestHeader(RequestHeader) DeleteMonitoredItemsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteMonitoredItemsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteMonitoredItemsRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) DeleteMonitoredItemsRequestBuilder - // WithNoOfMonitoredItemIds adds NoOfMonitoredItemIds (property field) - WithNoOfMonitoredItemIds(int32) DeleteMonitoredItemsRequestBuilder // WithMonitoredItemIds adds MonitoredItemIds (property field) WithMonitoredItemIds(...uint32) DeleteMonitoredItemsRequestBuilder // Build builds the DeleteMonitoredItemsRequest or returns an error if something is wrong @@ -127,24 +121,24 @@ func (b *_DeleteMonitoredItemsRequestBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, noOfMonitoredItemIds int32, monitoredItemIds []uint32) DeleteMonitoredItemsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithNoOfMonitoredItemIds(noOfMonitoredItemIds).WithMonitoredItemIds(monitoredItemIds...) +func (b *_DeleteMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, monitoredItemIds []uint32) DeleteMonitoredItemsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithMonitoredItemIds(monitoredItemIds...) } -func (b *_DeleteMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) DeleteMonitoredItemsRequestBuilder { +func (b *_DeleteMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) DeleteMonitoredItemsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_DeleteMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteMonitoredItemsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteMonitoredItemsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -154,11 +148,6 @@ func (b *_DeleteMonitoredItemsRequestBuilder) WithSubscriptionId(subscriptionId return b } -func (b *_DeleteMonitoredItemsRequestBuilder) WithNoOfMonitoredItemIds(noOfMonitoredItemIds int32) DeleteMonitoredItemsRequestBuilder { - b.NoOfMonitoredItemIds = noOfMonitoredItemIds - return b -} - func (b *_DeleteMonitoredItemsRequestBuilder) WithMonitoredItemIds(monitoredItemIds ...uint32) DeleteMonitoredItemsRequestBuilder { b.MonitoredItemIds = monitoredItemIds return b @@ -220,8 +209,8 @@ func (b *_DeleteMonitoredItemsRequest) CreateDeleteMonitoredItemsRequestBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteMonitoredItemsRequest) GetIdentifier() string { - return "781" +func (m *_DeleteMonitoredItemsRequest) GetExtensionId() int32 { + return int32(781) } /////////////////////// @@ -238,7 +227,7 @@ func (m *_DeleteMonitoredItemsRequest) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteMonitoredItemsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_DeleteMonitoredItemsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -246,10 +235,6 @@ func (m *_DeleteMonitoredItemsRequest) GetSubscriptionId() uint32 { return m.SubscriptionId } -func (m *_DeleteMonitoredItemsRequest) GetNoOfMonitoredItemIds() int32 { - return m.NoOfMonitoredItemIds -} - func (m *_DeleteMonitoredItemsRequest) GetMonitoredItemIds() []uint32 { return m.MonitoredItemIds } @@ -283,7 +268,7 @@ func (m *_DeleteMonitoredItemsRequest) GetLengthInBits(ctx context.Context) uint // Simple field (subscriptionId) lengthInBits += 32 - // Simple field (noOfMonitoredItemIds) + // Implicit Field (noOfMonitoredItemIds) lengthInBits += 32 // Array field @@ -298,7 +283,7 @@ func (m *_DeleteMonitoredItemsRequest) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteMonitoredItemsRequest DeleteMonitoredItemsRequest, err error) { +func (m *_DeleteMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteMonitoredItemsRequest DeleteMonitoredItemsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -309,7 +294,7 @@ func (m *_DeleteMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -321,11 +306,11 @@ func (m *_DeleteMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti } m.SubscriptionId = subscriptionId - noOfMonitoredItemIds, err := ReadSimpleField(ctx, "noOfMonitoredItemIds", ReadSignedInt(readBuffer, uint8(32))) + noOfMonitoredItemIds, err := ReadImplicitField[int32](ctx, "noOfMonitoredItemIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfMonitoredItemIds' field")) } - m.NoOfMonitoredItemIds = noOfMonitoredItemIds + _ = noOfMonitoredItemIds monitoredItemIds, err := ReadCountArrayField[uint32](ctx, "monitoredItemIds", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfMonitoredItemIds)) if err != nil { @@ -358,15 +343,15 @@ func (m *_DeleteMonitoredItemsRequest) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(pushErr, "Error pushing for DeleteMonitoredItemsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } if err := WriteSimpleField[uint32](ctx, "subscriptionId", m.GetSubscriptionId(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'subscriptionId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfMonitoredItemIds", m.GetNoOfMonitoredItemIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfMonitoredItemIds := int32(utils.InlineIf(bool((m.GetMonitoredItemIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetMonitoredItemIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfMonitoredItemIds", noOfMonitoredItemIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfMonitoredItemIds' field") } @@ -394,9 +379,8 @@ func (m *_DeleteMonitoredItemsRequest) deepCopy() *_DeleteMonitoredItemsRequest } _DeleteMonitoredItemsRequestCopy := &_DeleteMonitoredItemsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, - m.NoOfMonitoredItemIds, utils.DeepCopySlice[uint32, uint32](m.MonitoredItemIds), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsResponse.go b/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsResponse.go index 477c9636cd3..651005930f7 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteMonitoredItemsResponse.go @@ -41,13 +41,9 @@ type DeleteMonitoredItemsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsDeleteMonitoredItemsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type DeleteMonitoredItemsResponse interface { // _DeleteMonitoredItemsResponse is the data-structure of this message type _DeleteMonitoredItemsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ DeleteMonitoredItemsResponse = (*_DeleteMonitoredItemsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteMonitoredItemsResponse)(nil) // NewDeleteMonitoredItemsResponse factory function for _DeleteMonitoredItemsResponse -func NewDeleteMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_DeleteMonitoredItemsResponse { +func NewDeleteMonitoredItemsResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_DeleteMonitoredItemsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for DeleteMonitoredItemsResponse must not be nil") + panic("responseHeader of type ResponseHeader for DeleteMonitoredItemsResponse must not be nil") } _result := &_DeleteMonitoredItemsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewDeleteMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, n type DeleteMonitoredItemsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteMonitoredItemsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteMonitoredItemsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) DeleteMonitoredItemsResponseBuilder + WithResponseHeader(ResponseHeader) DeleteMonitoredItemsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteMonitoredItemsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) DeleteMonitoredItemsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteMonitoredItemsResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) DeleteMonitoredItemsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) DeleteMonitoredItemsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) DeleteMonitoredItemsResponseBuilder // Build builds the DeleteMonitoredItemsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_DeleteMonitoredItemsResponseBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteMonitoredItemsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_DeleteMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteMonitoredItemsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_DeleteMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) DeleteMonitoredItemsResponseBuilder { +func (b *_DeleteMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) DeleteMonitoredItemsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_DeleteMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteMonitoredItemsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteMonitoredItemsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_DeleteMonitoredItemsResponseBuilder) WithNoOfResults(noOfResults int32) DeleteMonitoredItemsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_DeleteMonitoredItemsResponseBuilder) WithResults(results ...StatusCode) DeleteMonitoredItemsResponseBuilder { b.Results = results return b } -func (b *_DeleteMonitoredItemsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) DeleteMonitoredItemsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_DeleteMonitoredItemsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) DeleteMonitoredItemsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_DeleteMonitoredItemsResponse) CreateDeleteMonitoredItemsResponseBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteMonitoredItemsResponse) GetIdentifier() string { - return "784" +func (m *_DeleteMonitoredItemsResponse) GetExtensionId() int32 { + return int32(784) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_DeleteMonitoredItemsResponse) GetParent() ExtensionObjectDefinitionCon /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteMonitoredItemsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_DeleteMonitoredItemsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_DeleteMonitoredItemsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_DeleteMonitoredItemsResponse) GetResults() []StatusCode { return m.Results } -func (m *_DeleteMonitoredItemsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_DeleteMonitoredItemsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_DeleteMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_DeleteMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_DeleteMonitoredItemsResponse) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteMonitoredItemsResponse DeleteMonitoredItemsResponse, err error) { +func (m *_DeleteMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteMonitoredItemsResponse DeleteMonitoredItemsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_DeleteMonitoredItemsResponse) parse(ctx context.Context, readBuffer ut currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_DeleteMonitoredItemsResponse) parse(ctx context.Context, readBuffer ut } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_DeleteMonitoredItemsResponse) SerializeWithWriteBuffer(ctx context.Con return errors.Wrap(pushErr, "Error pushing for DeleteMonitoredItemsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_DeleteMonitoredItemsResponse) deepCopy() *_DeleteMonitoredItemsRespons } _DeleteMonitoredItemsResponseCopy := &_DeleteMonitoredItemsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteNodesItem.go b/plc4go/protocols/opcua/readwrite/model/DeleteNodesItem.go index 02c6c4ff6c4..8053e87230a 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteNodesItem.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteNodesItem.go @@ -200,8 +200,8 @@ func (b *_DeleteNodesItem) CreateDeleteNodesItemBuilder() DeleteNodesItemBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteNodesItem) GetIdentifier() string { - return "384" +func (m *_DeleteNodesItem) GetExtensionId() int32 { + return int32(384) } /////////////////////// @@ -265,7 +265,7 @@ func (m *_DeleteNodesItem) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteNodesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteNodesItem DeleteNodesItem, err error) { +func (m *_DeleteNodesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteNodesItem DeleteNodesItem, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteNodesRequest.go b/plc4go/protocols/opcua/readwrite/model/DeleteNodesRequest.go index 486f6f6117c..60b2ef2c4b0 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteNodesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteNodesRequest.go @@ -41,11 +41,9 @@ type DeleteNodesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfNodesToDelete returns NoOfNodesToDelete (property field) - GetNoOfNodesToDelete() int32 + GetRequestHeader() RequestHeader // GetNodesToDelete returns NodesToDelete (property field) - GetNodesToDelete() []ExtensionObjectDefinition + GetNodesToDelete() []DeleteNodesItem // IsDeleteNodesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsDeleteNodesRequest() // CreateBuilder creates a DeleteNodesRequestBuilder @@ -55,23 +53,21 @@ type DeleteNodesRequest interface { // _DeleteNodesRequest is the data-structure of this message type _DeleteNodesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfNodesToDelete int32 - NodesToDelete []ExtensionObjectDefinition + RequestHeader RequestHeader + NodesToDelete []DeleteNodesItem } var _ DeleteNodesRequest = (*_DeleteNodesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteNodesRequest)(nil) // NewDeleteNodesRequest factory function for _DeleteNodesRequest -func NewDeleteNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToDelete int32, nodesToDelete []ExtensionObjectDefinition) *_DeleteNodesRequest { +func NewDeleteNodesRequest(requestHeader RequestHeader, nodesToDelete []DeleteNodesItem) *_DeleteNodesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for DeleteNodesRequest must not be nil") + panic("requestHeader of type RequestHeader for DeleteNodesRequest must not be nil") } _result := &_DeleteNodesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfNodesToDelete: noOfNodesToDelete, NodesToDelete: nodesToDelete, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewDeleteNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToD type DeleteNodesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToDelete int32, nodesToDelete []ExtensionObjectDefinition) DeleteNodesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, nodesToDelete []DeleteNodesItem) DeleteNodesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) DeleteNodesRequestBuilder + WithRequestHeader(RequestHeader) DeleteNodesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteNodesRequestBuilder - // WithNoOfNodesToDelete adds NoOfNodesToDelete (property field) - WithNoOfNodesToDelete(int32) DeleteNodesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteNodesRequestBuilder // WithNodesToDelete adds NodesToDelete (property field) - WithNodesToDelete(...ExtensionObjectDefinition) DeleteNodesRequestBuilder + WithNodesToDelete(...DeleteNodesItem) DeleteNodesRequestBuilder // Build builds the DeleteNodesRequest or returns an error if something is wrong Build() (DeleteNodesRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_DeleteNodesRequestBuilder) setParent(contract ExtensionObjectDefinitio b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteNodesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToDelete int32, nodesToDelete []ExtensionObjectDefinition) DeleteNodesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfNodesToDelete(noOfNodesToDelete).WithNodesToDelete(nodesToDelete...) +func (b *_DeleteNodesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, nodesToDelete []DeleteNodesItem) DeleteNodesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithNodesToDelete(nodesToDelete...) } -func (b *_DeleteNodesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) DeleteNodesRequestBuilder { +func (b *_DeleteNodesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) DeleteNodesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_DeleteNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteNodesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteNodesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_DeleteNodesRequestBuilder) WithNoOfNodesToDelete(noOfNodesToDelete int32) DeleteNodesRequestBuilder { - b.NoOfNodesToDelete = noOfNodesToDelete - return b -} - -func (b *_DeleteNodesRequestBuilder) WithNodesToDelete(nodesToDelete ...ExtensionObjectDefinition) DeleteNodesRequestBuilder { +func (b *_DeleteNodesRequestBuilder) WithNodesToDelete(nodesToDelete ...DeleteNodesItem) DeleteNodesRequestBuilder { b.NodesToDelete = nodesToDelete return b } @@ -209,8 +198,8 @@ func (b *_DeleteNodesRequest) CreateDeleteNodesRequestBuilder() DeleteNodesReque /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteNodesRequest) GetIdentifier() string { - return "500" +func (m *_DeleteNodesRequest) GetExtensionId() int32 { + return int32(500) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_DeleteNodesRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteNodesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_DeleteNodesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_DeleteNodesRequest) GetNoOfNodesToDelete() int32 { - return m.NoOfNodesToDelete -} - -func (m *_DeleteNodesRequest) GetNodesToDelete() []ExtensionObjectDefinition { +func (m *_DeleteNodesRequest) GetNodesToDelete() []DeleteNodesItem { return m.NodesToDelete } @@ -265,7 +250,7 @@ func (m *_DeleteNodesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfNodesToDelete) + // Implicit Field (noOfNodesToDelete) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_DeleteNodesRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteNodesRequest DeleteNodesRequest, err error) { +func (m *_DeleteNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteNodesRequest DeleteNodesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_DeleteNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBu currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfNodesToDelete, err := ReadSimpleField(ctx, "noOfNodesToDelete", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToDelete, err := ReadImplicitField[int32](ctx, "noOfNodesToDelete", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToDelete' field")) } - m.NoOfNodesToDelete = noOfNodesToDelete + _ = noOfNodesToDelete - nodesToDelete, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToDelete", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("384")), readBuffer), uint64(noOfNodesToDelete)) + nodesToDelete, err := ReadCountArrayField[DeleteNodesItem](ctx, "nodesToDelete", ReadComplex[DeleteNodesItem](ExtensionObjectDefinitionParseWithBufferProducer[DeleteNodesItem]((int32)(int32(384))), readBuffer), uint64(noOfNodesToDelete)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToDelete' field")) } @@ -339,11 +324,11 @@ func (m *_DeleteNodesRequest) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(pushErr, "Error pushing for DeleteNodesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToDelete", m.GetNoOfNodesToDelete(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToDelete := int32(utils.InlineIf(bool((m.GetNodesToDelete()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToDelete()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToDelete", noOfNodesToDelete, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToDelete' field") } @@ -371,9 +356,8 @@ func (m *_DeleteNodesRequest) deepCopy() *_DeleteNodesRequest { } _DeleteNodesRequestCopy := &_DeleteNodesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodesToDelete, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToDelete), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[DeleteNodesItem, DeleteNodesItem](m.NodesToDelete), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _DeleteNodesRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteNodesResponse.go b/plc4go/protocols/opcua/readwrite/model/DeleteNodesResponse.go index 2258b8352d7..eb2956eb061 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteNodesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteNodesResponse.go @@ -41,13 +41,9 @@ type DeleteNodesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsDeleteNodesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type DeleteNodesResponse interface { // _DeleteNodesResponse is the data-structure of this message type _DeleteNodesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ DeleteNodesResponse = (*_DeleteNodesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteNodesResponse)(nil) // NewDeleteNodesResponse factory function for _DeleteNodesResponse -func NewDeleteNodesResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_DeleteNodesResponse { +func NewDeleteNodesResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_DeleteNodesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for DeleteNodesResponse must not be nil") + panic("responseHeader of type ResponseHeader for DeleteNodesResponse must not be nil") } _result := &_DeleteNodesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewDeleteNodesResponse(responseHeader ExtensionObjectDefinition, noOfResult type DeleteNodesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteNodesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteNodesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) DeleteNodesResponseBuilder + WithResponseHeader(ResponseHeader) DeleteNodesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteNodesResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) DeleteNodesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteNodesResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) DeleteNodesResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) DeleteNodesResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) DeleteNodesResponseBuilder // Build builds the DeleteNodesResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_DeleteNodesResponseBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteNodesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteNodesResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_DeleteNodesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteNodesResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_DeleteNodesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) DeleteNodesResponseBuilder { +func (b *_DeleteNodesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) DeleteNodesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_DeleteNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteNodesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteNodesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_DeleteNodesResponseBuilder) WithNoOfResults(noOfResults int32) DeleteNodesResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_DeleteNodesResponseBuilder) WithResults(results ...StatusCode) DeleteNodesResponseBuilder { b.Results = results return b } -func (b *_DeleteNodesResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) DeleteNodesResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_DeleteNodesResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) DeleteNodesResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_DeleteNodesResponse) CreateDeleteNodesResponseBuilder() DeleteNodesRes /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteNodesResponse) GetIdentifier() string { - return "503" +func (m *_DeleteNodesResponse) GetExtensionId() int32 { + return int32(503) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_DeleteNodesResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteNodesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_DeleteNodesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_DeleteNodesResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_DeleteNodesResponse) GetResults() []StatusCode { return m.Results } -func (m *_DeleteNodesResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_DeleteNodesResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_DeleteNodesResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_DeleteNodesResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_DeleteNodesResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteNodesResponse DeleteNodesResponse, err error) { +func (m *_DeleteNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteNodesResponse DeleteNodesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_DeleteNodesResponse) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_DeleteNodesResponse) parse(ctx context.Context, readBuffer utils.ReadB } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_DeleteNodesResponse) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for DeleteNodesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_DeleteNodesResponse) deepCopy() *_DeleteNodesResponse { } _DeleteNodesResponseCopy := &_DeleteNodesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteRawModifiedDetails.go b/plc4go/protocols/opcua/readwrite/model/DeleteRawModifiedDetails.go new file mode 100644 index 00000000000..a2bff575997 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/DeleteRawModifiedDetails.go @@ -0,0 +1,433 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// DeleteRawModifiedDetails is the corresponding interface of DeleteRawModifiedDetails +type DeleteRawModifiedDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetIsDeleteModified returns IsDeleteModified (property field) + GetIsDeleteModified() bool + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetEndTime returns EndTime (property field) + GetEndTime() int64 + // IsDeleteRawModifiedDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsDeleteRawModifiedDetails() + // CreateBuilder creates a DeleteRawModifiedDetailsBuilder + CreateDeleteRawModifiedDetailsBuilder() DeleteRawModifiedDetailsBuilder +} + +// _DeleteRawModifiedDetails is the data-structure of this message +type _DeleteRawModifiedDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + IsDeleteModified bool + StartTime int64 + EndTime int64 + // Reserved Fields + reservedField0 *uint8 +} + +var _ DeleteRawModifiedDetails = (*_DeleteRawModifiedDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_DeleteRawModifiedDetails)(nil) + +// NewDeleteRawModifiedDetails factory function for _DeleteRawModifiedDetails +func NewDeleteRawModifiedDetails(nodeId NodeId, isDeleteModified bool, startTime int64, endTime int64) *_DeleteRawModifiedDetails { + if nodeId == nil { + panic("nodeId of type NodeId for DeleteRawModifiedDetails must not be nil") + } + _result := &_DeleteRawModifiedDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + IsDeleteModified: isDeleteModified, + StartTime: startTime, + EndTime: endTime, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// DeleteRawModifiedDetailsBuilder is a builder for DeleteRawModifiedDetails +type DeleteRawModifiedDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, isDeleteModified bool, startTime int64, endTime int64) DeleteRawModifiedDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) DeleteRawModifiedDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) DeleteRawModifiedDetailsBuilder + // WithIsDeleteModified adds IsDeleteModified (property field) + WithIsDeleteModified(bool) DeleteRawModifiedDetailsBuilder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) DeleteRawModifiedDetailsBuilder + // WithEndTime adds EndTime (property field) + WithEndTime(int64) DeleteRawModifiedDetailsBuilder + // Build builds the DeleteRawModifiedDetails or returns an error if something is wrong + Build() (DeleteRawModifiedDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() DeleteRawModifiedDetails +} + +// NewDeleteRawModifiedDetailsBuilder() creates a DeleteRawModifiedDetailsBuilder +func NewDeleteRawModifiedDetailsBuilder() DeleteRawModifiedDetailsBuilder { + return &_DeleteRawModifiedDetailsBuilder{_DeleteRawModifiedDetails: new(_DeleteRawModifiedDetails)} +} + +type _DeleteRawModifiedDetailsBuilder struct { + *_DeleteRawModifiedDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (DeleteRawModifiedDetailsBuilder) = (*_DeleteRawModifiedDetailsBuilder)(nil) + +func (b *_DeleteRawModifiedDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithMandatoryFields(nodeId NodeId, isDeleteModified bool, startTime int64, endTime int64) DeleteRawModifiedDetailsBuilder { + return b.WithNodeId(nodeId).WithIsDeleteModified(isDeleteModified).WithStartTime(startTime).WithEndTime(endTime) +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithNodeId(nodeId NodeId) DeleteRawModifiedDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) DeleteRawModifiedDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithIsDeleteModified(isDeleteModified bool) DeleteRawModifiedDetailsBuilder { + b.IsDeleteModified = isDeleteModified + return b +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithStartTime(startTime int64) DeleteRawModifiedDetailsBuilder { + b.StartTime = startTime + return b +} + +func (b *_DeleteRawModifiedDetailsBuilder) WithEndTime(endTime int64) DeleteRawModifiedDetailsBuilder { + b.EndTime = endTime + return b +} + +func (b *_DeleteRawModifiedDetailsBuilder) Build() (DeleteRawModifiedDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._DeleteRawModifiedDetails.deepCopy(), nil +} + +func (b *_DeleteRawModifiedDetailsBuilder) MustBuild() DeleteRawModifiedDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_DeleteRawModifiedDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_DeleteRawModifiedDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_DeleteRawModifiedDetailsBuilder) DeepCopy() any { + _copy := b.CreateDeleteRawModifiedDetailsBuilder().(*_DeleteRawModifiedDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateDeleteRawModifiedDetailsBuilder creates a DeleteRawModifiedDetailsBuilder +func (b *_DeleteRawModifiedDetails) CreateDeleteRawModifiedDetailsBuilder() DeleteRawModifiedDetailsBuilder { + if b == nil { + return NewDeleteRawModifiedDetailsBuilder() + } + return &_DeleteRawModifiedDetailsBuilder{_DeleteRawModifiedDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_DeleteRawModifiedDetails) GetExtensionId() int32 { + return int32(688) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_DeleteRawModifiedDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_DeleteRawModifiedDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_DeleteRawModifiedDetails) GetIsDeleteModified() bool { + return m.IsDeleteModified +} + +func (m *_DeleteRawModifiedDetails) GetStartTime() int64 { + return m.StartTime +} + +func (m *_DeleteRawModifiedDetails) GetEndTime() int64 { + return m.EndTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastDeleteRawModifiedDetails(structType any) DeleteRawModifiedDetails { + if casted, ok := structType.(DeleteRawModifiedDetails); ok { + return casted + } + if casted, ok := structType.(*DeleteRawModifiedDetails); ok { + return *casted + } + return nil +} + +func (m *_DeleteRawModifiedDetails) GetTypeName() string { + return "DeleteRawModifiedDetails" +} + +func (m *_DeleteRawModifiedDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (isDeleteModified) + lengthInBits += 1 + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (endTime) + lengthInBits += 64 + + return lengthInBits +} + +func (m *_DeleteRawModifiedDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_DeleteRawModifiedDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteRawModifiedDetails DeleteRawModifiedDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("DeleteRawModifiedDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for DeleteRawModifiedDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + isDeleteModified, err := ReadSimpleField(ctx, "isDeleteModified", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isDeleteModified' field")) + } + m.IsDeleteModified = isDeleteModified + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + endTime, err := ReadSimpleField(ctx, "endTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endTime' field")) + } + m.EndTime = endTime + + if closeErr := readBuffer.CloseContext("DeleteRawModifiedDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for DeleteRawModifiedDetails") + } + + return m, nil +} + +func (m *_DeleteRawModifiedDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_DeleteRawModifiedDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("DeleteRawModifiedDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for DeleteRawModifiedDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "isDeleteModified", m.GetIsDeleteModified(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isDeleteModified' field") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[int64](ctx, "endTime", m.GetEndTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'endTime' field") + } + + if popErr := writeBuffer.PopContext("DeleteRawModifiedDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for DeleteRawModifiedDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_DeleteRawModifiedDetails) IsDeleteRawModifiedDetails() {} + +func (m *_DeleteRawModifiedDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_DeleteRawModifiedDetails) deepCopy() *_DeleteRawModifiedDetails { + if m == nil { + return nil + } + _DeleteRawModifiedDetailsCopy := &_DeleteRawModifiedDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + m.IsDeleteModified, + m.StartTime, + m.EndTime, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _DeleteRawModifiedDetailsCopy +} + +func (m *_DeleteRawModifiedDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesItem.go b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesItem.go index bedfed4ec21..10898e40329 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesItem.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesItem.go @@ -282,8 +282,8 @@ func (b *_DeleteReferencesItem) CreateDeleteReferencesItemBuilder() DeleteRefere /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteReferencesItem) GetIdentifier() string { - return "387" +func (m *_DeleteReferencesItem) GetExtensionId() int32 { + return int32(387) } /////////////////////// @@ -371,7 +371,7 @@ func (m *_DeleteReferencesItem) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteReferencesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteReferencesItem DeleteReferencesItem, err error) { +func (m *_DeleteReferencesItem) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteReferencesItem DeleteReferencesItem, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesRequest.go b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesRequest.go index 851fcf4740b..1ae7cba0def 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesRequest.go @@ -41,11 +41,9 @@ type DeleteReferencesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfReferencesToDelete returns NoOfReferencesToDelete (property field) - GetNoOfReferencesToDelete() int32 + GetRequestHeader() RequestHeader // GetReferencesToDelete returns ReferencesToDelete (property field) - GetReferencesToDelete() []ExtensionObjectDefinition + GetReferencesToDelete() []DeleteReferencesItem // IsDeleteReferencesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsDeleteReferencesRequest() // CreateBuilder creates a DeleteReferencesRequestBuilder @@ -55,23 +53,21 @@ type DeleteReferencesRequest interface { // _DeleteReferencesRequest is the data-structure of this message type _DeleteReferencesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfReferencesToDelete int32 - ReferencesToDelete []ExtensionObjectDefinition + RequestHeader RequestHeader + ReferencesToDelete []DeleteReferencesItem } var _ DeleteReferencesRequest = (*_DeleteReferencesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteReferencesRequest)(nil) // NewDeleteReferencesRequest factory function for _DeleteReferencesRequest -func NewDeleteReferencesRequest(requestHeader ExtensionObjectDefinition, noOfReferencesToDelete int32, referencesToDelete []ExtensionObjectDefinition) *_DeleteReferencesRequest { +func NewDeleteReferencesRequest(requestHeader RequestHeader, referencesToDelete []DeleteReferencesItem) *_DeleteReferencesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for DeleteReferencesRequest must not be nil") + panic("requestHeader of type RequestHeader for DeleteReferencesRequest must not be nil") } _result := &_DeleteReferencesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfReferencesToDelete: noOfReferencesToDelete, ReferencesToDelete: referencesToDelete, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewDeleteReferencesRequest(requestHeader ExtensionObjectDefinition, noOfRef type DeleteReferencesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfReferencesToDelete int32, referencesToDelete []ExtensionObjectDefinition) DeleteReferencesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, referencesToDelete []DeleteReferencesItem) DeleteReferencesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) DeleteReferencesRequestBuilder + WithRequestHeader(RequestHeader) DeleteReferencesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteReferencesRequestBuilder - // WithNoOfReferencesToDelete adds NoOfReferencesToDelete (property field) - WithNoOfReferencesToDelete(int32) DeleteReferencesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteReferencesRequestBuilder // WithReferencesToDelete adds ReferencesToDelete (property field) - WithReferencesToDelete(...ExtensionObjectDefinition) DeleteReferencesRequestBuilder + WithReferencesToDelete(...DeleteReferencesItem) DeleteReferencesRequestBuilder // Build builds the DeleteReferencesRequest or returns an error if something is wrong Build() (DeleteReferencesRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_DeleteReferencesRequestBuilder) setParent(contract ExtensionObjectDefi b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteReferencesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfReferencesToDelete int32, referencesToDelete []ExtensionObjectDefinition) DeleteReferencesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfReferencesToDelete(noOfReferencesToDelete).WithReferencesToDelete(referencesToDelete...) +func (b *_DeleteReferencesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, referencesToDelete []DeleteReferencesItem) DeleteReferencesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithReferencesToDelete(referencesToDelete...) } -func (b *_DeleteReferencesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) DeleteReferencesRequestBuilder { +func (b *_DeleteReferencesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) DeleteReferencesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_DeleteReferencesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteReferencesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteReferencesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteReferencesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_DeleteReferencesRequestBuilder) WithNoOfReferencesToDelete(noOfReferencesToDelete int32) DeleteReferencesRequestBuilder { - b.NoOfReferencesToDelete = noOfReferencesToDelete - return b -} - -func (b *_DeleteReferencesRequestBuilder) WithReferencesToDelete(referencesToDelete ...ExtensionObjectDefinition) DeleteReferencesRequestBuilder { +func (b *_DeleteReferencesRequestBuilder) WithReferencesToDelete(referencesToDelete ...DeleteReferencesItem) DeleteReferencesRequestBuilder { b.ReferencesToDelete = referencesToDelete return b } @@ -209,8 +198,8 @@ func (b *_DeleteReferencesRequest) CreateDeleteReferencesRequestBuilder() Delete /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteReferencesRequest) GetIdentifier() string { - return "506" +func (m *_DeleteReferencesRequest) GetExtensionId() int32 { + return int32(506) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_DeleteReferencesRequest) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteReferencesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_DeleteReferencesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_DeleteReferencesRequest) GetNoOfReferencesToDelete() int32 { - return m.NoOfReferencesToDelete -} - -func (m *_DeleteReferencesRequest) GetReferencesToDelete() []ExtensionObjectDefinition { +func (m *_DeleteReferencesRequest) GetReferencesToDelete() []DeleteReferencesItem { return m.ReferencesToDelete } @@ -265,7 +250,7 @@ func (m *_DeleteReferencesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfReferencesToDelete) + // Implicit Field (noOfReferencesToDelete) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_DeleteReferencesRequest) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteReferencesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteReferencesRequest DeleteReferencesRequest, err error) { +func (m *_DeleteReferencesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteReferencesRequest DeleteReferencesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_DeleteReferencesRequest) parse(ctx context.Context, readBuffer utils.R currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfReferencesToDelete, err := ReadSimpleField(ctx, "noOfReferencesToDelete", ReadSignedInt(readBuffer, uint8(32))) + noOfReferencesToDelete, err := ReadImplicitField[int32](ctx, "noOfReferencesToDelete", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReferencesToDelete' field")) } - m.NoOfReferencesToDelete = noOfReferencesToDelete + _ = noOfReferencesToDelete - referencesToDelete, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "referencesToDelete", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("387")), readBuffer), uint64(noOfReferencesToDelete)) + referencesToDelete, err := ReadCountArrayField[DeleteReferencesItem](ctx, "referencesToDelete", ReadComplex[DeleteReferencesItem](ExtensionObjectDefinitionParseWithBufferProducer[DeleteReferencesItem]((int32)(int32(387))), readBuffer), uint64(noOfReferencesToDelete)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'referencesToDelete' field")) } @@ -339,11 +324,11 @@ func (m *_DeleteReferencesRequest) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for DeleteReferencesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReferencesToDelete", m.GetNoOfReferencesToDelete(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReferencesToDelete := int32(utils.InlineIf(bool((m.GetReferencesToDelete()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReferencesToDelete()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReferencesToDelete", noOfReferencesToDelete, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReferencesToDelete' field") } @@ -371,9 +356,8 @@ func (m *_DeleteReferencesRequest) deepCopy() *_DeleteReferencesRequest { } _DeleteReferencesRequestCopy := &_DeleteReferencesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfReferencesToDelete, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ReferencesToDelete), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[DeleteReferencesItem, DeleteReferencesItem](m.ReferencesToDelete), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _DeleteReferencesRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesResponse.go b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesResponse.go index bd0b8ccb45b..441f856a8cb 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteReferencesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteReferencesResponse.go @@ -41,13 +41,9 @@ type DeleteReferencesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsDeleteReferencesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type DeleteReferencesResponse interface { // _DeleteReferencesResponse is the data-structure of this message type _DeleteReferencesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ DeleteReferencesResponse = (*_DeleteReferencesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteReferencesResponse)(nil) // NewDeleteReferencesResponse factory function for _DeleteReferencesResponse -func NewDeleteReferencesResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_DeleteReferencesResponse { +func NewDeleteReferencesResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_DeleteReferencesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for DeleteReferencesResponse must not be nil") + panic("responseHeader of type ResponseHeader for DeleteReferencesResponse must not be nil") } _result := &_DeleteReferencesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewDeleteReferencesResponse(responseHeader ExtensionObjectDefinition, noOfR type DeleteReferencesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteReferencesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteReferencesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) DeleteReferencesResponseBuilder + WithResponseHeader(ResponseHeader) DeleteReferencesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteReferencesResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) DeleteReferencesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteReferencesResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) DeleteReferencesResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) DeleteReferencesResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) DeleteReferencesResponseBuilder // Build builds the DeleteReferencesResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_DeleteReferencesResponseBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteReferencesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteReferencesResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_DeleteReferencesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteReferencesResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_DeleteReferencesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) DeleteReferencesResponseBuilder { +func (b *_DeleteReferencesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) DeleteReferencesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_DeleteReferencesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteReferencesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteReferencesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteReferencesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_DeleteReferencesResponseBuilder) WithNoOfResults(noOfResults int32) DeleteReferencesResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_DeleteReferencesResponseBuilder) WithResults(results ...StatusCode) DeleteReferencesResponseBuilder { b.Results = results return b } -func (b *_DeleteReferencesResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) DeleteReferencesResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_DeleteReferencesResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) DeleteReferencesResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_DeleteReferencesResponse) CreateDeleteReferencesResponseBuilder() Dele /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteReferencesResponse) GetIdentifier() string { - return "509" +func (m *_DeleteReferencesResponse) GetExtensionId() int32 { + return int32(509) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_DeleteReferencesResponse) GetParent() ExtensionObjectDefinitionContrac /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteReferencesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_DeleteReferencesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_DeleteReferencesResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_DeleteReferencesResponse) GetResults() []StatusCode { return m.Results } -func (m *_DeleteReferencesResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_DeleteReferencesResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_DeleteReferencesResponse) GetLengthInBits(ctx context.Context) uint16 // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_DeleteReferencesResponse) GetLengthInBits(ctx context.Context) uint16 } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_DeleteReferencesResponse) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteReferencesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteReferencesResponse DeleteReferencesResponse, err error) { +func (m *_DeleteReferencesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteReferencesResponse DeleteReferencesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_DeleteReferencesResponse) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_DeleteReferencesResponse) parse(ctx context.Context, readBuffer utils. } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_DeleteReferencesResponse) SerializeWithWriteBuffer(ctx context.Context return errors.Wrap(pushErr, "Error pushing for DeleteReferencesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_DeleteReferencesResponse) deepCopy() *_DeleteReferencesResponse { } _DeleteReferencesResponseCopy := &_DeleteReferencesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsRequest.go b/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsRequest.go index 05f6ef8a8fb..7c2c8a6d81d 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsRequest.go @@ -41,9 +41,7 @@ type DeleteSubscriptionsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfSubscriptionIds returns NoOfSubscriptionIds (property field) - GetNoOfSubscriptionIds() int32 + GetRequestHeader() RequestHeader // GetSubscriptionIds returns SubscriptionIds (property field) GetSubscriptionIds() []uint32 // IsDeleteSubscriptionsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type DeleteSubscriptionsRequest interface { // _DeleteSubscriptionsRequest is the data-structure of this message type _DeleteSubscriptionsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfSubscriptionIds int32 - SubscriptionIds []uint32 + RequestHeader RequestHeader + SubscriptionIds []uint32 } var _ DeleteSubscriptionsRequest = (*_DeleteSubscriptionsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteSubscriptionsRequest)(nil) // NewDeleteSubscriptionsRequest factory function for _DeleteSubscriptionsRequest -func NewDeleteSubscriptionsRequest(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32) *_DeleteSubscriptionsRequest { +func NewDeleteSubscriptionsRequest(requestHeader RequestHeader, subscriptionIds []uint32) *_DeleteSubscriptionsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for DeleteSubscriptionsRequest must not be nil") + panic("requestHeader of type RequestHeader for DeleteSubscriptionsRequest must not be nil") } _result := &_DeleteSubscriptionsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfSubscriptionIds: noOfSubscriptionIds, SubscriptionIds: subscriptionIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewDeleteSubscriptionsRequest(requestHeader ExtensionObjectDefinition, noOf type DeleteSubscriptionsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32) DeleteSubscriptionsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionIds []uint32) DeleteSubscriptionsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) DeleteSubscriptionsRequestBuilder + WithRequestHeader(RequestHeader) DeleteSubscriptionsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteSubscriptionsRequestBuilder - // WithNoOfSubscriptionIds adds NoOfSubscriptionIds (property field) - WithNoOfSubscriptionIds(int32) DeleteSubscriptionsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteSubscriptionsRequestBuilder // WithSubscriptionIds adds SubscriptionIds (property field) WithSubscriptionIds(...uint32) DeleteSubscriptionsRequestBuilder // Build builds the DeleteSubscriptionsRequest or returns an error if something is wrong @@ -121,33 +115,28 @@ func (b *_DeleteSubscriptionsRequestBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteSubscriptionsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32) DeleteSubscriptionsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfSubscriptionIds(noOfSubscriptionIds).WithSubscriptionIds(subscriptionIds...) +func (b *_DeleteSubscriptionsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionIds []uint32) DeleteSubscriptionsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionIds(subscriptionIds...) } -func (b *_DeleteSubscriptionsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) DeleteSubscriptionsRequestBuilder { +func (b *_DeleteSubscriptionsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) DeleteSubscriptionsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_DeleteSubscriptionsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteSubscriptionsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteSubscriptionsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) DeleteSubscriptionsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_DeleteSubscriptionsRequestBuilder) WithNoOfSubscriptionIds(noOfSubscriptionIds int32) DeleteSubscriptionsRequestBuilder { - b.NoOfSubscriptionIds = noOfSubscriptionIds - return b -} - func (b *_DeleteSubscriptionsRequestBuilder) WithSubscriptionIds(subscriptionIds ...uint32) DeleteSubscriptionsRequestBuilder { b.SubscriptionIds = subscriptionIds return b @@ -209,8 +198,8 @@ func (b *_DeleteSubscriptionsRequest) CreateDeleteSubscriptionsRequestBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteSubscriptionsRequest) GetIdentifier() string { - return "847" +func (m *_DeleteSubscriptionsRequest) GetExtensionId() int32 { + return int32(847) } /////////////////////// @@ -227,14 +216,10 @@ func (m *_DeleteSubscriptionsRequest) GetParent() ExtensionObjectDefinitionContr /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteSubscriptionsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_DeleteSubscriptionsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_DeleteSubscriptionsRequest) GetNoOfSubscriptionIds() int32 { - return m.NoOfSubscriptionIds -} - func (m *_DeleteSubscriptionsRequest) GetSubscriptionIds() []uint32 { return m.SubscriptionIds } @@ -265,7 +250,7 @@ func (m *_DeleteSubscriptionsRequest) GetLengthInBits(ctx context.Context) uint1 // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32 // Array field @@ -280,7 +265,7 @@ func (m *_DeleteSubscriptionsRequest) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteSubscriptionsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteSubscriptionsRequest DeleteSubscriptionsRequest, err error) { +func (m *_DeleteSubscriptionsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteSubscriptionsRequest DeleteSubscriptionsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -291,17 +276,17 @@ func (m *_DeleteSubscriptionsRequest) parse(ctx context.Context, readBuffer util currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfSubscriptionIds, err := ReadSimpleField(ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) + noOfSubscriptionIds, err := ReadImplicitField[int32](ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSubscriptionIds' field")) } - m.NoOfSubscriptionIds = noOfSubscriptionIds + _ = noOfSubscriptionIds subscriptionIds, err := ReadCountArrayField[uint32](ctx, "subscriptionIds", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfSubscriptionIds)) if err != nil { @@ -334,11 +319,11 @@ func (m *_DeleteSubscriptionsRequest) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(pushErr, "Error pushing for DeleteSubscriptionsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSubscriptionIds", m.GetNoOfSubscriptionIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSubscriptionIds := int32(utils.InlineIf(bool((m.GetSubscriptionIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSubscriptionIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSubscriptionIds", noOfSubscriptionIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSubscriptionIds' field") } @@ -366,8 +351,7 @@ func (m *_DeleteSubscriptionsRequest) deepCopy() *_DeleteSubscriptionsRequest { } _DeleteSubscriptionsRequestCopy := &_DeleteSubscriptionsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfSubscriptionIds, + m.RequestHeader.DeepCopy().(RequestHeader), utils.DeepCopySlice[uint32, uint32](m.SubscriptionIds), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsResponse.go b/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsResponse.go index b9f37c9a306..12f981b9acd 100644 --- a/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/DeleteSubscriptionsResponse.go @@ -41,13 +41,9 @@ type DeleteSubscriptionsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsDeleteSubscriptionsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type DeleteSubscriptionsResponse interface { // _DeleteSubscriptionsResponse is the data-structure of this message type _DeleteSubscriptionsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ DeleteSubscriptionsResponse = (*_DeleteSubscriptionsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_DeleteSubscriptionsResponse)(nil) // NewDeleteSubscriptionsResponse factory function for _DeleteSubscriptionsResponse -func NewDeleteSubscriptionsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_DeleteSubscriptionsResponse { +func NewDeleteSubscriptionsResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_DeleteSubscriptionsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for DeleteSubscriptionsResponse must not be nil") + panic("responseHeader of type ResponseHeader for DeleteSubscriptionsResponse must not be nil") } _result := &_DeleteSubscriptionsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewDeleteSubscriptionsResponse(responseHeader ExtensionObjectDefinition, no type DeleteSubscriptionsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteSubscriptionsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteSubscriptionsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) DeleteSubscriptionsResponseBuilder + WithResponseHeader(ResponseHeader) DeleteSubscriptionsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteSubscriptionsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) DeleteSubscriptionsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteSubscriptionsResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) DeleteSubscriptionsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) DeleteSubscriptionsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) DeleteSubscriptionsResponseBuilder // Build builds the DeleteSubscriptionsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_DeleteSubscriptionsResponseBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_DeleteSubscriptionsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) DeleteSubscriptionsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_DeleteSubscriptionsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) DeleteSubscriptionsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_DeleteSubscriptionsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) DeleteSubscriptionsResponseBuilder { +func (b *_DeleteSubscriptionsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) DeleteSubscriptionsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_DeleteSubscriptionsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) DeleteSubscriptionsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_DeleteSubscriptionsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) DeleteSubscriptionsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_DeleteSubscriptionsResponseBuilder) WithNoOfResults(noOfResults int32) DeleteSubscriptionsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_DeleteSubscriptionsResponseBuilder) WithResults(results ...StatusCode) DeleteSubscriptionsResponseBuilder { b.Results = results return b } -func (b *_DeleteSubscriptionsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) DeleteSubscriptionsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_DeleteSubscriptionsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) DeleteSubscriptionsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_DeleteSubscriptionsResponse) CreateDeleteSubscriptionsResponseBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DeleteSubscriptionsResponse) GetIdentifier() string { - return "850" +func (m *_DeleteSubscriptionsResponse) GetExtensionId() int32 { + return int32(850) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_DeleteSubscriptionsResponse) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_DeleteSubscriptionsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_DeleteSubscriptionsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_DeleteSubscriptionsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_DeleteSubscriptionsResponse) GetResults() []StatusCode { return m.Results } -func (m *_DeleteSubscriptionsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_DeleteSubscriptionsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_DeleteSubscriptionsResponse) GetLengthInBits(ctx context.Context) uint // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_DeleteSubscriptionsResponse) GetLengthInBits(ctx context.Context) uint } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_DeleteSubscriptionsResponse) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_DeleteSubscriptionsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__deleteSubscriptionsResponse DeleteSubscriptionsResponse, err error) { +func (m *_DeleteSubscriptionsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__deleteSubscriptionsResponse DeleteSubscriptionsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_DeleteSubscriptionsResponse) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_DeleteSubscriptionsResponse) parse(ctx context.Context, readBuffer uti } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_DeleteSubscriptionsResponse) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(pushErr, "Error pushing for DeleteSubscriptionsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_DeleteSubscriptionsResponse) deepCopy() *_DeleteSubscriptionsResponse } _DeleteSubscriptionsResponseCopy := &_DeleteSubscriptionsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/DiscoveryConfiguration.go b/plc4go/protocols/opcua/readwrite/model/DiscoveryConfiguration.go index 536e95645e2..b5274f9f6df 100644 --- a/plc4go/protocols/opcua/readwrite/model/DiscoveryConfiguration.go +++ b/plc4go/protocols/opcua/readwrite/model/DiscoveryConfiguration.go @@ -150,8 +150,8 @@ func (b *_DiscoveryConfiguration) CreateDiscoveryConfigurationBuilder() Discover /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DiscoveryConfiguration) GetIdentifier() string { - return "12892" +func (m *_DiscoveryConfiguration) GetExtensionId() int32 { + return int32(12892) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_DiscoveryConfiguration) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_DiscoveryConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__discoveryConfiguration DiscoveryConfiguration, err error) { +func (m *_DiscoveryConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__discoveryConfiguration DiscoveryConfiguration, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/DoubleComplexNumberType.go b/plc4go/protocols/opcua/readwrite/model/DoubleComplexNumberType.go index f4a7a50f7f1..99b6b5cb49d 100644 --- a/plc4go/protocols/opcua/readwrite/model/DoubleComplexNumberType.go +++ b/plc4go/protocols/opcua/readwrite/model/DoubleComplexNumberType.go @@ -174,8 +174,8 @@ func (b *_DoubleComplexNumberType) CreateDoubleComplexNumberTypeBuilder() Double /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_DoubleComplexNumberType) GetIdentifier() string { - return "12174" +func (m *_DoubleComplexNumberType) GetExtensionId() int32 { + return int32(12174) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_DoubleComplexNumberType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_DoubleComplexNumberType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__doubleComplexNumberType DoubleComplexNumberType, err error) { +func (m *_DoubleComplexNumberType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__doubleComplexNumberType DoubleComplexNumberType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/EUInformation.go b/plc4go/protocols/opcua/readwrite/model/EUInformation.go index 0b378ac04b0..e594c5821ad 100644 --- a/plc4go/protocols/opcua/readwrite/model/EUInformation.go +++ b/plc4go/protocols/opcua/readwrite/model/EUInformation.go @@ -268,8 +268,8 @@ func (b *_EUInformation) CreateEUInformationBuilder() EUInformationBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EUInformation) GetIdentifier() string { - return "889" +func (m *_EUInformation) GetExtensionId() int32 { + return int32(889) } /////////////////////// @@ -344,7 +344,7 @@ func (m *_EUInformation) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EUInformation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__eUInformation EUInformation, err error) { +func (m *_EUInformation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__eUInformation EUInformation, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ElementOperand.go b/plc4go/protocols/opcua/readwrite/model/ElementOperand.go new file mode 100644 index 00000000000..9823dbe2346 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ElementOperand.go @@ -0,0 +1,306 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ElementOperand is the corresponding interface of ElementOperand +type ElementOperand interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetIndex returns Index (property field) + GetIndex() uint32 + // IsElementOperand is a marker method to prevent unintentional type checks (interfaces of same signature) + IsElementOperand() + // CreateBuilder creates a ElementOperandBuilder + CreateElementOperandBuilder() ElementOperandBuilder +} + +// _ElementOperand is the data-structure of this message +type _ElementOperand struct { + ExtensionObjectDefinitionContract + Index uint32 +} + +var _ ElementOperand = (*_ElementOperand)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ElementOperand)(nil) + +// NewElementOperand factory function for _ElementOperand +func NewElementOperand(index uint32) *_ElementOperand { + _result := &_ElementOperand{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Index: index, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ElementOperandBuilder is a builder for ElementOperand +type ElementOperandBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(index uint32) ElementOperandBuilder + // WithIndex adds Index (property field) + WithIndex(uint32) ElementOperandBuilder + // Build builds the ElementOperand or returns an error if something is wrong + Build() (ElementOperand, error) + // MustBuild does the same as Build but panics on error + MustBuild() ElementOperand +} + +// NewElementOperandBuilder() creates a ElementOperandBuilder +func NewElementOperandBuilder() ElementOperandBuilder { + return &_ElementOperandBuilder{_ElementOperand: new(_ElementOperand)} +} + +type _ElementOperandBuilder struct { + *_ElementOperand + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ElementOperandBuilder) = (*_ElementOperandBuilder)(nil) + +func (b *_ElementOperandBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ElementOperandBuilder) WithMandatoryFields(index uint32) ElementOperandBuilder { + return b.WithIndex(index) +} + +func (b *_ElementOperandBuilder) WithIndex(index uint32) ElementOperandBuilder { + b.Index = index + return b +} + +func (b *_ElementOperandBuilder) Build() (ElementOperand, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ElementOperand.deepCopy(), nil +} + +func (b *_ElementOperandBuilder) MustBuild() ElementOperand { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ElementOperandBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ElementOperandBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ElementOperandBuilder) DeepCopy() any { + _copy := b.CreateElementOperandBuilder().(*_ElementOperandBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateElementOperandBuilder creates a ElementOperandBuilder +func (b *_ElementOperand) CreateElementOperandBuilder() ElementOperandBuilder { + if b == nil { + return NewElementOperandBuilder() + } + return &_ElementOperandBuilder{_ElementOperand: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ElementOperand) GetExtensionId() int32 { + return int32(594) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ElementOperand) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ElementOperand) GetIndex() uint32 { + return m.Index +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastElementOperand(structType any) ElementOperand { + if casted, ok := structType.(ElementOperand); ok { + return casted + } + if casted, ok := structType.(*ElementOperand); ok { + return *casted + } + return nil +} + +func (m *_ElementOperand) GetTypeName() string { + return "ElementOperand" +} + +func (m *_ElementOperand) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (index) + lengthInBits += 32 + + return lengthInBits +} + +func (m *_ElementOperand) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ElementOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__elementOperand ElementOperand, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ElementOperand"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ElementOperand") + } + currentPos := positionAware.GetPos() + _ = currentPos + + index, err := ReadSimpleField(ctx, "index", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'index' field")) + } + m.Index = index + + if closeErr := readBuffer.CloseContext("ElementOperand"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ElementOperand") + } + + return m, nil +} + +func (m *_ElementOperand) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ElementOperand) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ElementOperand"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ElementOperand") + } + + if err := WriteSimpleField[uint32](ctx, "index", m.GetIndex(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'index' field") + } + + if popErr := writeBuffer.PopContext("ElementOperand"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ElementOperand") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ElementOperand) IsElementOperand() {} + +func (m *_ElementOperand) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ElementOperand) deepCopy() *_ElementOperand { + if m == nil { + return nil + } + _ElementOperandCopy := &_ElementOperand{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Index, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ElementOperandCopy +} + +func (m *_ElementOperand) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EndpointConfiguration.go b/plc4go/protocols/opcua/readwrite/model/EndpointConfiguration.go index 9e48d84dbf1..4834240b17f 100644 --- a/plc4go/protocols/opcua/readwrite/model/EndpointConfiguration.go +++ b/plc4go/protocols/opcua/readwrite/model/EndpointConfiguration.go @@ -253,8 +253,8 @@ func (b *_EndpointConfiguration) CreateEndpointConfigurationBuilder() EndpointCo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EndpointConfiguration) GetIdentifier() string { - return "333" +func (m *_EndpointConfiguration) GetExtensionId() int32 { + return int32(333) } /////////////////////// @@ -367,7 +367,7 @@ func (m *_EndpointConfiguration) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EndpointConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__endpointConfiguration EndpointConfiguration, err error) { +func (m *_EndpointConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__endpointConfiguration EndpointConfiguration, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/EndpointDescription.go b/plc4go/protocols/opcua/readwrite/model/EndpointDescription.go index 66ede73ad49..727a6cdcd52 100644 --- a/plc4go/protocols/opcua/readwrite/model/EndpointDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/EndpointDescription.go @@ -43,17 +43,15 @@ type EndpointDescription interface { // GetEndpointUrl returns EndpointUrl (property field) GetEndpointUrl() PascalString // GetServer returns Server (property field) - GetServer() ExtensionObjectDefinition + GetServer() ApplicationDescription // GetServerCertificate returns ServerCertificate (property field) GetServerCertificate() PascalByteString // GetSecurityMode returns SecurityMode (property field) GetSecurityMode() MessageSecurityMode // GetSecurityPolicyUri returns SecurityPolicyUri (property field) GetSecurityPolicyUri() PascalString - // GetNoOfUserIdentityTokens returns NoOfUserIdentityTokens (property field) - GetNoOfUserIdentityTokens() int32 // GetUserIdentityTokens returns UserIdentityTokens (property field) - GetUserIdentityTokens() []ExtensionObjectDefinition + GetUserIdentityTokens() []UserTokenPolicy // GetTransportProfileUri returns TransportProfileUri (property field) GetTransportProfileUri() PascalString // GetSecurityLevel returns SecurityLevel (property field) @@ -67,27 +65,26 @@ type EndpointDescription interface { // _EndpointDescription is the data-structure of this message type _EndpointDescription struct { ExtensionObjectDefinitionContract - EndpointUrl PascalString - Server ExtensionObjectDefinition - ServerCertificate PascalByteString - SecurityMode MessageSecurityMode - SecurityPolicyUri PascalString - NoOfUserIdentityTokens int32 - UserIdentityTokens []ExtensionObjectDefinition - TransportProfileUri PascalString - SecurityLevel uint8 + EndpointUrl PascalString + Server ApplicationDescription + ServerCertificate PascalByteString + SecurityMode MessageSecurityMode + SecurityPolicyUri PascalString + UserIdentityTokens []UserTokenPolicy + TransportProfileUri PascalString + SecurityLevel uint8 } var _ EndpointDescription = (*_EndpointDescription)(nil) var _ ExtensionObjectDefinitionRequirements = (*_EndpointDescription)(nil) // NewEndpointDescription factory function for _EndpointDescription -func NewEndpointDescription(endpointUrl PascalString, server ExtensionObjectDefinition, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, noOfUserIdentityTokens int32, userIdentityTokens []ExtensionObjectDefinition, transportProfileUri PascalString, securityLevel uint8) *_EndpointDescription { +func NewEndpointDescription(endpointUrl PascalString, server ApplicationDescription, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, userIdentityTokens []UserTokenPolicy, transportProfileUri PascalString, securityLevel uint8) *_EndpointDescription { if endpointUrl == nil { panic("endpointUrl of type PascalString for EndpointDescription must not be nil") } if server == nil { - panic("server of type ExtensionObjectDefinition for EndpointDescription must not be nil") + panic("server of type ApplicationDescription for EndpointDescription must not be nil") } if serverCertificate == nil { panic("serverCertificate of type PascalByteString for EndpointDescription must not be nil") @@ -105,7 +102,6 @@ func NewEndpointDescription(endpointUrl PascalString, server ExtensionObjectDefi ServerCertificate: serverCertificate, SecurityMode: securityMode, SecurityPolicyUri: securityPolicyUri, - NoOfUserIdentityTokens: noOfUserIdentityTokens, UserIdentityTokens: userIdentityTokens, TransportProfileUri: transportProfileUri, SecurityLevel: securityLevel, @@ -123,15 +119,15 @@ func NewEndpointDescription(endpointUrl PascalString, server ExtensionObjectDefi type EndpointDescriptionBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(endpointUrl PascalString, server ExtensionObjectDefinition, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, noOfUserIdentityTokens int32, userIdentityTokens []ExtensionObjectDefinition, transportProfileUri PascalString, securityLevel uint8) EndpointDescriptionBuilder + WithMandatoryFields(endpointUrl PascalString, server ApplicationDescription, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, userIdentityTokens []UserTokenPolicy, transportProfileUri PascalString, securityLevel uint8) EndpointDescriptionBuilder // WithEndpointUrl adds EndpointUrl (property field) WithEndpointUrl(PascalString) EndpointDescriptionBuilder // WithEndpointUrlBuilder adds EndpointUrl (property field) which is build by the builder WithEndpointUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) EndpointDescriptionBuilder // WithServer adds Server (property field) - WithServer(ExtensionObjectDefinition) EndpointDescriptionBuilder + WithServer(ApplicationDescription) EndpointDescriptionBuilder // WithServerBuilder adds Server (property field) which is build by the builder - WithServerBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) EndpointDescriptionBuilder + WithServerBuilder(func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) EndpointDescriptionBuilder // WithServerCertificate adds ServerCertificate (property field) WithServerCertificate(PascalByteString) EndpointDescriptionBuilder // WithServerCertificateBuilder adds ServerCertificate (property field) which is build by the builder @@ -142,10 +138,8 @@ type EndpointDescriptionBuilder interface { WithSecurityPolicyUri(PascalString) EndpointDescriptionBuilder // WithSecurityPolicyUriBuilder adds SecurityPolicyUri (property field) which is build by the builder WithSecurityPolicyUriBuilder(func(PascalStringBuilder) PascalStringBuilder) EndpointDescriptionBuilder - // WithNoOfUserIdentityTokens adds NoOfUserIdentityTokens (property field) - WithNoOfUserIdentityTokens(int32) EndpointDescriptionBuilder // WithUserIdentityTokens adds UserIdentityTokens (property field) - WithUserIdentityTokens(...ExtensionObjectDefinition) EndpointDescriptionBuilder + WithUserIdentityTokens(...UserTokenPolicy) EndpointDescriptionBuilder // WithTransportProfileUri adds TransportProfileUri (property field) WithTransportProfileUri(PascalString) EndpointDescriptionBuilder // WithTransportProfileUriBuilder adds TransportProfileUri (property field) which is build by the builder @@ -177,8 +171,8 @@ func (b *_EndpointDescriptionBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_EndpointDescriptionBuilder) WithMandatoryFields(endpointUrl PascalString, server ExtensionObjectDefinition, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, noOfUserIdentityTokens int32, userIdentityTokens []ExtensionObjectDefinition, transportProfileUri PascalString, securityLevel uint8) EndpointDescriptionBuilder { - return b.WithEndpointUrl(endpointUrl).WithServer(server).WithServerCertificate(serverCertificate).WithSecurityMode(securityMode).WithSecurityPolicyUri(securityPolicyUri).WithNoOfUserIdentityTokens(noOfUserIdentityTokens).WithUserIdentityTokens(userIdentityTokens...).WithTransportProfileUri(transportProfileUri).WithSecurityLevel(securityLevel) +func (b *_EndpointDescriptionBuilder) WithMandatoryFields(endpointUrl PascalString, server ApplicationDescription, serverCertificate PascalByteString, securityMode MessageSecurityMode, securityPolicyUri PascalString, userIdentityTokens []UserTokenPolicy, transportProfileUri PascalString, securityLevel uint8) EndpointDescriptionBuilder { + return b.WithEndpointUrl(endpointUrl).WithServer(server).WithServerCertificate(serverCertificate).WithSecurityMode(securityMode).WithSecurityPolicyUri(securityPolicyUri).WithUserIdentityTokens(userIdentityTokens...).WithTransportProfileUri(transportProfileUri).WithSecurityLevel(securityLevel) } func (b *_EndpointDescriptionBuilder) WithEndpointUrl(endpointUrl PascalString) EndpointDescriptionBuilder { @@ -199,20 +193,20 @@ func (b *_EndpointDescriptionBuilder) WithEndpointUrlBuilder(builderSupplier fun return b } -func (b *_EndpointDescriptionBuilder) WithServer(server ExtensionObjectDefinition) EndpointDescriptionBuilder { +func (b *_EndpointDescriptionBuilder) WithServer(server ApplicationDescription) EndpointDescriptionBuilder { b.Server = server return b } -func (b *_EndpointDescriptionBuilder) WithServerBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) EndpointDescriptionBuilder { - builder := builderSupplier(b.Server.CreateExtensionObjectDefinitionBuilder()) +func (b *_EndpointDescriptionBuilder) WithServerBuilder(builderSupplier func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) EndpointDescriptionBuilder { + builder := builderSupplier(b.Server.CreateApplicationDescriptionBuilder()) var err error b.Server, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ApplicationDescriptionBuilder failed")) } return b } @@ -258,12 +252,7 @@ func (b *_EndpointDescriptionBuilder) WithSecurityPolicyUriBuilder(builderSuppli return b } -func (b *_EndpointDescriptionBuilder) WithNoOfUserIdentityTokens(noOfUserIdentityTokens int32) EndpointDescriptionBuilder { - b.NoOfUserIdentityTokens = noOfUserIdentityTokens - return b -} - -func (b *_EndpointDescriptionBuilder) WithUserIdentityTokens(userIdentityTokens ...ExtensionObjectDefinition) EndpointDescriptionBuilder { +func (b *_EndpointDescriptionBuilder) WithUserIdentityTokens(userIdentityTokens ...UserTokenPolicy) EndpointDescriptionBuilder { b.UserIdentityTokens = userIdentityTokens return b } @@ -371,8 +360,8 @@ func (b *_EndpointDescription) CreateEndpointDescriptionBuilder() EndpointDescri /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EndpointDescription) GetIdentifier() string { - return "314" +func (m *_EndpointDescription) GetExtensionId() int32 { + return int32(314) } /////////////////////// @@ -393,7 +382,7 @@ func (m *_EndpointDescription) GetEndpointUrl() PascalString { return m.EndpointUrl } -func (m *_EndpointDescription) GetServer() ExtensionObjectDefinition { +func (m *_EndpointDescription) GetServer() ApplicationDescription { return m.Server } @@ -409,11 +398,7 @@ func (m *_EndpointDescription) GetSecurityPolicyUri() PascalString { return m.SecurityPolicyUri } -func (m *_EndpointDescription) GetNoOfUserIdentityTokens() int32 { - return m.NoOfUserIdentityTokens -} - -func (m *_EndpointDescription) GetUserIdentityTokens() []ExtensionObjectDefinition { +func (m *_EndpointDescription) GetUserIdentityTokens() []UserTokenPolicy { return m.UserIdentityTokens } @@ -463,7 +448,7 @@ func (m *_EndpointDescription) GetLengthInBits(ctx context.Context) uint16 { // Simple field (securityPolicyUri) lengthInBits += m.SecurityPolicyUri.GetLengthInBits(ctx) - // Simple field (noOfUserIdentityTokens) + // Implicit Field (noOfUserIdentityTokens) lengthInBits += 32 // Array field @@ -489,7 +474,7 @@ func (m *_EndpointDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EndpointDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__endpointDescription EndpointDescription, err error) { +func (m *_EndpointDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__endpointDescription EndpointDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -506,7 +491,7 @@ func (m *_EndpointDescription) parse(ctx context.Context, readBuffer utils.ReadB } m.EndpointUrl = endpointUrl - server, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "server", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("310")), readBuffer)) + server, err := ReadSimpleField[ApplicationDescription](ctx, "server", ReadComplex[ApplicationDescription](ExtensionObjectDefinitionParseWithBufferProducer[ApplicationDescription]((int32)(int32(310))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'server' field")) } @@ -530,13 +515,13 @@ func (m *_EndpointDescription) parse(ctx context.Context, readBuffer utils.ReadB } m.SecurityPolicyUri = securityPolicyUri - noOfUserIdentityTokens, err := ReadSimpleField(ctx, "noOfUserIdentityTokens", ReadSignedInt(readBuffer, uint8(32))) + noOfUserIdentityTokens, err := ReadImplicitField[int32](ctx, "noOfUserIdentityTokens", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfUserIdentityTokens' field")) } - m.NoOfUserIdentityTokens = noOfUserIdentityTokens + _ = noOfUserIdentityTokens - userIdentityTokens, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "userIdentityTokens", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("306")), readBuffer), uint64(noOfUserIdentityTokens)) + userIdentityTokens, err := ReadCountArrayField[UserTokenPolicy](ctx, "userIdentityTokens", ReadComplex[UserTokenPolicy](ExtensionObjectDefinitionParseWithBufferProducer[UserTokenPolicy]((int32)(int32(306))), readBuffer), uint64(noOfUserIdentityTokens)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userIdentityTokens' field")) } @@ -583,7 +568,7 @@ func (m *_EndpointDescription) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(err, "Error serializing 'endpointUrl' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "server", m.GetServer(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ApplicationDescription](ctx, "server", m.GetServer(), WriteComplex[ApplicationDescription](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'server' field") } @@ -598,8 +583,8 @@ func (m *_EndpointDescription) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[PascalString](ctx, "securityPolicyUri", m.GetSecurityPolicyUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'securityPolicyUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfUserIdentityTokens", m.GetNoOfUserIdentityTokens(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfUserIdentityTokens := int32(utils.InlineIf(bool((m.GetUserIdentityTokens()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetUserIdentityTokens()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfUserIdentityTokens", noOfUserIdentityTokens, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfUserIdentityTokens' field") } @@ -636,12 +621,11 @@ func (m *_EndpointDescription) deepCopy() *_EndpointDescription { _EndpointDescriptionCopy := &_EndpointDescription{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.EndpointUrl.DeepCopy().(PascalString), - m.Server.DeepCopy().(ExtensionObjectDefinition), + m.Server.DeepCopy().(ApplicationDescription), m.ServerCertificate.DeepCopy().(PascalByteString), m.SecurityMode, m.SecurityPolicyUri.DeepCopy().(PascalString), - m.NoOfUserIdentityTokens, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.UserIdentityTokens), + utils.DeepCopySlice[UserTokenPolicy, UserTokenPolicy](m.UserIdentityTokens), m.TransportProfileUri.DeepCopy().(PascalString), m.SecurityLevel, } diff --git a/plc4go/protocols/opcua/readwrite/model/EndpointType.go b/plc4go/protocols/opcua/readwrite/model/EndpointType.go index 4634e3d32b4..ed929ef563c 100644 --- a/plc4go/protocols/opcua/readwrite/model/EndpointType.go +++ b/plc4go/protocols/opcua/readwrite/model/EndpointType.go @@ -268,8 +268,8 @@ func (b *_EndpointType) CreateEndpointTypeBuilder() EndpointTypeBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EndpointType) GetIdentifier() string { - return "15530" +func (m *_EndpointType) GetExtensionId() int32 { + return int32(15530) } /////////////////////// @@ -344,7 +344,7 @@ func (m *_EndpointType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EndpointType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__endpointType EndpointType, err error) { +func (m *_EndpointType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__endpointType EndpointType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/EndpointUrlListDataType.go b/plc4go/protocols/opcua/readwrite/model/EndpointUrlListDataType.go index ddac7d1ad2a..4f0d577e692 100644 --- a/plc4go/protocols/opcua/readwrite/model/EndpointUrlListDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/EndpointUrlListDataType.go @@ -40,8 +40,6 @@ type EndpointUrlListDataType interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfEndpointUrlList returns NoOfEndpointUrlList (property field) - GetNoOfEndpointUrlList() int32 // GetEndpointUrlList returns EndpointUrlList (property field) GetEndpointUrlList() []PascalString // IsEndpointUrlListDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,18 +51,16 @@ type EndpointUrlListDataType interface { // _EndpointUrlListDataType is the data-structure of this message type _EndpointUrlListDataType struct { ExtensionObjectDefinitionContract - NoOfEndpointUrlList int32 - EndpointUrlList []PascalString + EndpointUrlList []PascalString } var _ EndpointUrlListDataType = (*_EndpointUrlListDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_EndpointUrlListDataType)(nil) // NewEndpointUrlListDataType factory function for _EndpointUrlListDataType -func NewEndpointUrlListDataType(noOfEndpointUrlList int32, endpointUrlList []PascalString) *_EndpointUrlListDataType { +func NewEndpointUrlListDataType(endpointUrlList []PascalString) *_EndpointUrlListDataType { _result := &_EndpointUrlListDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfEndpointUrlList: noOfEndpointUrlList, EndpointUrlList: endpointUrlList, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,9 +76,7 @@ func NewEndpointUrlListDataType(noOfEndpointUrlList int32, endpointUrlList []Pas type EndpointUrlListDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfEndpointUrlList int32, endpointUrlList []PascalString) EndpointUrlListDataTypeBuilder - // WithNoOfEndpointUrlList adds NoOfEndpointUrlList (property field) - WithNoOfEndpointUrlList(int32) EndpointUrlListDataTypeBuilder + WithMandatoryFields(endpointUrlList []PascalString) EndpointUrlListDataTypeBuilder // WithEndpointUrlList adds EndpointUrlList (property field) WithEndpointUrlList(...PascalString) EndpointUrlListDataTypeBuilder // Build builds the EndpointUrlListDataType or returns an error if something is wrong @@ -110,13 +104,8 @@ func (b *_EndpointUrlListDataTypeBuilder) setParent(contract ExtensionObjectDefi b.ExtensionObjectDefinitionContract = contract } -func (b *_EndpointUrlListDataTypeBuilder) WithMandatoryFields(noOfEndpointUrlList int32, endpointUrlList []PascalString) EndpointUrlListDataTypeBuilder { - return b.WithNoOfEndpointUrlList(noOfEndpointUrlList).WithEndpointUrlList(endpointUrlList...) -} - -func (b *_EndpointUrlListDataTypeBuilder) WithNoOfEndpointUrlList(noOfEndpointUrlList int32) EndpointUrlListDataTypeBuilder { - b.NoOfEndpointUrlList = noOfEndpointUrlList - return b +func (b *_EndpointUrlListDataTypeBuilder) WithMandatoryFields(endpointUrlList []PascalString) EndpointUrlListDataTypeBuilder { + return b.WithEndpointUrlList(endpointUrlList...) } func (b *_EndpointUrlListDataTypeBuilder) WithEndpointUrlList(endpointUrlList ...PascalString) EndpointUrlListDataTypeBuilder { @@ -174,8 +163,8 @@ func (b *_EndpointUrlListDataType) CreateEndpointUrlListDataTypeBuilder() Endpoi /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EndpointUrlListDataType) GetIdentifier() string { - return "11945" +func (m *_EndpointUrlListDataType) GetExtensionId() int32 { + return int32(11945) } /////////////////////// @@ -192,10 +181,6 @@ func (m *_EndpointUrlListDataType) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_EndpointUrlListDataType) GetNoOfEndpointUrlList() int32 { - return m.NoOfEndpointUrlList -} - func (m *_EndpointUrlListDataType) GetEndpointUrlList() []PascalString { return m.EndpointUrlList } @@ -223,7 +208,7 @@ func (m *_EndpointUrlListDataType) GetTypeName() string { func (m *_EndpointUrlListDataType) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfEndpointUrlList) + // Implicit Field (noOfEndpointUrlList) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_EndpointUrlListDataType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_EndpointUrlListDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__endpointUrlListDataType EndpointUrlListDataType, err error) { +func (m *_EndpointUrlListDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__endpointUrlListDataType EndpointUrlListDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,11 +239,11 @@ func (m *_EndpointUrlListDataType) parse(ctx context.Context, readBuffer utils.R currentPos := positionAware.GetPos() _ = currentPos - noOfEndpointUrlList, err := ReadSimpleField(ctx, "noOfEndpointUrlList", ReadSignedInt(readBuffer, uint8(32))) + noOfEndpointUrlList, err := ReadImplicitField[int32](ctx, "noOfEndpointUrlList", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEndpointUrlList' field")) } - m.NoOfEndpointUrlList = noOfEndpointUrlList + _ = noOfEndpointUrlList endpointUrlList, err := ReadCountArrayField[PascalString](ctx, "endpointUrlList", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfEndpointUrlList)) if err != nil { @@ -290,8 +275,8 @@ func (m *_EndpointUrlListDataType) SerializeWithWriteBuffer(ctx context.Context, if pushErr := writeBuffer.PushContext("EndpointUrlListDataType"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for EndpointUrlListDataType") } - - if err := WriteSimpleField[int32](ctx, "noOfEndpointUrlList", m.GetNoOfEndpointUrlList(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEndpointUrlList := int32(utils.InlineIf(bool((m.GetEndpointUrlList()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEndpointUrlList()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEndpointUrlList", noOfEndpointUrlList, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEndpointUrlList' field") } @@ -319,7 +304,6 @@ func (m *_EndpointUrlListDataType) deepCopy() *_EndpointUrlListDataType { } _EndpointUrlListDataTypeCopy := &_EndpointUrlListDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfEndpointUrlList, utils.DeepCopySlice[PascalString, PascalString](m.EndpointUrlList), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/EnumDefinition.go b/plc4go/protocols/opcua/readwrite/model/EnumDefinition.go new file mode 100644 index 00000000000..413b5f7288e --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/EnumDefinition.go @@ -0,0 +1,326 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// EnumDefinition is the corresponding interface of EnumDefinition +type EnumDefinition interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetFields returns Fields (property field) + GetFields() []EnumField + // IsEnumDefinition is a marker method to prevent unintentional type checks (interfaces of same signature) + IsEnumDefinition() + // CreateBuilder creates a EnumDefinitionBuilder + CreateEnumDefinitionBuilder() EnumDefinitionBuilder +} + +// _EnumDefinition is the data-structure of this message +type _EnumDefinition struct { + ExtensionObjectDefinitionContract + Fields []EnumField +} + +var _ EnumDefinition = (*_EnumDefinition)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_EnumDefinition)(nil) + +// NewEnumDefinition factory function for _EnumDefinition +func NewEnumDefinition(fields []EnumField) *_EnumDefinition { + _result := &_EnumDefinition{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Fields: fields, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// EnumDefinitionBuilder is a builder for EnumDefinition +type EnumDefinitionBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(fields []EnumField) EnumDefinitionBuilder + // WithFields adds Fields (property field) + WithFields(...EnumField) EnumDefinitionBuilder + // Build builds the EnumDefinition or returns an error if something is wrong + Build() (EnumDefinition, error) + // MustBuild does the same as Build but panics on error + MustBuild() EnumDefinition +} + +// NewEnumDefinitionBuilder() creates a EnumDefinitionBuilder +func NewEnumDefinitionBuilder() EnumDefinitionBuilder { + return &_EnumDefinitionBuilder{_EnumDefinition: new(_EnumDefinition)} +} + +type _EnumDefinitionBuilder struct { + *_EnumDefinition + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (EnumDefinitionBuilder) = (*_EnumDefinitionBuilder)(nil) + +func (b *_EnumDefinitionBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_EnumDefinitionBuilder) WithMandatoryFields(fields []EnumField) EnumDefinitionBuilder { + return b.WithFields(fields...) +} + +func (b *_EnumDefinitionBuilder) WithFields(fields ...EnumField) EnumDefinitionBuilder { + b.Fields = fields + return b +} + +func (b *_EnumDefinitionBuilder) Build() (EnumDefinition, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._EnumDefinition.deepCopy(), nil +} + +func (b *_EnumDefinitionBuilder) MustBuild() EnumDefinition { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_EnumDefinitionBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_EnumDefinitionBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_EnumDefinitionBuilder) DeepCopy() any { + _copy := b.CreateEnumDefinitionBuilder().(*_EnumDefinitionBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateEnumDefinitionBuilder creates a EnumDefinitionBuilder +func (b *_EnumDefinition) CreateEnumDefinitionBuilder() EnumDefinitionBuilder { + if b == nil { + return NewEnumDefinitionBuilder() + } + return &_EnumDefinitionBuilder{_EnumDefinition: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_EnumDefinition) GetExtensionId() int32 { + return int32(102) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_EnumDefinition) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_EnumDefinition) GetFields() []EnumField { + return m.Fields +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastEnumDefinition(structType any) EnumDefinition { + if casted, ok := structType.(EnumDefinition); ok { + return casted + } + if casted, ok := structType.(*EnumDefinition); ok { + return *casted + } + return nil +} + +func (m *_EnumDefinition) GetTypeName() string { + return "EnumDefinition" +} + +func (m *_EnumDefinition) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfFields) + lengthInBits += 32 + + // Array field + if len(m.Fields) > 0 { + for _curItem, element := range m.Fields { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Fields), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_EnumDefinition) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_EnumDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__enumDefinition EnumDefinition, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("EnumDefinition"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for EnumDefinition") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfFields, err := ReadImplicitField[int32](ctx, "noOfFields", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfFields' field")) + } + _ = noOfFields + + fields, err := ReadCountArrayField[EnumField](ctx, "fields", ReadComplex[EnumField](ExtensionObjectDefinitionParseWithBufferProducer[EnumField]((int32)(int32(104))), readBuffer), uint64(noOfFields)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'fields' field")) + } + m.Fields = fields + + if closeErr := readBuffer.CloseContext("EnumDefinition"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for EnumDefinition") + } + + return m, nil +} + +func (m *_EnumDefinition) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_EnumDefinition) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("EnumDefinition"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for EnumDefinition") + } + noOfFields := int32(utils.InlineIf(bool((m.GetFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfFields", noOfFields, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfFields' field") + } + + if err := WriteComplexTypeArrayField(ctx, "fields", m.GetFields(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'fields' field") + } + + if popErr := writeBuffer.PopContext("EnumDefinition"); popErr != nil { + return errors.Wrap(popErr, "Error popping for EnumDefinition") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_EnumDefinition) IsEnumDefinition() {} + +func (m *_EnumDefinition) DeepCopy() any { + return m.deepCopy() +} + +func (m *_EnumDefinition) deepCopy() *_EnumDefinition { + if m == nil { + return nil + } + _EnumDefinitionCopy := &_EnumDefinition{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[EnumField, EnumField](m.Fields), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _EnumDefinitionCopy +} + +func (m *_EnumDefinition) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EnumDescription.go b/plc4go/protocols/opcua/readwrite/model/EnumDescription.go new file mode 100644 index 00000000000..674e4c2ee20 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/EnumDescription.go @@ -0,0 +1,465 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// EnumDescription is the corresponding interface of EnumDescription +type EnumDescription interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataTypeId returns DataTypeId (property field) + GetDataTypeId() NodeId + // GetName returns Name (property field) + GetName() QualifiedName + // GetEnumDefinition returns EnumDefinition (property field) + GetEnumDefinition() EnumDefinition + // GetBuiltInType returns BuiltInType (property field) + GetBuiltInType() uint8 + // IsEnumDescription is a marker method to prevent unintentional type checks (interfaces of same signature) + IsEnumDescription() + // CreateBuilder creates a EnumDescriptionBuilder + CreateEnumDescriptionBuilder() EnumDescriptionBuilder +} + +// _EnumDescription is the data-structure of this message +type _EnumDescription struct { + ExtensionObjectDefinitionContract + DataTypeId NodeId + Name QualifiedName + EnumDefinition EnumDefinition + BuiltInType uint8 +} + +var _ EnumDescription = (*_EnumDescription)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_EnumDescription)(nil) + +// NewEnumDescription factory function for _EnumDescription +func NewEnumDescription(dataTypeId NodeId, name QualifiedName, enumDefinition EnumDefinition, builtInType uint8) *_EnumDescription { + if dataTypeId == nil { + panic("dataTypeId of type NodeId for EnumDescription must not be nil") + } + if name == nil { + panic("name of type QualifiedName for EnumDescription must not be nil") + } + if enumDefinition == nil { + panic("enumDefinition of type EnumDefinition for EnumDescription must not be nil") + } + _result := &_EnumDescription{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataTypeId: dataTypeId, + Name: name, + EnumDefinition: enumDefinition, + BuiltInType: builtInType, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// EnumDescriptionBuilder is a builder for EnumDescription +type EnumDescriptionBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataTypeId NodeId, name QualifiedName, enumDefinition EnumDefinition, builtInType uint8) EnumDescriptionBuilder + // WithDataTypeId adds DataTypeId (property field) + WithDataTypeId(NodeId) EnumDescriptionBuilder + // WithDataTypeIdBuilder adds DataTypeId (property field) which is build by the builder + WithDataTypeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) EnumDescriptionBuilder + // WithName adds Name (property field) + WithName(QualifiedName) EnumDescriptionBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(QualifiedNameBuilder) QualifiedNameBuilder) EnumDescriptionBuilder + // WithEnumDefinition adds EnumDefinition (property field) + WithEnumDefinition(EnumDefinition) EnumDescriptionBuilder + // WithEnumDefinitionBuilder adds EnumDefinition (property field) which is build by the builder + WithEnumDefinitionBuilder(func(EnumDefinitionBuilder) EnumDefinitionBuilder) EnumDescriptionBuilder + // WithBuiltInType adds BuiltInType (property field) + WithBuiltInType(uint8) EnumDescriptionBuilder + // Build builds the EnumDescription or returns an error if something is wrong + Build() (EnumDescription, error) + // MustBuild does the same as Build but panics on error + MustBuild() EnumDescription +} + +// NewEnumDescriptionBuilder() creates a EnumDescriptionBuilder +func NewEnumDescriptionBuilder() EnumDescriptionBuilder { + return &_EnumDescriptionBuilder{_EnumDescription: new(_EnumDescription)} +} + +type _EnumDescriptionBuilder struct { + *_EnumDescription + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (EnumDescriptionBuilder) = (*_EnumDescriptionBuilder)(nil) + +func (b *_EnumDescriptionBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_EnumDescriptionBuilder) WithMandatoryFields(dataTypeId NodeId, name QualifiedName, enumDefinition EnumDefinition, builtInType uint8) EnumDescriptionBuilder { + return b.WithDataTypeId(dataTypeId).WithName(name).WithEnumDefinition(enumDefinition).WithBuiltInType(builtInType) +} + +func (b *_EnumDescriptionBuilder) WithDataTypeId(dataTypeId NodeId) EnumDescriptionBuilder { + b.DataTypeId = dataTypeId + return b +} + +func (b *_EnumDescriptionBuilder) WithDataTypeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) EnumDescriptionBuilder { + builder := builderSupplier(b.DataTypeId.CreateNodeIdBuilder()) + var err error + b.DataTypeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_EnumDescriptionBuilder) WithName(name QualifiedName) EnumDescriptionBuilder { + b.Name = name + return b +} + +func (b *_EnumDescriptionBuilder) WithNameBuilder(builderSupplier func(QualifiedNameBuilder) QualifiedNameBuilder) EnumDescriptionBuilder { + builder := builderSupplier(b.Name.CreateQualifiedNameBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "QualifiedNameBuilder failed")) + } + return b +} + +func (b *_EnumDescriptionBuilder) WithEnumDefinition(enumDefinition EnumDefinition) EnumDescriptionBuilder { + b.EnumDefinition = enumDefinition + return b +} + +func (b *_EnumDescriptionBuilder) WithEnumDefinitionBuilder(builderSupplier func(EnumDefinitionBuilder) EnumDefinitionBuilder) EnumDescriptionBuilder { + builder := builderSupplier(b.EnumDefinition.CreateEnumDefinitionBuilder()) + var err error + b.EnumDefinition, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "EnumDefinitionBuilder failed")) + } + return b +} + +func (b *_EnumDescriptionBuilder) WithBuiltInType(builtInType uint8) EnumDescriptionBuilder { + b.BuiltInType = builtInType + return b +} + +func (b *_EnumDescriptionBuilder) Build() (EnumDescription, error) { + if b.DataTypeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataTypeId' not set")) + } + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.EnumDefinition == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'enumDefinition' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._EnumDescription.deepCopy(), nil +} + +func (b *_EnumDescriptionBuilder) MustBuild() EnumDescription { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_EnumDescriptionBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_EnumDescriptionBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_EnumDescriptionBuilder) DeepCopy() any { + _copy := b.CreateEnumDescriptionBuilder().(*_EnumDescriptionBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateEnumDescriptionBuilder creates a EnumDescriptionBuilder +func (b *_EnumDescription) CreateEnumDescriptionBuilder() EnumDescriptionBuilder { + if b == nil { + return NewEnumDescriptionBuilder() + } + return &_EnumDescriptionBuilder{_EnumDescription: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_EnumDescription) GetExtensionId() int32 { + return int32(15490) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_EnumDescription) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_EnumDescription) GetDataTypeId() NodeId { + return m.DataTypeId +} + +func (m *_EnumDescription) GetName() QualifiedName { + return m.Name +} + +func (m *_EnumDescription) GetEnumDefinition() EnumDefinition { + return m.EnumDefinition +} + +func (m *_EnumDescription) GetBuiltInType() uint8 { + return m.BuiltInType +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastEnumDescription(structType any) EnumDescription { + if casted, ok := structType.(EnumDescription); ok { + return casted + } + if casted, ok := structType.(*EnumDescription); ok { + return *casted + } + return nil +} + +func (m *_EnumDescription) GetTypeName() string { + return "EnumDescription" +} + +func (m *_EnumDescription) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataTypeId) + lengthInBits += m.DataTypeId.GetLengthInBits(ctx) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Simple field (enumDefinition) + lengthInBits += m.EnumDefinition.GetLengthInBits(ctx) + + // Simple field (builtInType) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_EnumDescription) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_EnumDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__enumDescription EnumDescription, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("EnumDescription"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for EnumDescription") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataTypeId, err := ReadSimpleField[NodeId](ctx, "dataTypeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataTypeId' field")) + } + m.DataTypeId = dataTypeId + + name, err := ReadSimpleField[QualifiedName](ctx, "name", ReadComplex[QualifiedName](QualifiedNameParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + enumDefinition, err := ReadSimpleField[EnumDefinition](ctx, "enumDefinition", ReadComplex[EnumDefinition](ExtensionObjectDefinitionParseWithBufferProducer[EnumDefinition]((int32)(int32(102))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enumDefinition' field")) + } + m.EnumDefinition = enumDefinition + + builtInType, err := ReadSimpleField(ctx, "builtInType", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'builtInType' field")) + } + m.BuiltInType = builtInType + + if closeErr := readBuffer.CloseContext("EnumDescription"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for EnumDescription") + } + + return m, nil +} + +func (m *_EnumDescription) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_EnumDescription) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("EnumDescription"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for EnumDescription") + } + + if err := WriteSimpleField[NodeId](ctx, "dataTypeId", m.GetDataTypeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataTypeId' field") + } + + if err := WriteSimpleField[QualifiedName](ctx, "name", m.GetName(), WriteComplex[QualifiedName](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteSimpleField[EnumDefinition](ctx, "enumDefinition", m.GetEnumDefinition(), WriteComplex[EnumDefinition](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'enumDefinition' field") + } + + if err := WriteSimpleField[uint8](ctx, "builtInType", m.GetBuiltInType(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'builtInType' field") + } + + if popErr := writeBuffer.PopContext("EnumDescription"); popErr != nil { + return errors.Wrap(popErr, "Error popping for EnumDescription") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_EnumDescription) IsEnumDescription() {} + +func (m *_EnumDescription) DeepCopy() any { + return m.deepCopy() +} + +func (m *_EnumDescription) deepCopy() *_EnumDescription { + if m == nil { + return nil + } + _EnumDescriptionCopy := &_EnumDescription{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataTypeId.DeepCopy().(NodeId), + m.Name.DeepCopy().(QualifiedName), + m.EnumDefinition.DeepCopy().(EnumDefinition), + m.BuiltInType, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _EnumDescriptionCopy +} + +func (m *_EnumDescription) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EnumField.go b/plc4go/protocols/opcua/readwrite/model/EnumField.go new file mode 100644 index 00000000000..8e42c293ad5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/EnumField.go @@ -0,0 +1,465 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// EnumField is the corresponding interface of EnumField +type EnumField interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetValue returns Value (property field) + GetValue() int64 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetName returns Name (property field) + GetName() PascalString + // IsEnumField is a marker method to prevent unintentional type checks (interfaces of same signature) + IsEnumField() + // CreateBuilder creates a EnumFieldBuilder + CreateEnumFieldBuilder() EnumFieldBuilder +} + +// _EnumField is the data-structure of this message +type _EnumField struct { + ExtensionObjectDefinitionContract + Value int64 + DisplayName LocalizedText + Description LocalizedText + Name PascalString +} + +var _ EnumField = (*_EnumField)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_EnumField)(nil) + +// NewEnumField factory function for _EnumField +func NewEnumField(value int64, displayName LocalizedText, description LocalizedText, name PascalString) *_EnumField { + if displayName == nil { + panic("displayName of type LocalizedText for EnumField must not be nil") + } + if description == nil { + panic("description of type LocalizedText for EnumField must not be nil") + } + if name == nil { + panic("name of type PascalString for EnumField must not be nil") + } + _result := &_EnumField{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Value: value, + DisplayName: displayName, + Description: description, + Name: name, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// EnumFieldBuilder is a builder for EnumField +type EnumFieldBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(value int64, displayName LocalizedText, description LocalizedText, name PascalString) EnumFieldBuilder + // WithValue adds Value (property field) + WithValue(int64) EnumFieldBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) EnumFieldBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) EnumFieldBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) EnumFieldBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) EnumFieldBuilder + // WithName adds Name (property field) + WithName(PascalString) EnumFieldBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) EnumFieldBuilder + // Build builds the EnumField or returns an error if something is wrong + Build() (EnumField, error) + // MustBuild does the same as Build but panics on error + MustBuild() EnumField +} + +// NewEnumFieldBuilder() creates a EnumFieldBuilder +func NewEnumFieldBuilder() EnumFieldBuilder { + return &_EnumFieldBuilder{_EnumField: new(_EnumField)} +} + +type _EnumFieldBuilder struct { + *_EnumField + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (EnumFieldBuilder) = (*_EnumFieldBuilder)(nil) + +func (b *_EnumFieldBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_EnumFieldBuilder) WithMandatoryFields(value int64, displayName LocalizedText, description LocalizedText, name PascalString) EnumFieldBuilder { + return b.WithValue(value).WithDisplayName(displayName).WithDescription(description).WithName(name) +} + +func (b *_EnumFieldBuilder) WithValue(value int64) EnumFieldBuilder { + b.Value = value + return b +} + +func (b *_EnumFieldBuilder) WithDisplayName(displayName LocalizedText) EnumFieldBuilder { + b.DisplayName = displayName + return b +} + +func (b *_EnumFieldBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) EnumFieldBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_EnumFieldBuilder) WithDescription(description LocalizedText) EnumFieldBuilder { + b.Description = description + return b +} + +func (b *_EnumFieldBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) EnumFieldBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_EnumFieldBuilder) WithName(name PascalString) EnumFieldBuilder { + b.Name = name + return b +} + +func (b *_EnumFieldBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) EnumFieldBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_EnumFieldBuilder) Build() (EnumField, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._EnumField.deepCopy(), nil +} + +func (b *_EnumFieldBuilder) MustBuild() EnumField { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_EnumFieldBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_EnumFieldBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_EnumFieldBuilder) DeepCopy() any { + _copy := b.CreateEnumFieldBuilder().(*_EnumFieldBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateEnumFieldBuilder creates a EnumFieldBuilder +func (b *_EnumField) CreateEnumFieldBuilder() EnumFieldBuilder { + if b == nil { + return NewEnumFieldBuilder() + } + return &_EnumFieldBuilder{_EnumField: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_EnumField) GetExtensionId() int32 { + return int32(104) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_EnumField) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_EnumField) GetValue() int64 { + return m.Value +} + +func (m *_EnumField) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_EnumField) GetDescription() LocalizedText { + return m.Description +} + +func (m *_EnumField) GetName() PascalString { + return m.Name +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastEnumField(structType any) EnumField { + if casted, ok := structType.(EnumField); ok { + return casted + } + if casted, ok := structType.(*EnumField); ok { + return *casted + } + return nil +} + +func (m *_EnumField) GetTypeName() string { + return "EnumField" +} + +func (m *_EnumField) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (value) + lengthInBits += 64 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_EnumField) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_EnumField) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__enumField EnumField, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("EnumField"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for EnumField") + } + currentPos := positionAware.GetPos() + _ = currentPos + + value, err := ReadSimpleField(ctx, "value", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'value' field")) + } + m.Value = value + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + if closeErr := readBuffer.CloseContext("EnumField"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for EnumField") + } + + return m, nil +} + +func (m *_EnumField) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_EnumField) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("EnumField"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for EnumField") + } + + if err := WriteSimpleField[int64](ctx, "value", m.GetValue(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'value' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if popErr := writeBuffer.PopContext("EnumField"); popErr != nil { + return errors.Wrap(popErr, "Error popping for EnumField") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_EnumField) IsEnumField() {} + +func (m *_EnumField) DeepCopy() any { + return m.deepCopy() +} + +func (m *_EnumField) deepCopy() *_EnumField { + if m == nil { + return nil + } + _EnumFieldCopy := &_EnumField{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Value, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.Name.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _EnumFieldCopy +} + +func (m *_EnumField) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EnumValueType.go b/plc4go/protocols/opcua/readwrite/model/EnumValueType.go index 0583800d388..02df5168d7d 100644 --- a/plc4go/protocols/opcua/readwrite/model/EnumValueType.go +++ b/plc4go/protocols/opcua/readwrite/model/EnumValueType.go @@ -233,8 +233,8 @@ func (b *_EnumValueType) CreateEnumValueTypeBuilder() EnumValueTypeBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EnumValueType) GetIdentifier() string { - return "7596" +func (m *_EnumValueType) GetExtensionId() int32 { + return int32(7596) } /////////////////////// @@ -302,7 +302,7 @@ func (m *_EnumValueType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EnumValueType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__enumValueType EnumValueType, err error) { +func (m *_EnumValueType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__enumValueType EnumValueType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/EphemeralKeyType.go b/plc4go/protocols/opcua/readwrite/model/EphemeralKeyType.go index 0d2b7330ad7..bfecf76b8e1 100644 --- a/plc4go/protocols/opcua/readwrite/model/EphemeralKeyType.go +++ b/plc4go/protocols/opcua/readwrite/model/EphemeralKeyType.go @@ -222,8 +222,8 @@ func (b *_EphemeralKeyType) CreateEphemeralKeyTypeBuilder() EphemeralKeyTypeBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EphemeralKeyType) GetIdentifier() string { - return "17550" +func (m *_EphemeralKeyType) GetExtensionId() int32 { + return int32(17550) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_EphemeralKeyType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EphemeralKeyType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__ephemeralKeyType EphemeralKeyType, err error) { +func (m *_EphemeralKeyType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__ephemeralKeyType EphemeralKeyType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/EventFieldList.go b/plc4go/protocols/opcua/readwrite/model/EventFieldList.go index d51c119bd3d..3e9e373d715 100644 --- a/plc4go/protocols/opcua/readwrite/model/EventFieldList.go +++ b/plc4go/protocols/opcua/readwrite/model/EventFieldList.go @@ -42,8 +42,6 @@ type EventFieldList interface { ExtensionObjectDefinition // GetClientHandle returns ClientHandle (property field) GetClientHandle() uint32 - // GetNoOfEventFields returns NoOfEventFields (property field) - GetNoOfEventFields() int32 // GetEventFields returns EventFields (property field) GetEventFields() []Variant // IsEventFieldList is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,20 +53,18 @@ type EventFieldList interface { // _EventFieldList is the data-structure of this message type _EventFieldList struct { ExtensionObjectDefinitionContract - ClientHandle uint32 - NoOfEventFields int32 - EventFields []Variant + ClientHandle uint32 + EventFields []Variant } var _ EventFieldList = (*_EventFieldList)(nil) var _ ExtensionObjectDefinitionRequirements = (*_EventFieldList)(nil) // NewEventFieldList factory function for _EventFieldList -func NewEventFieldList(clientHandle uint32, noOfEventFields int32, eventFields []Variant) *_EventFieldList { +func NewEventFieldList(clientHandle uint32, eventFields []Variant) *_EventFieldList { _result := &_EventFieldList{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ClientHandle: clientHandle, - NoOfEventFields: noOfEventFields, EventFields: eventFields, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -84,11 +80,9 @@ func NewEventFieldList(clientHandle uint32, noOfEventFields int32, eventFields [ type EventFieldListBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(clientHandle uint32, noOfEventFields int32, eventFields []Variant) EventFieldListBuilder + WithMandatoryFields(clientHandle uint32, eventFields []Variant) EventFieldListBuilder // WithClientHandle adds ClientHandle (property field) WithClientHandle(uint32) EventFieldListBuilder - // WithNoOfEventFields adds NoOfEventFields (property field) - WithNoOfEventFields(int32) EventFieldListBuilder // WithEventFields adds EventFields (property field) WithEventFields(...Variant) EventFieldListBuilder // Build builds the EventFieldList or returns an error if something is wrong @@ -116,8 +110,8 @@ func (b *_EventFieldListBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_EventFieldListBuilder) WithMandatoryFields(clientHandle uint32, noOfEventFields int32, eventFields []Variant) EventFieldListBuilder { - return b.WithClientHandle(clientHandle).WithNoOfEventFields(noOfEventFields).WithEventFields(eventFields...) +func (b *_EventFieldListBuilder) WithMandatoryFields(clientHandle uint32, eventFields []Variant) EventFieldListBuilder { + return b.WithClientHandle(clientHandle).WithEventFields(eventFields...) } func (b *_EventFieldListBuilder) WithClientHandle(clientHandle uint32) EventFieldListBuilder { @@ -125,11 +119,6 @@ func (b *_EventFieldListBuilder) WithClientHandle(clientHandle uint32) EventFiel return b } -func (b *_EventFieldListBuilder) WithNoOfEventFields(noOfEventFields int32) EventFieldListBuilder { - b.NoOfEventFields = noOfEventFields - return b -} - func (b *_EventFieldListBuilder) WithEventFields(eventFields ...Variant) EventFieldListBuilder { b.EventFields = eventFields return b @@ -185,8 +174,8 @@ func (b *_EventFieldList) CreateEventFieldListBuilder() EventFieldListBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EventFieldList) GetIdentifier() string { - return "919" +func (m *_EventFieldList) GetExtensionId() int32 { + return int32(919) } /////////////////////// @@ -207,10 +196,6 @@ func (m *_EventFieldList) GetClientHandle() uint32 { return m.ClientHandle } -func (m *_EventFieldList) GetNoOfEventFields() int32 { - return m.NoOfEventFields -} - func (m *_EventFieldList) GetEventFields() []Variant { return m.EventFields } @@ -241,7 +226,7 @@ func (m *_EventFieldList) GetLengthInBits(ctx context.Context) uint16 { // Simple field (clientHandle) lengthInBits += 32 - // Simple field (noOfEventFields) + // Implicit Field (noOfEventFields) lengthInBits += 32 // Array field @@ -261,7 +246,7 @@ func (m *_EventFieldList) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EventFieldList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__eventFieldList EventFieldList, err error) { +func (m *_EventFieldList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__eventFieldList EventFieldList, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -278,11 +263,11 @@ func (m *_EventFieldList) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.ClientHandle = clientHandle - noOfEventFields, err := ReadSimpleField(ctx, "noOfEventFields", ReadSignedInt(readBuffer, uint8(32))) + noOfEventFields, err := ReadImplicitField[int32](ctx, "noOfEventFields", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEventFields' field")) } - m.NoOfEventFields = noOfEventFields + _ = noOfEventFields eventFields, err := ReadCountArrayField[Variant](ctx, "eventFields", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfEventFields)) if err != nil { @@ -318,8 +303,8 @@ func (m *_EventFieldList) SerializeWithWriteBuffer(ctx context.Context, writeBuf if err := WriteSimpleField[uint32](ctx, "clientHandle", m.GetClientHandle(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'clientHandle' field") } - - if err := WriteSimpleField[int32](ctx, "noOfEventFields", m.GetNoOfEventFields(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEventFields := int32(utils.InlineIf(bool((m.GetEventFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEventFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEventFields", noOfEventFields, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEventFields' field") } @@ -348,7 +333,6 @@ func (m *_EventFieldList) deepCopy() *_EventFieldList { _EventFieldListCopy := &_EventFieldList{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.ClientHandle, - m.NoOfEventFields, utils.DeepCopySlice[Variant, Variant](m.EventFields), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/EventFilter.go b/plc4go/protocols/opcua/readwrite/model/EventFilter.go new file mode 100644 index 00000000000..015ce2abfa6 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/EventFilter.go @@ -0,0 +1,379 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// EventFilter is the corresponding interface of EventFilter +type EventFilter interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSelectClauses returns SelectClauses (property field) + GetSelectClauses() []SimpleAttributeOperand + // GetWhereClause returns WhereClause (property field) + GetWhereClause() ContentFilter + // IsEventFilter is a marker method to prevent unintentional type checks (interfaces of same signature) + IsEventFilter() + // CreateBuilder creates a EventFilterBuilder + CreateEventFilterBuilder() EventFilterBuilder +} + +// _EventFilter is the data-structure of this message +type _EventFilter struct { + ExtensionObjectDefinitionContract + SelectClauses []SimpleAttributeOperand + WhereClause ContentFilter +} + +var _ EventFilter = (*_EventFilter)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_EventFilter)(nil) + +// NewEventFilter factory function for _EventFilter +func NewEventFilter(selectClauses []SimpleAttributeOperand, whereClause ContentFilter) *_EventFilter { + if whereClause == nil { + panic("whereClause of type ContentFilter for EventFilter must not be nil") + } + _result := &_EventFilter{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SelectClauses: selectClauses, + WhereClause: whereClause, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// EventFilterBuilder is a builder for EventFilter +type EventFilterBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(selectClauses []SimpleAttributeOperand, whereClause ContentFilter) EventFilterBuilder + // WithSelectClauses adds SelectClauses (property field) + WithSelectClauses(...SimpleAttributeOperand) EventFilterBuilder + // WithWhereClause adds WhereClause (property field) + WithWhereClause(ContentFilter) EventFilterBuilder + // WithWhereClauseBuilder adds WhereClause (property field) which is build by the builder + WithWhereClauseBuilder(func(ContentFilterBuilder) ContentFilterBuilder) EventFilterBuilder + // Build builds the EventFilter or returns an error if something is wrong + Build() (EventFilter, error) + // MustBuild does the same as Build but panics on error + MustBuild() EventFilter +} + +// NewEventFilterBuilder() creates a EventFilterBuilder +func NewEventFilterBuilder() EventFilterBuilder { + return &_EventFilterBuilder{_EventFilter: new(_EventFilter)} +} + +type _EventFilterBuilder struct { + *_EventFilter + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (EventFilterBuilder) = (*_EventFilterBuilder)(nil) + +func (b *_EventFilterBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_EventFilterBuilder) WithMandatoryFields(selectClauses []SimpleAttributeOperand, whereClause ContentFilter) EventFilterBuilder { + return b.WithSelectClauses(selectClauses...).WithWhereClause(whereClause) +} + +func (b *_EventFilterBuilder) WithSelectClauses(selectClauses ...SimpleAttributeOperand) EventFilterBuilder { + b.SelectClauses = selectClauses + return b +} + +func (b *_EventFilterBuilder) WithWhereClause(whereClause ContentFilter) EventFilterBuilder { + b.WhereClause = whereClause + return b +} + +func (b *_EventFilterBuilder) WithWhereClauseBuilder(builderSupplier func(ContentFilterBuilder) ContentFilterBuilder) EventFilterBuilder { + builder := builderSupplier(b.WhereClause.CreateContentFilterBuilder()) + var err error + b.WhereClause, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ContentFilterBuilder failed")) + } + return b +} + +func (b *_EventFilterBuilder) Build() (EventFilter, error) { + if b.WhereClause == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'whereClause' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._EventFilter.deepCopy(), nil +} + +func (b *_EventFilterBuilder) MustBuild() EventFilter { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_EventFilterBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_EventFilterBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_EventFilterBuilder) DeepCopy() any { + _copy := b.CreateEventFilterBuilder().(*_EventFilterBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateEventFilterBuilder creates a EventFilterBuilder +func (b *_EventFilter) CreateEventFilterBuilder() EventFilterBuilder { + if b == nil { + return NewEventFilterBuilder() + } + return &_EventFilterBuilder{_EventFilter: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_EventFilter) GetExtensionId() int32 { + return int32(727) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_EventFilter) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_EventFilter) GetSelectClauses() []SimpleAttributeOperand { + return m.SelectClauses +} + +func (m *_EventFilter) GetWhereClause() ContentFilter { + return m.WhereClause +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastEventFilter(structType any) EventFilter { + if casted, ok := structType.(EventFilter); ok { + return casted + } + if casted, ok := structType.(*EventFilter); ok { + return *casted + } + return nil +} + +func (m *_EventFilter) GetTypeName() string { + return "EventFilter" +} + +func (m *_EventFilter) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfSelectClauses) + lengthInBits += 32 + + // Array field + if len(m.SelectClauses) > 0 { + for _curItem, element := range m.SelectClauses { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SelectClauses), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (whereClause) + lengthInBits += m.WhereClause.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_EventFilter) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_EventFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__eventFilter EventFilter, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("EventFilter"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for EventFilter") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfSelectClauses, err := ReadImplicitField[int32](ctx, "noOfSelectClauses", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSelectClauses' field")) + } + _ = noOfSelectClauses + + selectClauses, err := ReadCountArrayField[SimpleAttributeOperand](ctx, "selectClauses", ReadComplex[SimpleAttributeOperand](ExtensionObjectDefinitionParseWithBufferProducer[SimpleAttributeOperand]((int32)(int32(603))), readBuffer), uint64(noOfSelectClauses)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'selectClauses' field")) + } + m.SelectClauses = selectClauses + + whereClause, err := ReadSimpleField[ContentFilter](ctx, "whereClause", ReadComplex[ContentFilter](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilter]((int32)(int32(588))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'whereClause' field")) + } + m.WhereClause = whereClause + + if closeErr := readBuffer.CloseContext("EventFilter"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for EventFilter") + } + + return m, nil +} + +func (m *_EventFilter) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_EventFilter) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("EventFilter"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for EventFilter") + } + noOfSelectClauses := int32(utils.InlineIf(bool((m.GetSelectClauses()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSelectClauses()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSelectClauses", noOfSelectClauses, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSelectClauses' field") + } + + if err := WriteComplexTypeArrayField(ctx, "selectClauses", m.GetSelectClauses(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'selectClauses' field") + } + + if err := WriteSimpleField[ContentFilter](ctx, "whereClause", m.GetWhereClause(), WriteComplex[ContentFilter](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'whereClause' field") + } + + if popErr := writeBuffer.PopContext("EventFilter"); popErr != nil { + return errors.Wrap(popErr, "Error popping for EventFilter") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_EventFilter) IsEventFilter() {} + +func (m *_EventFilter) DeepCopy() any { + return m.deepCopy() +} + +func (m *_EventFilter) deepCopy() *_EventFilter { + if m == nil { + return nil + } + _EventFilterCopy := &_EventFilter{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[SimpleAttributeOperand, SimpleAttributeOperand](m.SelectClauses), + m.WhereClause.DeepCopy().(ContentFilter), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _EventFilterCopy +} + +func (m *_EventFilter) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EventFilterResult.go b/plc4go/protocols/opcua/readwrite/model/EventFilterResult.go new file mode 100644 index 00000000000..6e5ff6b0e2f --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/EventFilterResult.go @@ -0,0 +1,428 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// EventFilterResult is the corresponding interface of EventFilterResult +type EventFilterResult interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSelectClauseResults returns SelectClauseResults (property field) + GetSelectClauseResults() []StatusCode + // GetSelectClauseDiagnosticInfos returns SelectClauseDiagnosticInfos (property field) + GetSelectClauseDiagnosticInfos() []DiagnosticInfo + // GetWhereClauseResult returns WhereClauseResult (property field) + GetWhereClauseResult() ContentFilterResult + // IsEventFilterResult is a marker method to prevent unintentional type checks (interfaces of same signature) + IsEventFilterResult() + // CreateBuilder creates a EventFilterResultBuilder + CreateEventFilterResultBuilder() EventFilterResultBuilder +} + +// _EventFilterResult is the data-structure of this message +type _EventFilterResult struct { + ExtensionObjectDefinitionContract + SelectClauseResults []StatusCode + SelectClauseDiagnosticInfos []DiagnosticInfo + WhereClauseResult ContentFilterResult +} + +var _ EventFilterResult = (*_EventFilterResult)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_EventFilterResult)(nil) + +// NewEventFilterResult factory function for _EventFilterResult +func NewEventFilterResult(selectClauseResults []StatusCode, selectClauseDiagnosticInfos []DiagnosticInfo, whereClauseResult ContentFilterResult) *_EventFilterResult { + if whereClauseResult == nil { + panic("whereClauseResult of type ContentFilterResult for EventFilterResult must not be nil") + } + _result := &_EventFilterResult{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SelectClauseResults: selectClauseResults, + SelectClauseDiagnosticInfos: selectClauseDiagnosticInfos, + WhereClauseResult: whereClauseResult, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// EventFilterResultBuilder is a builder for EventFilterResult +type EventFilterResultBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(selectClauseResults []StatusCode, selectClauseDiagnosticInfos []DiagnosticInfo, whereClauseResult ContentFilterResult) EventFilterResultBuilder + // WithSelectClauseResults adds SelectClauseResults (property field) + WithSelectClauseResults(...StatusCode) EventFilterResultBuilder + // WithSelectClauseDiagnosticInfos adds SelectClauseDiagnosticInfos (property field) + WithSelectClauseDiagnosticInfos(...DiagnosticInfo) EventFilterResultBuilder + // WithWhereClauseResult adds WhereClauseResult (property field) + WithWhereClauseResult(ContentFilterResult) EventFilterResultBuilder + // WithWhereClauseResultBuilder adds WhereClauseResult (property field) which is build by the builder + WithWhereClauseResultBuilder(func(ContentFilterResultBuilder) ContentFilterResultBuilder) EventFilterResultBuilder + // Build builds the EventFilterResult or returns an error if something is wrong + Build() (EventFilterResult, error) + // MustBuild does the same as Build but panics on error + MustBuild() EventFilterResult +} + +// NewEventFilterResultBuilder() creates a EventFilterResultBuilder +func NewEventFilterResultBuilder() EventFilterResultBuilder { + return &_EventFilterResultBuilder{_EventFilterResult: new(_EventFilterResult)} +} + +type _EventFilterResultBuilder struct { + *_EventFilterResult + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (EventFilterResultBuilder) = (*_EventFilterResultBuilder)(nil) + +func (b *_EventFilterResultBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_EventFilterResultBuilder) WithMandatoryFields(selectClauseResults []StatusCode, selectClauseDiagnosticInfos []DiagnosticInfo, whereClauseResult ContentFilterResult) EventFilterResultBuilder { + return b.WithSelectClauseResults(selectClauseResults...).WithSelectClauseDiagnosticInfos(selectClauseDiagnosticInfos...).WithWhereClauseResult(whereClauseResult) +} + +func (b *_EventFilterResultBuilder) WithSelectClauseResults(selectClauseResults ...StatusCode) EventFilterResultBuilder { + b.SelectClauseResults = selectClauseResults + return b +} + +func (b *_EventFilterResultBuilder) WithSelectClauseDiagnosticInfos(selectClauseDiagnosticInfos ...DiagnosticInfo) EventFilterResultBuilder { + b.SelectClauseDiagnosticInfos = selectClauseDiagnosticInfos + return b +} + +func (b *_EventFilterResultBuilder) WithWhereClauseResult(whereClauseResult ContentFilterResult) EventFilterResultBuilder { + b.WhereClauseResult = whereClauseResult + return b +} + +func (b *_EventFilterResultBuilder) WithWhereClauseResultBuilder(builderSupplier func(ContentFilterResultBuilder) ContentFilterResultBuilder) EventFilterResultBuilder { + builder := builderSupplier(b.WhereClauseResult.CreateContentFilterResultBuilder()) + var err error + b.WhereClauseResult, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ContentFilterResultBuilder failed")) + } + return b +} + +func (b *_EventFilterResultBuilder) Build() (EventFilterResult, error) { + if b.WhereClauseResult == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'whereClauseResult' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._EventFilterResult.deepCopy(), nil +} + +func (b *_EventFilterResultBuilder) MustBuild() EventFilterResult { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_EventFilterResultBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_EventFilterResultBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_EventFilterResultBuilder) DeepCopy() any { + _copy := b.CreateEventFilterResultBuilder().(*_EventFilterResultBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateEventFilterResultBuilder creates a EventFilterResultBuilder +func (b *_EventFilterResult) CreateEventFilterResultBuilder() EventFilterResultBuilder { + if b == nil { + return NewEventFilterResultBuilder() + } + return &_EventFilterResultBuilder{_EventFilterResult: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_EventFilterResult) GetExtensionId() int32 { + return int32(736) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_EventFilterResult) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_EventFilterResult) GetSelectClauseResults() []StatusCode { + return m.SelectClauseResults +} + +func (m *_EventFilterResult) GetSelectClauseDiagnosticInfos() []DiagnosticInfo { + return m.SelectClauseDiagnosticInfos +} + +func (m *_EventFilterResult) GetWhereClauseResult() ContentFilterResult { + return m.WhereClauseResult +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastEventFilterResult(structType any) EventFilterResult { + if casted, ok := structType.(EventFilterResult); ok { + return casted + } + if casted, ok := structType.(*EventFilterResult); ok { + return *casted + } + return nil +} + +func (m *_EventFilterResult) GetTypeName() string { + return "EventFilterResult" +} + +func (m *_EventFilterResult) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfSelectClauseResults) + lengthInBits += 32 + + // Array field + if len(m.SelectClauseResults) > 0 { + for _curItem, element := range m.SelectClauseResults { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SelectClauseResults), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfSelectClauseDiagnosticInfos) + lengthInBits += 32 + + // Array field + if len(m.SelectClauseDiagnosticInfos) > 0 { + for _curItem, element := range m.SelectClauseDiagnosticInfos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SelectClauseDiagnosticInfos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (whereClauseResult) + lengthInBits += m.WhereClauseResult.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_EventFilterResult) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_EventFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__eventFilterResult EventFilterResult, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("EventFilterResult"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for EventFilterResult") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfSelectClauseResults, err := ReadImplicitField[int32](ctx, "noOfSelectClauseResults", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSelectClauseResults' field")) + } + _ = noOfSelectClauseResults + + selectClauseResults, err := ReadCountArrayField[StatusCode](ctx, "selectClauseResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfSelectClauseResults)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'selectClauseResults' field")) + } + m.SelectClauseResults = selectClauseResults + + noOfSelectClauseDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfSelectClauseDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSelectClauseDiagnosticInfos' field")) + } + _ = noOfSelectClauseDiagnosticInfos + + selectClauseDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "selectClauseDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfSelectClauseDiagnosticInfos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'selectClauseDiagnosticInfos' field")) + } + m.SelectClauseDiagnosticInfos = selectClauseDiagnosticInfos + + whereClauseResult, err := ReadSimpleField[ContentFilterResult](ctx, "whereClauseResult", ReadComplex[ContentFilterResult](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilterResult]((int32)(int32(609))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'whereClauseResult' field")) + } + m.WhereClauseResult = whereClauseResult + + if closeErr := readBuffer.CloseContext("EventFilterResult"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for EventFilterResult") + } + + return m, nil +} + +func (m *_EventFilterResult) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_EventFilterResult) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("EventFilterResult"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for EventFilterResult") + } + noOfSelectClauseResults := int32(utils.InlineIf(bool((m.GetSelectClauseResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSelectClauseResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSelectClauseResults", noOfSelectClauseResults, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSelectClauseResults' field") + } + + if err := WriteComplexTypeArrayField(ctx, "selectClauseResults", m.GetSelectClauseResults(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'selectClauseResults' field") + } + noOfSelectClauseDiagnosticInfos := int32(utils.InlineIf(bool((m.GetSelectClauseDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSelectClauseDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSelectClauseDiagnosticInfos", noOfSelectClauseDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSelectClauseDiagnosticInfos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "selectClauseDiagnosticInfos", m.GetSelectClauseDiagnosticInfos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'selectClauseDiagnosticInfos' field") + } + + if err := WriteSimpleField[ContentFilterResult](ctx, "whereClauseResult", m.GetWhereClauseResult(), WriteComplex[ContentFilterResult](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'whereClauseResult' field") + } + + if popErr := writeBuffer.PopContext("EventFilterResult"); popErr != nil { + return errors.Wrap(popErr, "Error popping for EventFilterResult") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_EventFilterResult) IsEventFilterResult() {} + +func (m *_EventFilterResult) DeepCopy() any { + return m.deepCopy() +} + +func (m *_EventFilterResult) deepCopy() *_EventFilterResult { + if m == nil { + return nil + } + _EventFilterResultCopy := &_EventFilterResult{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[StatusCode, StatusCode](m.SelectClauseResults), + utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.SelectClauseDiagnosticInfos), + m.WhereClauseResult.DeepCopy().(ContentFilterResult), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _EventFilterResultCopy +} + +func (m *_EventFilterResult) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/EventNotificationList.go b/plc4go/protocols/opcua/readwrite/model/EventNotificationList.go index c385280f110..f354f33a679 100644 --- a/plc4go/protocols/opcua/readwrite/model/EventNotificationList.go +++ b/plc4go/protocols/opcua/readwrite/model/EventNotificationList.go @@ -40,10 +40,8 @@ type EventNotificationList interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfEvents returns NoOfEvents (property field) - GetNoOfEvents() int32 // GetEvents returns Events (property field) - GetEvents() []ExtensionObjectDefinition + GetEvents() []EventFieldList // IsEventNotificationList is a marker method to prevent unintentional type checks (interfaces of same signature) IsEventNotificationList() // CreateBuilder creates a EventNotificationListBuilder @@ -53,18 +51,16 @@ type EventNotificationList interface { // _EventNotificationList is the data-structure of this message type _EventNotificationList struct { ExtensionObjectDefinitionContract - NoOfEvents int32 - Events []ExtensionObjectDefinition + Events []EventFieldList } var _ EventNotificationList = (*_EventNotificationList)(nil) var _ ExtensionObjectDefinitionRequirements = (*_EventNotificationList)(nil) // NewEventNotificationList factory function for _EventNotificationList -func NewEventNotificationList(noOfEvents int32, events []ExtensionObjectDefinition) *_EventNotificationList { +func NewEventNotificationList(events []EventFieldList) *_EventNotificationList { _result := &_EventNotificationList{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfEvents: noOfEvents, Events: events, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,11 +76,9 @@ func NewEventNotificationList(noOfEvents int32, events []ExtensionObjectDefiniti type EventNotificationListBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfEvents int32, events []ExtensionObjectDefinition) EventNotificationListBuilder - // WithNoOfEvents adds NoOfEvents (property field) - WithNoOfEvents(int32) EventNotificationListBuilder + WithMandatoryFields(events []EventFieldList) EventNotificationListBuilder // WithEvents adds Events (property field) - WithEvents(...ExtensionObjectDefinition) EventNotificationListBuilder + WithEvents(...EventFieldList) EventNotificationListBuilder // Build builds the EventNotificationList or returns an error if something is wrong Build() (EventNotificationList, error) // MustBuild does the same as Build but panics on error @@ -110,16 +104,11 @@ func (b *_EventNotificationListBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_EventNotificationListBuilder) WithMandatoryFields(noOfEvents int32, events []ExtensionObjectDefinition) EventNotificationListBuilder { - return b.WithNoOfEvents(noOfEvents).WithEvents(events...) +func (b *_EventNotificationListBuilder) WithMandatoryFields(events []EventFieldList) EventNotificationListBuilder { + return b.WithEvents(events...) } -func (b *_EventNotificationListBuilder) WithNoOfEvents(noOfEvents int32) EventNotificationListBuilder { - b.NoOfEvents = noOfEvents - return b -} - -func (b *_EventNotificationListBuilder) WithEvents(events ...ExtensionObjectDefinition) EventNotificationListBuilder { +func (b *_EventNotificationListBuilder) WithEvents(events ...EventFieldList) EventNotificationListBuilder { b.Events = events return b } @@ -174,8 +163,8 @@ func (b *_EventNotificationList) CreateEventNotificationListBuilder() EventNotif /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_EventNotificationList) GetIdentifier() string { - return "916" +func (m *_EventNotificationList) GetExtensionId() int32 { + return int32(916) } /////////////////////// @@ -192,11 +181,7 @@ func (m *_EventNotificationList) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_EventNotificationList) GetNoOfEvents() int32 { - return m.NoOfEvents -} - -func (m *_EventNotificationList) GetEvents() []ExtensionObjectDefinition { +func (m *_EventNotificationList) GetEvents() []EventFieldList { return m.Events } @@ -223,10 +208,7 @@ func (m *_EventNotificationList) GetTypeName() string { func (m *_EventNotificationList) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Implicit Field (notificationLength) - lengthInBits += 32 - - // Simple field (noOfEvents) + // Implicit Field (noOfEvents) lengthInBits += 32 // Array field @@ -246,7 +228,7 @@ func (m *_EventNotificationList) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_EventNotificationList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__eventNotificationList EventNotificationList, err error) { +func (m *_EventNotificationList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__eventNotificationList EventNotificationList, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -257,19 +239,13 @@ func (m *_EventNotificationList) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - notificationLength, err := ReadImplicitField[int32](ctx, "notificationLength", ReadSignedInt(readBuffer, uint8(32))) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationLength' field")) - } - _ = notificationLength - - noOfEvents, err := ReadSimpleField(ctx, "noOfEvents", ReadSignedInt(readBuffer, uint8(32))) + noOfEvents, err := ReadImplicitField[int32](ctx, "noOfEvents", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEvents' field")) } - m.NoOfEvents = noOfEvents + _ = noOfEvents - events, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "events", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("919")), readBuffer), uint64(noOfEvents)) + events, err := ReadCountArrayField[EventFieldList](ctx, "events", ReadComplex[EventFieldList](ExtensionObjectDefinitionParseWithBufferProducer[EventFieldList]((int32)(int32(919))), readBuffer), uint64(noOfEvents)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'events' field")) } @@ -299,12 +275,8 @@ func (m *_EventNotificationList) SerializeWithWriteBuffer(ctx context.Context, w if pushErr := writeBuffer.PushContext("EventNotificationList"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for EventNotificationList") } - notificationLength := int32(int32(m.GetLengthInBytes(ctx))) - if err := WriteImplicitField(ctx, "notificationLength", notificationLength, WriteSignedInt(writeBuffer, 32)); err != nil { - return errors.Wrap(err, "Error serializing 'notificationLength' field") - } - - if err := WriteSimpleField[int32](ctx, "noOfEvents", m.GetNoOfEvents(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEvents := int32(utils.InlineIf(bool((m.GetEvents()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEvents()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEvents", noOfEvents, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEvents' field") } @@ -332,8 +304,7 @@ func (m *_EventNotificationList) deepCopy() *_EventNotificationList { } _EventNotificationListCopy := &_EventNotificationList{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfEvents, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Events), + utils.DeepCopySlice[EventFieldList, EventFieldList](m.Events), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _EventNotificationListCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ExpandedNodeId.go b/plc4go/protocols/opcua/readwrite/model/ExpandedNodeId.go index 43693176235..657d75106f8 100644 --- a/plc4go/protocols/opcua/readwrite/model/ExpandedNodeId.go +++ b/plc4go/protocols/opcua/readwrite/model/ExpandedNodeId.go @@ -49,8 +49,6 @@ type ExpandedNodeId interface { GetNamespaceURI() PascalString // GetServerIndex returns ServerIndex (property field) GetServerIndex() *uint32 - // GetIdentifier returns Identifier (virtual field) - GetIdentifier() string // IsExpandedNodeId is a marker method to prevent unintentional type checks (interfaces of same signature) IsExpandedNodeId() // CreateBuilder creates a ExpandedNodeIdBuilder @@ -241,25 +239,6 @@ func (m *_ExpandedNodeId) GetServerIndex() *uint32 { return m.ServerIndex } -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Accessors for virtual fields. -/////////////////////// - -func (m *_ExpandedNodeId) GetIdentifier() string { - ctx := context.Background() - _ = ctx - namespaceURI := m.GetNamespaceURI() - _ = namespaceURI - serverIndex := m.GetServerIndex() - _ = serverIndex - return fmt.Sprintf("%v", m.GetNodeId().GetIdentifier()) -} - /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -292,8 +271,6 @@ func (m *_ExpandedNodeId) GetLengthInBits(ctx context.Context) uint16 { // Simple field (nodeId) lengthInBits += m.NodeId.GetLengthInBits(ctx) - // A virtual field doesn't have any in- or output. - // Optional Field (namespaceURI) if m.NamespaceURI != nil { lengthInBits += m.NamespaceURI.GetLengthInBits(ctx) @@ -356,12 +333,6 @@ func (m *_ExpandedNodeId) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.NodeId = nodeId - identifier, err := ReadVirtualField[string](ctx, "identifier", (*string)(nil), nodeId.GetIdentifier()) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'identifier' field")) - } - _ = identifier - var namespaceURI PascalString _namespaceURI, err := ReadOptionalField[PascalString](ctx, "namespaceURI", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), namespaceURISpecified) if err != nil { @@ -414,12 +385,6 @@ func (m *_ExpandedNodeId) SerializeWithWriteBuffer(ctx context.Context, writeBuf if err := WriteSimpleField[NodeIdTypeDefinition](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeIdTypeDefinition](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'nodeId' field") } - // Virtual field - identifier := m.GetIdentifier() - _ = identifier - if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { - return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") - } if err := WriteOptionalField[PascalString](ctx, "namespaceURI", GetRef(m.GetNamespaceURI()), WriteComplex[PascalString](writeBuffer), true); err != nil { return errors.Wrap(err, "Error serializing 'namespaceURI' field") diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensiblePayload.go b/plc4go/protocols/opcua/readwrite/model/ExtensiblePayload.go index d3d4ca71e1b..321b3df1dfc 100644 --- a/plc4go/protocols/opcua/readwrite/model/ExtensiblePayload.go +++ b/plc4go/protocols/opcua/readwrite/model/ExtensiblePayload.go @@ -41,7 +41,7 @@ type ExtensiblePayload interface { utils.Copyable Payload // GetPayload returns Payload (property field) - GetPayload() ExtensionObject + GetPayload() RootExtensionObject // IsExtensiblePayload is a marker method to prevent unintentional type checks (interfaces of same signature) IsExtensiblePayload() // CreateBuilder creates a ExtensiblePayloadBuilder @@ -51,16 +51,16 @@ type ExtensiblePayload interface { // _ExtensiblePayload is the data-structure of this message type _ExtensiblePayload struct { PayloadContract - Payload ExtensionObject + Payload RootExtensionObject } var _ ExtensiblePayload = (*_ExtensiblePayload)(nil) var _ PayloadRequirements = (*_ExtensiblePayload)(nil) // NewExtensiblePayload factory function for _ExtensiblePayload -func NewExtensiblePayload(sequenceHeader SequenceHeader, payload ExtensionObject, byteCount uint32) *_ExtensiblePayload { +func NewExtensiblePayload(sequenceHeader SequenceHeader, payload RootExtensionObject, byteCount uint32) *_ExtensiblePayload { if payload == nil { - panic("payload of type ExtensionObject for ExtensiblePayload must not be nil") + panic("payload of type RootExtensionObject for ExtensiblePayload must not be nil") } _result := &_ExtensiblePayload{ PayloadContract: NewPayload(sequenceHeader, byteCount), @@ -79,11 +79,11 @@ func NewExtensiblePayload(sequenceHeader SequenceHeader, payload ExtensionObject type ExtensiblePayloadBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(payload ExtensionObject) ExtensiblePayloadBuilder + WithMandatoryFields(payload RootExtensionObject) ExtensiblePayloadBuilder // WithPayload adds Payload (property field) - WithPayload(ExtensionObject) ExtensiblePayloadBuilder + WithPayload(RootExtensionObject) ExtensiblePayloadBuilder // WithPayloadBuilder adds Payload (property field) which is build by the builder - WithPayloadBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) ExtensiblePayloadBuilder + WithPayloadBuilder(func(RootExtensionObjectBuilder) RootExtensionObjectBuilder) ExtensiblePayloadBuilder // Build builds the ExtensiblePayload or returns an error if something is wrong Build() (ExtensiblePayload, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_ExtensiblePayloadBuilder) setParent(contract PayloadContract) { b.PayloadContract = contract } -func (b *_ExtensiblePayloadBuilder) WithMandatoryFields(payload ExtensionObject) ExtensiblePayloadBuilder { +func (b *_ExtensiblePayloadBuilder) WithMandatoryFields(payload RootExtensionObject) ExtensiblePayloadBuilder { return b.WithPayload(payload) } -func (b *_ExtensiblePayloadBuilder) WithPayload(payload ExtensionObject) ExtensiblePayloadBuilder { +func (b *_ExtensiblePayloadBuilder) WithPayload(payload RootExtensionObject) ExtensiblePayloadBuilder { b.Payload = payload return b } -func (b *_ExtensiblePayloadBuilder) WithPayloadBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) ExtensiblePayloadBuilder { - builder := builderSupplier(b.Payload.CreateExtensionObjectBuilder()) +func (b *_ExtensiblePayloadBuilder) WithPayloadBuilder(builderSupplier func(RootExtensionObjectBuilder) RootExtensionObjectBuilder) ExtensiblePayloadBuilder { + builder := builderSupplier(b.Payload.CreateRootExtensionObjectBuilder()) var err error b.Payload, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + b.err.Append(errors.Wrap(err, "RootExtensionObjectBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_ExtensiblePayload) CreateExtensiblePayloadBuilder() ExtensiblePayloadB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ExtensiblePayload) GetExtensible() bool { - return bool(true) +func (m *_ExtensiblePayload) GetBinary() bool { + return bool(false) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_ExtensiblePayload) GetParent() PayloadContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ExtensiblePayload) GetPayload() ExtensionObject { +func (m *_ExtensiblePayload) GetPayload() RootExtensionObject { return m.Payload } @@ -242,7 +242,7 @@ func (m *_ExtensiblePayload) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ExtensiblePayload) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_Payload, extensible bool, byteCount uint32) (__extensiblePayload ExtensiblePayload, err error) { +func (m *_ExtensiblePayload) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_Payload, binary bool, byteCount uint32) (__extensiblePayload ExtensiblePayload, err error) { m.PayloadContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_ExtensiblePayload) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - payload, err := ReadSimpleField[ExtensionObject](ctx, "payload", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(false))), readBuffer)) + payload, err := ReadSimpleField[RootExtensionObject](ctx, "payload", ReadComplex[RootExtensionObject](ExtensionObjectParseWithBufferProducer[RootExtensionObject]((bool)(bool(false))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'payload' field")) } @@ -284,7 +284,7 @@ func (m *_ExtensiblePayload) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for ExtensiblePayload") } - if err := WriteSimpleField[ExtensionObject](ctx, "payload", m.GetPayload(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + if err := WriteSimpleField[RootExtensionObject](ctx, "payload", m.GetPayload(), WriteComplex[RootExtensionObject](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'payload' field") } @@ -308,7 +308,7 @@ func (m *_ExtensiblePayload) deepCopy() *_ExtensiblePayload { } _ExtensiblePayloadCopy := &_ExtensiblePayload{ m.PayloadContract.(*_Payload).deepCopy(), - m.Payload.DeepCopy().(ExtensionObject), + m.Payload.DeepCopy().(RootExtensionObject), } m.PayloadContract.(*_Payload)._SubType = m return _ExtensiblePayloadCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensionHeader.go b/plc4go/protocols/opcua/readwrite/model/ExtensionHeader.go deleted file mode 100644 index 9893f5ae1f5..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/ExtensionHeader.go +++ /dev/null @@ -1,320 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - . "github.com/apache/plc4x/plc4go/spi/codegen/fields" - . "github.com/apache/plc4x/plc4go/spi/codegen/io" - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// ExtensionHeader is the corresponding interface of ExtensionHeader -type ExtensionHeader interface { - fmt.Stringer - utils.LengthAware - utils.Serializable - utils.Copyable - // GetXmlbody returns Xmlbody (property field) - GetXmlbody() bool - // GetBinaryBody returns BinaryBody (property field) - GetBinaryBody() bool - // IsExtensionHeader is a marker method to prevent unintentional type checks (interfaces of same signature) - IsExtensionHeader() - // CreateBuilder creates a ExtensionHeaderBuilder - CreateExtensionHeaderBuilder() ExtensionHeaderBuilder -} - -// _ExtensionHeader is the data-structure of this message -type _ExtensionHeader struct { - Xmlbody bool - BinaryBody bool - // Reserved Fields - reservedField0 *int8 -} - -var _ ExtensionHeader = (*_ExtensionHeader)(nil) - -// NewExtensionHeader factory function for _ExtensionHeader -func NewExtensionHeader(xmlbody bool, binaryBody bool) *_ExtensionHeader { - return &_ExtensionHeader{Xmlbody: xmlbody, BinaryBody: binaryBody} -} - -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Builder -/////////////////////// - -// ExtensionHeaderBuilder is a builder for ExtensionHeader -type ExtensionHeaderBuilder interface { - utils.Copyable - // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(xmlbody bool, binaryBody bool) ExtensionHeaderBuilder - // WithXmlbody adds Xmlbody (property field) - WithXmlbody(bool) ExtensionHeaderBuilder - // WithBinaryBody adds BinaryBody (property field) - WithBinaryBody(bool) ExtensionHeaderBuilder - // Build builds the ExtensionHeader or returns an error if something is wrong - Build() (ExtensionHeader, error) - // MustBuild does the same as Build but panics on error - MustBuild() ExtensionHeader -} - -// NewExtensionHeaderBuilder() creates a ExtensionHeaderBuilder -func NewExtensionHeaderBuilder() ExtensionHeaderBuilder { - return &_ExtensionHeaderBuilder{_ExtensionHeader: new(_ExtensionHeader)} -} - -type _ExtensionHeaderBuilder struct { - *_ExtensionHeader - - err *utils.MultiError -} - -var _ (ExtensionHeaderBuilder) = (*_ExtensionHeaderBuilder)(nil) - -func (b *_ExtensionHeaderBuilder) WithMandatoryFields(xmlbody bool, binaryBody bool) ExtensionHeaderBuilder { - return b.WithXmlbody(xmlbody).WithBinaryBody(binaryBody) -} - -func (b *_ExtensionHeaderBuilder) WithXmlbody(xmlbody bool) ExtensionHeaderBuilder { - b.Xmlbody = xmlbody - return b -} - -func (b *_ExtensionHeaderBuilder) WithBinaryBody(binaryBody bool) ExtensionHeaderBuilder { - b.BinaryBody = binaryBody - return b -} - -func (b *_ExtensionHeaderBuilder) Build() (ExtensionHeader, error) { - if b.err != nil { - return nil, errors.Wrap(b.err, "error occurred during build") - } - return b._ExtensionHeader.deepCopy(), nil -} - -func (b *_ExtensionHeaderBuilder) MustBuild() ExtensionHeader { - build, err := b.Build() - if err != nil { - panic(err) - } - return build -} - -func (b *_ExtensionHeaderBuilder) DeepCopy() any { - _copy := b.CreateExtensionHeaderBuilder().(*_ExtensionHeaderBuilder) - if b.err != nil { - _copy.err = b.err.DeepCopy().(*utils.MultiError) - } - return _copy -} - -// CreateExtensionHeaderBuilder creates a ExtensionHeaderBuilder -func (b *_ExtensionHeader) CreateExtensionHeaderBuilder() ExtensionHeaderBuilder { - if b == nil { - return NewExtensionHeaderBuilder() - } - return &_ExtensionHeaderBuilder{_ExtensionHeader: b.deepCopy()} -} - -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Accessors for property fields. -/////////////////////// - -func (m *_ExtensionHeader) GetXmlbody() bool { - return m.Xmlbody -} - -func (m *_ExtensionHeader) GetBinaryBody() bool { - return m.BinaryBody -} - -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// - -// Deprecated: use the interface for direct cast -func CastExtensionHeader(structType any) ExtensionHeader { - if casted, ok := structType.(ExtensionHeader); ok { - return casted - } - if casted, ok := structType.(*ExtensionHeader); ok { - return *casted - } - return nil -} - -func (m *_ExtensionHeader) GetTypeName() string { - return "ExtensionHeader" -} - -func (m *_ExtensionHeader) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(0) - - // Reserved Field (reserved) - lengthInBits += 5 - - // Simple field (xmlbody) - lengthInBits += 1 - - // Simple field (binaryBody) - lengthInBits += 1 - - return lengthInBits -} - -func (m *_ExtensionHeader) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func ExtensionHeaderParse(ctx context.Context, theBytes []byte) (ExtensionHeader, error) { - return ExtensionHeaderParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func ExtensionHeaderParseWithBufferProducer() func(ctx context.Context, readBuffer utils.ReadBuffer) (ExtensionHeader, error) { - return func(ctx context.Context, readBuffer utils.ReadBuffer) (ExtensionHeader, error) { - return ExtensionHeaderParseWithBuffer(ctx, readBuffer) - } -} - -func ExtensionHeaderParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (ExtensionHeader, error) { - v, err := (&_ExtensionHeader{}).parse(ctx, readBuffer) - if err != nil { - return nil, err - } - return v, nil -} - -func (m *_ExtensionHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer) (__extensionHeader ExtensionHeader, err error) { - positionAware := readBuffer - _ = positionAware - if pullErr := readBuffer.PullContext("ExtensionHeader"); pullErr != nil { - return nil, errors.Wrap(pullErr, "Error pulling for ExtensionHeader") - } - currentPos := positionAware.GetPos() - _ = currentPos - - reservedField0, err := ReadReservedField(ctx, "reserved", ReadSignedByte(readBuffer, uint8(5)), int8(0x00)) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) - } - m.reservedField0 = reservedField0 - - xmlbody, err := ReadSimpleField(ctx, "xmlbody", ReadBoolean(readBuffer)) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'xmlbody' field")) - } - m.Xmlbody = xmlbody - - binaryBody, err := ReadSimpleField(ctx, "binaryBody", ReadBoolean(readBuffer)) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'binaryBody' field")) - } - m.BinaryBody = binaryBody - - if closeErr := readBuffer.CloseContext("ExtensionHeader"); closeErr != nil { - return nil, errors.Wrap(closeErr, "Error closing for ExtensionHeader") - } - - return m, nil -} - -func (m *_ExtensionHeader) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) - if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (m *_ExtensionHeader) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - positionAware := writeBuffer - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pushErr := writeBuffer.PushContext("ExtensionHeader"); pushErr != nil { - return errors.Wrap(pushErr, "Error pushing for ExtensionHeader") - } - - if err := WriteReservedField[int8](ctx, "reserved", int8(0x00), WriteSignedByte(writeBuffer, 5)); err != nil { - return errors.Wrap(err, "Error serializing 'reserved' field number 1") - } - - if err := WriteSimpleField[bool](ctx, "xmlbody", m.GetXmlbody(), WriteBoolean(writeBuffer)); err != nil { - return errors.Wrap(err, "Error serializing 'xmlbody' field") - } - - if err := WriteSimpleField[bool](ctx, "binaryBody", m.GetBinaryBody(), WriteBoolean(writeBuffer)); err != nil { - return errors.Wrap(err, "Error serializing 'binaryBody' field") - } - - if popErr := writeBuffer.PopContext("ExtensionHeader"); popErr != nil { - return errors.Wrap(popErr, "Error popping for ExtensionHeader") - } - return nil -} - -func (m *_ExtensionHeader) IsExtensionHeader() {} - -func (m *_ExtensionHeader) DeepCopy() any { - return m.deepCopy() -} - -func (m *_ExtensionHeader) deepCopy() *_ExtensionHeader { - if m == nil { - return nil - } - _ExtensionHeaderCopy := &_ExtensionHeader{ - m.Xmlbody, - m.BinaryBody, - m.reservedField0, - } - return _ExtensionHeaderCopy -} - -func (m *_ExtensionHeader) String() string { - if m == nil { - return "" - } - wb := utils.NewWriteBufferBoxBased( - utils.WithWriteBufferBoxBasedMergeSingleBoxes(), - utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), - utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), - ) - if err := wb.WriteSerializable(context.Background(), m); err != nil { - return err.Error() - } - return wb.GetBox().String() -} diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensionObject.go b/plc4go/protocols/opcua/readwrite/model/ExtensionObject.go index 856e1b2572f..b45265b53d5 100644 --- a/plc4go/protocols/opcua/readwrite/model/ExtensionObject.go +++ b/plc4go/protocols/opcua/readwrite/model/ExtensionObject.go @@ -35,45 +35,59 @@ import ( // ExtensionObject is the corresponding interface of ExtensionObject type ExtensionObject interface { + ExtensionObjectContract + ExtensionObjectRequirements fmt.Stringer utils.LengthAware utils.Serializable utils.Copyable + // IsExtensionObject is a marker method to prevent unintentional type checks (interfaces of same signature) + IsExtensionObject() + // CreateBuilder creates a ExtensionObjectBuilder + CreateExtensionObjectBuilder() ExtensionObjectBuilder +} + +// ExtensionObjectContract provides a set of functions which can be overwritten by a sub struct +type ExtensionObjectContract interface { // GetTypeId returns TypeId (property field) GetTypeId() ExpandedNodeId - // GetEncodingMask returns EncodingMask (property field) - GetEncodingMask() ExtensionObjectEncodingMask - // GetBody returns Body (property field) + // GetExtensionId returns ExtensionId (virtual field) + GetExtensionId() int32 + // GetBody returns Body (abstract field) GetBody() ExtensionObjectDefinition - // GetIdentifier returns Identifier (virtual field) - GetIdentifier() string // IsExtensionObject is a marker method to prevent unintentional type checks (interfaces of same signature) IsExtensionObject() // CreateBuilder creates a ExtensionObjectBuilder CreateExtensionObjectBuilder() ExtensionObjectBuilder } +// ExtensionObjectRequirements provides a set of functions which need to be implemented by a sub struct +type ExtensionObjectRequirements interface { + GetLengthInBits(ctx context.Context) uint16 + GetLengthInBytes(ctx context.Context) uint16 + // GetIncludeEncodingMask returns IncludeEncodingMask (discriminator field) + GetIncludeEncodingMask() bool + // GetBody returns Body (abstract field) + GetBody() ExtensionObjectDefinition +} + // _ExtensionObject is the data-structure of this message type _ExtensionObject struct { - TypeId ExpandedNodeId - EncodingMask ExtensionObjectEncodingMask - Body ExtensionObjectDefinition - - // Arguments. - IncludeEncodingMask bool + _SubType interface { + ExtensionObjectContract + ExtensionObjectRequirements + } + TypeId ExpandedNodeId } -var _ ExtensionObject = (*_ExtensionObject)(nil) +var _ ExtensionObjectContract = (*_ExtensionObject)(nil) // NewExtensionObject factory function for _ExtensionObject -func NewExtensionObject(typeId ExpandedNodeId, encodingMask ExtensionObjectEncodingMask, body ExtensionObjectDefinition, includeEncodingMask bool) *_ExtensionObject { +func NewExtensionObject(typeId ExpandedNodeId) *_ExtensionObject { if typeId == nil { panic("typeId of type ExpandedNodeId for ExtensionObject must not be nil") } - if body == nil { - panic("body of type ExtensionObjectDefinition for ExtensionObject must not be nil") - } - return &_ExtensionObject{TypeId: typeId, EncodingMask: encodingMask, Body: body, IncludeEncodingMask: includeEncodingMask} + return &_ExtensionObject{TypeId: typeId} } /////////////////////////////////////////////////////////// @@ -85,19 +99,25 @@ func NewExtensionObject(typeId ExpandedNodeId, encodingMask ExtensionObjectEncod type ExtensionObjectBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(typeId ExpandedNodeId, body ExtensionObjectDefinition) ExtensionObjectBuilder + WithMandatoryFields(typeId ExpandedNodeId) ExtensionObjectBuilder // WithTypeId adds TypeId (property field) WithTypeId(ExpandedNodeId) ExtensionObjectBuilder // WithTypeIdBuilder adds TypeId (property field) which is build by the builder WithTypeIdBuilder(func(ExpandedNodeIdBuilder) ExpandedNodeIdBuilder) ExtensionObjectBuilder - // WithEncodingMask adds EncodingMask (property field) - WithOptionalEncodingMask(ExtensionObjectEncodingMask) ExtensionObjectBuilder - // WithOptionalEncodingMaskBuilder adds EncodingMask (property field) which is build by the builder - WithOptionalEncodingMaskBuilder(func(ExtensionObjectEncodingMaskBuilder) ExtensionObjectEncodingMaskBuilder) ExtensionObjectBuilder - // WithBody adds Body (property field) - WithBody(ExtensionObjectDefinition) ExtensionObjectBuilder - // WithBodyBuilder adds Body (property field) which is build by the builder - WithBodyBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ExtensionObjectBuilder + // AsRootExtensionObject converts this build to a subType of ExtensionObject. It is always possible to return to current builder using Done() + AsRootExtensionObject() interface { + RootExtensionObjectBuilder + Done() ExtensionObjectBuilder + } + // AsExtensionObjectWithMask converts this build to a subType of ExtensionObject. It is always possible to return to current builder using Done() + AsExtensionObjectWithMask() interface { + ExtensionObjectWithMaskBuilder + Done() ExtensionObjectBuilder + } + // Build builds the ExtensionObject or returns an error if something is wrong + PartialBuild() (ExtensionObjectContract, error) + // MustBuild does the same as Build but panics on error + PartialMustBuild() ExtensionObjectContract // Build builds the ExtensionObject or returns an error if something is wrong Build() (ExtensionObject, error) // MustBuild does the same as Build but panics on error @@ -109,16 +129,24 @@ func NewExtensionObjectBuilder() ExtensionObjectBuilder { return &_ExtensionObjectBuilder{_ExtensionObject: new(_ExtensionObject)} } +type _ExtensionObjectChildBuilder interface { + utils.Copyable + setParent(ExtensionObjectContract) + buildForExtensionObject() (ExtensionObject, error) +} + type _ExtensionObjectBuilder struct { *_ExtensionObject + childBuilder _ExtensionObjectChildBuilder + err *utils.MultiError } var _ (ExtensionObjectBuilder) = (*_ExtensionObjectBuilder)(nil) -func (b *_ExtensionObjectBuilder) WithMandatoryFields(typeId ExpandedNodeId, body ExtensionObjectDefinition) ExtensionObjectBuilder { - return b.WithTypeId(typeId).WithBody(body) +func (b *_ExtensionObjectBuilder) WithMandatoryFields(typeId ExpandedNodeId) ExtensionObjectBuilder { + return b.WithTypeId(typeId) } func (b *_ExtensionObjectBuilder) WithTypeId(typeId ExpandedNodeId) ExtensionObjectBuilder { @@ -139,59 +167,69 @@ func (b *_ExtensionObjectBuilder) WithTypeIdBuilder(builderSupplier func(Expande return b } -func (b *_ExtensionObjectBuilder) WithOptionalEncodingMask(encodingMask ExtensionObjectEncodingMask) ExtensionObjectBuilder { - b.EncodingMask = encodingMask - return b +func (b *_ExtensionObjectBuilder) PartialBuild() (ExtensionObjectContract, error) { + if b.TypeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'typeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ExtensionObject.deepCopy(), nil } -func (b *_ExtensionObjectBuilder) WithOptionalEncodingMaskBuilder(builderSupplier func(ExtensionObjectEncodingMaskBuilder) ExtensionObjectEncodingMaskBuilder) ExtensionObjectBuilder { - builder := builderSupplier(b.EncodingMask.CreateExtensionObjectEncodingMaskBuilder()) - var err error - b.EncodingMask, err = builder.Build() +func (b *_ExtensionObjectBuilder) PartialMustBuild() ExtensionObjectContract { + build, err := b.PartialBuild() if err != nil { - if b.err == nil { - b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} - } - b.err.Append(errors.Wrap(err, "ExtensionObjectEncodingMaskBuilder failed")) + panic(err) } - return b + return build } -func (b *_ExtensionObjectBuilder) WithBody(body ExtensionObjectDefinition) ExtensionObjectBuilder { - b.Body = body - return b +func (b *_ExtensionObjectBuilder) AsRootExtensionObject() interface { + RootExtensionObjectBuilder + Done() ExtensionObjectBuilder +} { + if cb, ok := b.childBuilder.(interface { + RootExtensionObjectBuilder + Done() ExtensionObjectBuilder + }); ok { + return cb + } + cb := NewRootExtensionObjectBuilder().(*_RootExtensionObjectBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb } -func (b *_ExtensionObjectBuilder) WithBodyBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ExtensionObjectBuilder { - builder := builderSupplier(b.Body.CreateExtensionObjectDefinitionBuilder()) - var err error - b.Body, err = builder.Build() - if err != nil { - if b.err == nil { - b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} - } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) +func (b *_ExtensionObjectBuilder) AsExtensionObjectWithMask() interface { + ExtensionObjectWithMaskBuilder + Done() ExtensionObjectBuilder +} { + if cb, ok := b.childBuilder.(interface { + ExtensionObjectWithMaskBuilder + Done() ExtensionObjectBuilder + }); ok { + return cb } - return b + cb := NewExtensionObjectWithMaskBuilder().(*_ExtensionObjectWithMaskBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb } func (b *_ExtensionObjectBuilder) Build() (ExtensionObject, error) { - if b.TypeId == nil { - if b.err == nil { - b.err = new(utils.MultiError) - } - b.err.Append(errors.New("mandatory field 'typeId' not set")) - } - if b.Body == nil { - if b.err == nil { - b.err = new(utils.MultiError) - } - b.err.Append(errors.New("mandatory field 'body' not set")) + v, err := b.PartialBuild() + if err != nil { + return nil, errors.Wrap(err, "error occurred during partial build") } - if b.err != nil { - return nil, errors.Wrap(b.err, "error occurred during build") + if b.childBuilder == nil { + return nil, errors.New("no child builder present") } - return b._ExtensionObject.deepCopy(), nil + b.childBuilder.setParent(v) + return b.childBuilder.buildForExtensionObject() } func (b *_ExtensionObjectBuilder) MustBuild() ExtensionObject { @@ -204,6 +242,8 @@ func (b *_ExtensionObjectBuilder) MustBuild() ExtensionObject { func (b *_ExtensionObjectBuilder) DeepCopy() any { _copy := b.CreateExtensionObjectBuilder().(*_ExtensionObjectBuilder) + _copy.childBuilder = b.childBuilder.DeepCopy().(_ExtensionObjectChildBuilder) + _copy.childBuilder.setParent(_copy) if b.err != nil { _copy.err = b.err.DeepCopy().(*utils.MultiError) } @@ -232,14 +272,6 @@ func (m *_ExtensionObject) GetTypeId() ExpandedNodeId { return m.TypeId } -func (m *_ExtensionObject) GetEncodingMask() ExtensionObjectEncodingMask { - return m.EncodingMask -} - -func (m *_ExtensionObject) GetBody() ExtensionObjectDefinition { - return m.Body -} - /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -249,12 +281,24 @@ func (m *_ExtensionObject) GetBody() ExtensionObjectDefinition { /////////////////////// Accessors for virtual fields. /////////////////////// -func (m *_ExtensionObject) GetIdentifier() string { +func (pm *_ExtensionObject) GetExtensionId() int32 { + m := pm._SubType ctx := context.Background() _ = ctx - encodingMask := m.GetEncodingMask() - _ = encodingMask - return fmt.Sprintf("%v", m.GetTypeId().GetIdentifier()) + return int32(utils.InlineIf(bool((m.GetTypeId()) == (nil)), func() any { return int32(int32(0)) }, func() any { return int32(ExtensionId(ctx, m.GetTypeId())) }).(int32)) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for abstract fields. +/////////////////////// + +func (m *_ExtensionObject) GetBody() ExtensionObjectDefinition { + return m._SubType.GetBody() } /////////////////////// @@ -277,45 +321,52 @@ func (m *_ExtensionObject) GetTypeName() string { return "ExtensionObject" } -func (m *_ExtensionObject) GetLengthInBits(ctx context.Context) uint16 { +func (m *_ExtensionObject) getLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(0) // Simple field (typeId) lengthInBits += m.TypeId.GetLengthInBits(ctx) - // Optional Field (encodingMask) - if m.EncodingMask != nil { - lengthInBits += m.EncodingMask.GetLengthInBits(ctx) - } - // A virtual field doesn't have any in- or output. - // Simple field (body) - lengthInBits += m.Body.GetLengthInBits(ctx) - return lengthInBits } +func (m *_ExtensionObject) GetLengthInBits(ctx context.Context) uint16 { + return m._SubType.GetLengthInBits(ctx) +} + func (m *_ExtensionObject) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 + return m._SubType.GetLengthInBits(ctx) / 8 } -func ExtensionObjectParse(ctx context.Context, theBytes []byte, includeEncodingMask bool) (ExtensionObject, error) { - return ExtensionObjectParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes), includeEncodingMask) +func ExtensionObjectParse[T ExtensionObject](ctx context.Context, theBytes []byte, includeEncodingMask bool) (T, error) { + return ExtensionObjectParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), includeEncodingMask) } -func ExtensionObjectParseWithBufferProducer(includeEncodingMask bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (ExtensionObject, error) { - return func(ctx context.Context, readBuffer utils.ReadBuffer) (ExtensionObject, error) { - return ExtensionObjectParseWithBuffer(ctx, readBuffer, includeEncodingMask) +func ExtensionObjectParseWithBufferProducer[T ExtensionObject](includeEncodingMask bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { + return func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { + v, err := ExtensionObjectParseWithBuffer[T](ctx, readBuffer, includeEncodingMask) + if err != nil { + var zero T + return zero, err + } + return v, nil } } -func ExtensionObjectParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer, includeEncodingMask bool) (ExtensionObject, error) { - v, err := (&_ExtensionObject{IncludeEncodingMask: includeEncodingMask}).parse(ctx, readBuffer, includeEncodingMask) +func ExtensionObjectParseWithBuffer[T ExtensionObject](ctx context.Context, readBuffer utils.ReadBuffer, includeEncodingMask bool) (T, error) { + v, err := (&_ExtensionObject{}).parse(ctx, readBuffer, includeEncodingMask) if err != nil { - return nil, err + var zero T + return zero, err } - return v, nil + vc, ok := v.(T) + if !ok { + var zero T + return zero, errors.Errorf("Unexpected type %T. Expected type %T", v, *new(T)) + } + return vc, nil } func (m *_ExtensionObject) parse(ctx context.Context, readBuffer utils.ReadBuffer, includeEncodingMask bool) (__extensionObject ExtensionObject, err error) { @@ -333,44 +384,38 @@ func (m *_ExtensionObject) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.TypeId = typeId - var encodingMask ExtensionObjectEncodingMask - _encodingMask, err := ReadOptionalField[ExtensionObjectEncodingMask](ctx, "encodingMask", ReadComplex[ExtensionObjectEncodingMask](ExtensionObjectEncodingMaskParseWithBuffer, readBuffer), includeEncodingMask) + extensionId, err := ReadVirtualField[int32](ctx, "extensionId", (*int32)(nil), utils.InlineIf(bool((typeId) == (nil)), func() any { return int32(int32(0)) }, func() any { return int32(ExtensionId(ctx, typeId)) }).(int32)) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'encodingMask' field")) - } - if _encodingMask != nil { - encodingMask = *_encodingMask - m.EncodingMask = encodingMask + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'extensionId' field")) } + _ = extensionId - identifier, err := ReadVirtualField[string](ctx, "identifier", (*string)(nil), typeId.GetIdentifier()) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'identifier' field")) - } - _ = identifier - - body, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "body", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)(identifier)), readBuffer)) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'body' field")) + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + var _child ExtensionObject + switch { + case includeEncodingMask == bool(false): // RootExtensionObject + if _child, err = new(_RootExtensionObject).parse(ctx, readBuffer, m, extensionId, includeEncodingMask); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type RootExtensionObject for type-switch of ExtensionObject") + } + case includeEncodingMask == bool(true): // ExtensionObjectWithMask + if _child, err = new(_ExtensionObjectWithMask).parse(ctx, readBuffer, m, extensionId, includeEncodingMask); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ExtensionObjectWithMask for type-switch of ExtensionObject") + } + default: + return nil, errors.Errorf("Unmapped type for parameters [includeEncodingMask=%v]", includeEncodingMask) } - m.Body = body if closeErr := readBuffer.CloseContext("ExtensionObject"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for ExtensionObject") } - return m, nil -} - -func (m *_ExtensionObject) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) - if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil + return _child, nil } -func (m *_ExtensionObject) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { +func (pm *_ExtensionObject) serializeParent(ctx context.Context, writeBuffer utils.WriteBuffer, child ExtensionObject, serializeChildFunction func() error) error { + // We redirect all calls through client as some methods are only implemented there + m := child + _ = m positionAware := writeBuffer _ = positionAware log := zerolog.Ctx(ctx) @@ -382,19 +427,16 @@ func (m *_ExtensionObject) SerializeWithWriteBuffer(ctx context.Context, writeBu if err := WriteSimpleField[ExpandedNodeId](ctx, "typeId", m.GetTypeId(), WriteComplex[ExpandedNodeId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'typeId' field") } - - if err := WriteOptionalField[ExtensionObjectEncodingMask](ctx, "encodingMask", GetRef(m.GetEncodingMask()), WriteComplex[ExtensionObjectEncodingMask](writeBuffer), true); err != nil { - return errors.Wrap(err, "Error serializing 'encodingMask' field") - } // Virtual field - identifier := m.GetIdentifier() - _ = identifier - if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { - return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") + extensionId := m.GetExtensionId() + _ = extensionId + if _extensionIdErr := writeBuffer.WriteVirtual(ctx, "extensionId", m.GetExtensionId()); _extensionIdErr != nil { + return errors.Wrap(_extensionIdErr, "Error serializing 'extensionId' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "body", m.GetBody(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { - return errors.Wrap(err, "Error serializing 'body' field") + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") } if popErr := writeBuffer.PopContext("ExtensionObject"); popErr != nil { @@ -403,16 +445,6 @@ func (m *_ExtensionObject) SerializeWithWriteBuffer(ctx context.Context, writeBu return nil } -//// -// Arguments Getter - -func (m *_ExtensionObject) GetIncludeEncodingMask() bool { - return m.IncludeEncodingMask -} - -// -//// - func (m *_ExtensionObject) IsExtensionObject() {} func (m *_ExtensionObject) DeepCopy() any { @@ -424,25 +456,8 @@ func (m *_ExtensionObject) deepCopy() *_ExtensionObject { return nil } _ExtensionObjectCopy := &_ExtensionObject{ + nil, // will be set by child m.TypeId.DeepCopy().(ExpandedNodeId), - m.EncodingMask.DeepCopy().(ExtensionObjectEncodingMask), - m.Body.DeepCopy().(ExtensionObjectDefinition), - m.IncludeEncodingMask, } return _ExtensionObjectCopy } - -func (m *_ExtensionObject) String() string { - if m == nil { - return "" - } - wb := utils.NewWriteBufferBoxBased( - utils.WithWriteBufferBoxBasedMergeSingleBoxes(), - utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), - utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), - ) - if err := wb.WriteSerializable(context.Background(), m); err != nil { - return err.Error() - } - return wb.GetBox().String() -} diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensionObjectDefinition.go b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectDefinition.go index 70d7bf4b9cf..ae3131d38da 100644 --- a/plc4go/protocols/opcua/readwrite/model/ExtensionObjectDefinition.go +++ b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectDefinition.go @@ -57,8 +57,8 @@ type ExtensionObjectDefinitionContract interface { type ExtensionObjectDefinitionRequirements interface { GetLengthInBits(ctx context.Context) uint16 GetLengthInBytes(ctx context.Context) uint16 - // GetIdentifier returns Identifier (discriminator field) - GetIdentifier() string + // GetExtensionId returns ExtensionId (discriminator field) + GetExtensionId() int32 } // _ExtensionObjectDefinition is the data-structure of this message @@ -191,16 +191,46 @@ type ExtensionObjectDefinitionBuilder interface { DataTypeDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } + // AsStructureDescription converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsStructureDescription() interface { + StructureDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsEnumDescription converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEnumDescription() interface { + EnumDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsSimpleTypeDescription converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsSimpleTypeDescription() interface { + SimpleTypeDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUABinaryFileDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUABinaryFileDataType() interface { + UABinaryFileDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsPortableQualifiedName converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsPortableQualifiedName() interface { PortableQualifiedNameBuilder Done() ExtensionObjectDefinitionBuilder } + // AsPortableNodeId converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPortableNodeId() interface { + PortableNodeIdBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsUnsignedRationalNumber converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsUnsignedRationalNumber() interface { UnsignedRationalNumberBuilder Done() ExtensionObjectDefinitionBuilder } + // AsDataSetMetaDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDataSetMetaDataType() interface { + DataSetMetaDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsFieldMetaData converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsFieldMetaData() interface { FieldMetaDataBuilder @@ -211,6 +241,11 @@ type ExtensionObjectDefinitionBuilder interface { ConfigurationVersionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsPublishedDataSetDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPublishedDataSetDataType() interface { + PublishedDataSetDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsPublishedDataSetSourceDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsPublishedDataSetSourceDataType() interface { PublishedDataSetSourceDataTypeBuilder @@ -221,6 +256,21 @@ type ExtensionObjectDefinitionBuilder interface { PublishedVariableDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsPublishedDataItemsDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPublishedDataItemsDataType() interface { + PublishedDataItemsDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsPublishedEventsDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPublishedEventsDataType() interface { + PublishedEventsDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsPublishedDataSetCustomSourceDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPublishedDataSetCustomSourceDataType() interface { + PublishedDataSetCustomSourceDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsDataSetWriterDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsDataSetWriterDataType() interface { DataSetWriterDataTypeBuilder @@ -241,6 +291,11 @@ type ExtensionObjectDefinitionBuilder interface { PubSubGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsWriterGroupDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsWriterGroupDataType() interface { + WriterGroupDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsWriterGroupTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsWriterGroupTransportDataType() interface { WriterGroupTransportDataTypeBuilder @@ -266,6 +321,16 @@ type ExtensionObjectDefinitionBuilder interface { NetworkAddressDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsNetworkAddressUrlDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsNetworkAddressUrlDataType() interface { + NetworkAddressUrlDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReaderGroupDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReaderGroupDataType() interface { + ReaderGroupDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsReaderGroupTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsReaderGroupTransportDataType() interface { ReaderGroupTransportDataTypeBuilder @@ -276,6 +341,11 @@ type ExtensionObjectDefinitionBuilder interface { ReaderGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsDataSetReaderDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDataSetReaderDataType() interface { + DataSetReaderDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsDataSetReaderTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsDataSetReaderTransportDataType() interface { DataSetReaderTransportDataTypeBuilder @@ -291,16 +361,36 @@ type ExtensionObjectDefinitionBuilder interface { SubscribedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsTargetVariablesDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsTargetVariablesDataType() interface { + TargetVariablesDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsFieldTargetDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsFieldTargetDataType() interface { FieldTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsSubscribedDataSetMirrorDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsSubscribedDataSetMirrorDataType() interface { + SubscribedDataSetMirrorDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsPubSubConfigurationDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsPubSubConfigurationDataType() interface { PubSubConfigurationDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsStandaloneSubscribedDataSetRefDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsStandaloneSubscribedDataSetRefDataType() interface { + StandaloneSubscribedDataSetRefDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsStandaloneSubscribedDataSetDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsStandaloneSubscribedDataSetDataType() interface { + StandaloneSubscribedDataSetDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsSecurityGroupDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsSecurityGroupDataType() interface { SecurityGroupDataTypeBuilder @@ -311,16 +401,121 @@ type ExtensionObjectDefinitionBuilder interface { PubSubKeyPushTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsPubSubConfiguration2DataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPubSubConfiguration2DataType() interface { + PubSubConfiguration2DataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUadpWriterGroupMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUadpWriterGroupMessageDataType() interface { + UadpWriterGroupMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUadpDataSetWriterMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUadpDataSetWriterMessageDataType() interface { + UadpDataSetWriterMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUadpDataSetReaderMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUadpDataSetReaderMessageDataType() interface { + UadpDataSetReaderMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsJsonWriterGroupMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsJsonWriterGroupMessageDataType() interface { + JsonWriterGroupMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsJsonDataSetWriterMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsJsonDataSetWriterMessageDataType() interface { + JsonDataSetWriterMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsJsonDataSetReaderMessageDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsJsonDataSetReaderMessageDataType() interface { + JsonDataSetReaderMessageDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsQosDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsQosDataType() interface { QosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsTransmitQosDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsTransmitQosDataType() interface { + TransmitQosDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsTransmitQosPriorityDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsTransmitQosPriorityDataType() interface { + TransmitQosPriorityDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReceiveQosDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReceiveQosDataType() interface { + ReceiveQosDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReceiveQosPriorityDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReceiveQosPriorityDataType() interface { + ReceiveQosPriorityDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDatagramConnectionTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDatagramConnectionTransportDataType() interface { + DatagramConnectionTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDatagramConnectionTransport2DataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDatagramConnectionTransport2DataType() interface { + DatagramConnectionTransport2DataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDatagramWriterGroupTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDatagramWriterGroupTransportDataType() interface { + DatagramWriterGroupTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDatagramWriterGroupTransport2DataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDatagramWriterGroupTransport2DataType() interface { + DatagramWriterGroupTransport2DataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDatagramDataSetReaderTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDatagramDataSetReaderTransportDataType() interface { + DatagramDataSetReaderTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsBrokerConnectionTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsBrokerConnectionTransportDataType() interface { + BrokerConnectionTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsBrokerWriterGroupTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsBrokerWriterGroupTransportDataType() interface { + BrokerWriterGroupTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsBrokerDataSetWriterTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsBrokerDataSetWriterTransportDataType() interface { + BrokerDataSetWriterTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsBrokerDataSetReaderTransportDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsBrokerDataSetReaderTransportDataType() interface { + BrokerDataSetReaderTransportDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsPubSubConfigurationRefDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsPubSubConfigurationRefDataType() interface { PubSubConfigurationRefDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsPubSubConfigurationValueDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsPubSubConfigurationValueDataType() interface { + PubSubConfigurationValueDataTypeBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsAliasNameDataType converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsAliasNameDataType() interface { AliasNameDataTypeBuilder @@ -361,6 +556,16 @@ type ExtensionObjectDefinitionBuilder interface { StructureFieldBuilder Done() ExtensionObjectDefinitionBuilder } + // AsStructureDefinition converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsStructureDefinition() interface { + StructureDefinitionBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsEnumDefinition converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEnumDefinition() interface { + EnumDefinitionBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsArgument converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsArgument() interface { ArgumentBuilder @@ -371,6 +576,11 @@ type ExtensionObjectDefinitionBuilder interface { EnumValueTypeBuilder Done() ExtensionObjectDefinitionBuilder } + // AsEnumField converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEnumField() interface { + EnumFieldBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsOptionSet converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsOptionSet() interface { OptionSetBuilder @@ -476,6 +686,11 @@ type ExtensionObjectDefinitionBuilder interface { DiscoveryConfigurationBuilder Done() ExtensionObjectDefinitionBuilder } + // AsMdnsDiscoveryConfiguration converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsMdnsDiscoveryConfiguration() interface { + MdnsDiscoveryConfigurationBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsRegisterServer2Request converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsRegisterServer2Request() interface { RegisterServer2RequestBuilder @@ -531,6 +746,31 @@ type ExtensionObjectDefinitionBuilder interface { CreateSessionResponseBuilder Done() ExtensionObjectDefinitionBuilder } + // AsUserIdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUserIdentityToken() interface { + UserIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsAnonymousIdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsAnonymousIdentityToken() interface { + AnonymousIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUserNameIdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUserNameIdentityToken() interface { + UserNameIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsX509IdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsX509IdentityToken() interface { + X509IdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsIssuedIdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsIssuedIdentityToken() interface { + IssuedIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsActivateSessionRequest converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsActivateSessionRequest() interface { ActivateSessionRequestBuilder @@ -566,11 +806,56 @@ type ExtensionObjectDefinitionBuilder interface { NodeAttributesBuilder Done() ExtensionObjectDefinitionBuilder } + // AsObjectAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsObjectAttributes() interface { + ObjectAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsVariableAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsVariableAttributes() interface { + VariableAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsMethodAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsMethodAttributes() interface { + MethodAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsObjectTypeAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsObjectTypeAttributes() interface { + ObjectTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsVariableTypeAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsVariableTypeAttributes() interface { + VariableTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReferenceTypeAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReferenceTypeAttributes() interface { + ReferenceTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDataTypeAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDataTypeAttributes() interface { + DataTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsViewAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsViewAttributes() interface { + ViewAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsGenericAttributeValue converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsGenericAttributeValue() interface { GenericAttributeValueBuilder Done() ExtensionObjectDefinitionBuilder } + // AsGenericAttributes converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsGenericAttributes() interface { + GenericAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsAddNodesItem converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsAddNodesItem() interface { AddNodesItemBuilder @@ -771,6 +1056,26 @@ type ExtensionObjectDefinitionBuilder interface { FilterOperandBuilder Done() ExtensionObjectDefinitionBuilder } + // AsElementOperand converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsElementOperand() interface { + ElementOperandBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsLiteralOperand converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsLiteralOperand() interface { + LiteralOperandBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsAttributeOperand converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsAttributeOperand() interface { + AttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsSimpleAttributeOperand converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsSimpleAttributeOperand() interface { + SimpleAttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsContentFilterElementResult converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsContentFilterElementResult() interface { ContentFilterElementResultBuilder @@ -836,6 +1141,36 @@ type ExtensionObjectDefinitionBuilder interface { HistoryReadDetailsBuilder Done() ExtensionObjectDefinitionBuilder } + // AsReadEventDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadEventDetails() interface { + ReadEventDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReadEventDetails2 converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadEventDetails2() interface { + ReadEventDetails2Builder + Done() ExtensionObjectDefinitionBuilder + } + // AsReadRawModifiedDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadRawModifiedDetails() interface { + ReadRawModifiedDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReadProcessedDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadProcessedDetails() interface { + ReadProcessedDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReadAtTimeDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadAtTimeDetails() interface { + ReadAtTimeDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsReadAnnotationDataDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsReadAnnotationDataDetails() interface { + ReadAnnotationDataDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsHistoryData converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsHistoryData() interface { HistoryDataBuilder @@ -846,11 +1181,21 @@ type ExtensionObjectDefinitionBuilder interface { ModificationInfoBuilder Done() ExtensionObjectDefinitionBuilder } + // AsHistoryModifiedData converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsHistoryModifiedData() interface { + HistoryModifiedDataBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsHistoryEvent converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsHistoryEvent() interface { HistoryEventBuilder Done() ExtensionObjectDefinitionBuilder } + // AsHistoryModifiedEvent converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsHistoryModifiedEvent() interface { + HistoryModifiedEventBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsHistoryReadRequest converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsHistoryReadRequest() interface { HistoryReadRequestBuilder @@ -881,6 +1226,36 @@ type ExtensionObjectDefinitionBuilder interface { HistoryUpdateDetailsBuilder Done() ExtensionObjectDefinitionBuilder } + // AsUpdateDataDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUpdateDataDetails() interface { + UpdateDataDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUpdateStructureDataDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUpdateStructureDataDetails() interface { + UpdateStructureDataDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsUpdateEventDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsUpdateEventDetails() interface { + UpdateEventDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDeleteRawModifiedDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDeleteRawModifiedDetails() interface { + DeleteRawModifiedDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDeleteAtTimeDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDeleteAtTimeDetails() interface { + DeleteAtTimeDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsDeleteEventDetails converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDeleteEventDetails() interface { + DeleteEventDetailsBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsHistoryUpdateResult converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsHistoryUpdateResult() interface { HistoryUpdateResultBuilder @@ -921,16 +1296,41 @@ type ExtensionObjectDefinitionBuilder interface { MonitoringFilterBuilder Done() ExtensionObjectDefinitionBuilder } + // AsDataChangeFilter converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDataChangeFilter() interface { + DataChangeFilterBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsEventFilter converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEventFilter() interface { + EventFilterBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsAggregateConfiguration converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsAggregateConfiguration() interface { AggregateConfigurationBuilder Done() ExtensionObjectDefinitionBuilder } + // AsAggregateFilter converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsAggregateFilter() interface { + AggregateFilterBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsMonitoringFilterResult converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsMonitoringFilterResult() interface { MonitoringFilterResultBuilder Done() ExtensionObjectDefinitionBuilder } + // AsEventFilterResult converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEventFilterResult() interface { + EventFilterResultBuilder + Done() ExtensionObjectDefinitionBuilder + } + // AsAggregateFilterResult converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsAggregateFilterResult() interface { + AggregateFilterResultBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsMonitoringParameters converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsMonitoringParameters() interface { MonitoringParametersBuilder @@ -1046,11 +1446,21 @@ type ExtensionObjectDefinitionBuilder interface { NotificationDataBuilder Done() ExtensionObjectDefinitionBuilder } + // AsDataChangeNotification converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsDataChangeNotification() interface { + DataChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsMonitoredItemNotification converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsMonitoredItemNotification() interface { MonitoredItemNotificationBuilder Done() ExtensionObjectDefinitionBuilder } + // AsEventNotificationList converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsEventNotificationList() interface { + EventNotificationListBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsEventFieldList converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsEventFieldList() interface { EventFieldListBuilder @@ -1061,6 +1471,11 @@ type ExtensionObjectDefinitionBuilder interface { HistoryEventFieldListBuilder Done() ExtensionObjectDefinitionBuilder } + // AsStatusChangeNotification converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() + AsStatusChangeNotification() interface { + StatusChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder + } // AsSubscriptionAcknowledgement converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() AsSubscriptionAcknowledgement() interface { SubscriptionAcknowledgementBuilder @@ -1226,26 +1641,6 @@ type ExtensionObjectDefinitionBuilder interface { AnnotationBuilder Done() ExtensionObjectDefinitionBuilder } - // AsDataChangeNotification converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() - AsDataChangeNotification() interface { - DataChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder - } - // AsEventNotificationList converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() - AsEventNotificationList() interface { - EventNotificationListBuilder - Done() ExtensionObjectDefinitionBuilder - } - // AsStatusChangeNotification converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() - AsStatusChangeNotification() interface { - StatusChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder - } - // AsUserIdentityToken converts this build to a subType of ExtensionObjectDefinition. It is always possible to return to current builder using Done() - AsUserIdentityToken() interface { - UserIdentityTokenBuilder - Done() ExtensionObjectDefinitionBuilder - } // Build builds the ExtensionObjectDefinition or returns an error if something is wrong PartialBuild() (ExtensionObjectDefinitionContract, error) // MustBuild does the same as Build but panics on error @@ -1632,2369 +2027,3649 @@ func (b *_ExtensionObjectDefinitionBuilder) AsDataTypeDescription() interface { return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPortableQualifiedName() interface { - PortableQualifiedNameBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsStructureDescription() interface { + StructureDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PortableQualifiedNameBuilder + StructureDescriptionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPortableQualifiedNameBuilder().(*_PortableQualifiedNameBuilder) + cb := NewStructureDescriptionBuilder().(*_StructureDescriptionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsUnsignedRationalNumber() interface { - UnsignedRationalNumberBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEnumDescription() interface { + EnumDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - UnsignedRationalNumberBuilder + EnumDescriptionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewUnsignedRationalNumberBuilder().(*_UnsignedRationalNumberBuilder) + cb := NewEnumDescriptionBuilder().(*_EnumDescriptionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFieldMetaData() interface { - FieldMetaDataBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSimpleTypeDescription() interface { + SimpleTypeDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FieldMetaDataBuilder + SimpleTypeDescriptionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFieldMetaDataBuilder().(*_FieldMetaDataBuilder) + cb := NewSimpleTypeDescriptionBuilder().(*_SimpleTypeDescriptionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsConfigurationVersionDataType() interface { - ConfigurationVersionDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUABinaryFileDataType() interface { + UABinaryFileDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ConfigurationVersionDataTypeBuilder + UABinaryFileDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewConfigurationVersionDataTypeBuilder().(*_ConfigurationVersionDataTypeBuilder) + cb := NewUABinaryFileDataTypeBuilder().(*_UABinaryFileDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPublishedDataSetSourceDataType() interface { - PublishedDataSetSourceDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPortableQualifiedName() interface { + PortableQualifiedNameBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PublishedDataSetSourceDataTypeBuilder + PortableQualifiedNameBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPublishedDataSetSourceDataTypeBuilder().(*_PublishedDataSetSourceDataTypeBuilder) + cb := NewPortableQualifiedNameBuilder().(*_PortableQualifiedNameBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPublishedVariableDataType() interface { - PublishedVariableDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPortableNodeId() interface { + PortableNodeIdBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PublishedVariableDataTypeBuilder + PortableNodeIdBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPublishedVariableDataTypeBuilder().(*_PublishedVariableDataTypeBuilder) + cb := NewPortableNodeIdBuilder().(*_PortableNodeIdBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterDataType() interface { - DataSetWriterDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUnsignedRationalNumber() interface { + UnsignedRationalNumberBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataSetWriterDataTypeBuilder + UnsignedRationalNumberBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataSetWriterDataTypeBuilder().(*_DataSetWriterDataTypeBuilder) + cb := NewUnsignedRationalNumberBuilder().(*_UnsignedRationalNumberBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterTransportDataType() interface { - DataSetWriterTransportDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetMetaDataType() interface { + DataSetMetaDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataSetWriterTransportDataTypeBuilder + DataSetMetaDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataSetWriterTransportDataTypeBuilder().(*_DataSetWriterTransportDataTypeBuilder) + cb := NewDataSetMetaDataTypeBuilder().(*_DataSetMetaDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterMessageDataType() interface { - DataSetWriterMessageDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFieldMetaData() interface { + FieldMetaDataBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataSetWriterMessageDataTypeBuilder + FieldMetaDataBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataSetWriterMessageDataTypeBuilder().(*_DataSetWriterMessageDataTypeBuilder) + cb := NewFieldMetaDataBuilder().(*_FieldMetaDataBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPubSubGroupDataType() interface { - PubSubGroupDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsConfigurationVersionDataType() interface { + ConfigurationVersionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PubSubGroupDataTypeBuilder + ConfigurationVersionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPubSubGroupDataTypeBuilder().(*_PubSubGroupDataTypeBuilder) + cb := NewConfigurationVersionDataTypeBuilder().(*_ConfigurationVersionDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsWriterGroupTransportDataType() interface { - WriterGroupTransportDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedDataSetDataType() interface { + PublishedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - WriterGroupTransportDataTypeBuilder + PublishedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewWriterGroupTransportDataTypeBuilder().(*_WriterGroupTransportDataTypeBuilder) + cb := NewPublishedDataSetDataTypeBuilder().(*_PublishedDataSetDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsWriterGroupMessageDataType() interface { - WriterGroupMessageDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedDataSetSourceDataType() interface { + PublishedDataSetSourceDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - WriterGroupMessageDataTypeBuilder + PublishedDataSetSourceDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewWriterGroupMessageDataTypeBuilder().(*_WriterGroupMessageDataTypeBuilder) + cb := NewPublishedDataSetSourceDataTypeBuilder().(*_PublishedDataSetSourceDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConnectionDataType() interface { - PubSubConnectionDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedVariableDataType() interface { + PublishedVariableDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PubSubConnectionDataTypeBuilder + PublishedVariableDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPubSubConnectionDataTypeBuilder().(*_PubSubConnectionDataTypeBuilder) + cb := NewPublishedVariableDataTypeBuilder().(*_PublishedVariableDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsConnectionTransportDataType() interface { - ConnectionTransportDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedDataItemsDataType() interface { + PublishedDataItemsDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ConnectionTransportDataTypeBuilder + PublishedDataItemsDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewConnectionTransportDataTypeBuilder().(*_ConnectionTransportDataTypeBuilder) + cb := NewPublishedDataItemsDataTypeBuilder().(*_PublishedDataItemsDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsNetworkAddressDataType() interface { - NetworkAddressDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedEventsDataType() interface { + PublishedEventsDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - NetworkAddressDataTypeBuilder + PublishedEventsDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewNetworkAddressDataTypeBuilder().(*_NetworkAddressDataTypeBuilder) + cb := NewPublishedEventsDataTypeBuilder().(*_PublishedEventsDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReaderGroupTransportDataType() interface { - ReaderGroupTransportDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPublishedDataSetCustomSourceDataType() interface { + PublishedDataSetCustomSourceDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReaderGroupTransportDataTypeBuilder + PublishedDataSetCustomSourceDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReaderGroupTransportDataTypeBuilder().(*_ReaderGroupTransportDataTypeBuilder) + cb := NewPublishedDataSetCustomSourceDataTypeBuilder().(*_PublishedDataSetCustomSourceDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReaderGroupMessageDataType() interface { - ReaderGroupMessageDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterDataType() interface { + DataSetWriterDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReaderGroupMessageDataTypeBuilder + DataSetWriterDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReaderGroupMessageDataTypeBuilder().(*_ReaderGroupMessageDataTypeBuilder) + cb := NewDataSetWriterDataTypeBuilder().(*_DataSetWriterDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataSetReaderTransportDataType() interface { - DataSetReaderTransportDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterTransportDataType() interface { + DataSetWriterTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataSetReaderTransportDataTypeBuilder + DataSetWriterTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataSetReaderTransportDataTypeBuilder().(*_DataSetReaderTransportDataTypeBuilder) + cb := NewDataSetWriterTransportDataTypeBuilder().(*_DataSetWriterTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataSetReaderMessageDataType() interface { - DataSetReaderMessageDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetWriterMessageDataType() interface { + DataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataSetReaderMessageDataTypeBuilder + DataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataSetReaderMessageDataTypeBuilder().(*_DataSetReaderMessageDataTypeBuilder) + cb := NewDataSetWriterMessageDataTypeBuilder().(*_DataSetWriterMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSubscribedDataSetDataType() interface { - SubscribedDataSetDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubGroupDataType() interface { + PubSubGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SubscribedDataSetDataTypeBuilder + PubSubGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSubscribedDataSetDataTypeBuilder().(*_SubscribedDataSetDataTypeBuilder) + cb := NewPubSubGroupDataTypeBuilder().(*_PubSubGroupDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFieldTargetDataType() interface { - FieldTargetDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriterGroupDataType() interface { + WriterGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FieldTargetDataTypeBuilder + WriterGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFieldTargetDataTypeBuilder().(*_FieldTargetDataTypeBuilder) + cb := NewWriterGroupDataTypeBuilder().(*_WriterGroupDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfigurationDataType() interface { - PubSubConfigurationDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriterGroupTransportDataType() interface { + WriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PubSubConfigurationDataTypeBuilder + WriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPubSubConfigurationDataTypeBuilder().(*_PubSubConfigurationDataTypeBuilder) + cb := NewWriterGroupTransportDataTypeBuilder().(*_WriterGroupTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSecurityGroupDataType() interface { - SecurityGroupDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriterGroupMessageDataType() interface { + WriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SecurityGroupDataTypeBuilder + WriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSecurityGroupDataTypeBuilder().(*_SecurityGroupDataTypeBuilder) + cb := NewWriterGroupMessageDataTypeBuilder().(*_WriterGroupMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPubSubKeyPushTargetDataType() interface { - PubSubKeyPushTargetDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConnectionDataType() interface { + PubSubConnectionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PubSubKeyPushTargetDataTypeBuilder + PubSubConnectionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPubSubKeyPushTargetDataTypeBuilder().(*_PubSubKeyPushTargetDataTypeBuilder) + cb := NewPubSubConnectionDataTypeBuilder().(*_PubSubConnectionDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQosDataType() interface { - QosDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsConnectionTransportDataType() interface { + ConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QosDataTypeBuilder + ConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQosDataTypeBuilder().(*_QosDataTypeBuilder) + cb := NewConnectionTransportDataTypeBuilder().(*_ConnectionTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfigurationRefDataType() interface { - PubSubConfigurationRefDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsNetworkAddressDataType() interface { + NetworkAddressDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PubSubConfigurationRefDataTypeBuilder + NetworkAddressDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPubSubConfigurationRefDataTypeBuilder().(*_PubSubConfigurationRefDataTypeBuilder) + cb := NewNetworkAddressDataTypeBuilder().(*_NetworkAddressDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAliasNameDataType() interface { - AliasNameDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsNetworkAddressUrlDataType() interface { + NetworkAddressUrlDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AliasNameDataTypeBuilder + NetworkAddressUrlDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAliasNameDataTypeBuilder().(*_AliasNameDataTypeBuilder) + cb := NewNetworkAddressUrlDataTypeBuilder().(*_NetworkAddressUrlDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsUserManagementDataType() interface { - UserManagementDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReaderGroupDataType() interface { + ReaderGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - UserManagementDataTypeBuilder + ReaderGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewUserManagementDataTypeBuilder().(*_UserManagementDataTypeBuilder) + cb := NewReaderGroupDataTypeBuilder().(*_ReaderGroupDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsPriorityMappingEntryType() interface { - PriorityMappingEntryTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReaderGroupTransportDataType() interface { + ReaderGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - PriorityMappingEntryTypeBuilder + ReaderGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewPriorityMappingEntryTypeBuilder().(*_PriorityMappingEntryTypeBuilder) + cb := NewReaderGroupTransportDataTypeBuilder().(*_ReaderGroupTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReferenceDescriptionDataType() interface { - ReferenceDescriptionDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReaderGroupMessageDataType() interface { + ReaderGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReferenceDescriptionDataTypeBuilder + ReaderGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReferenceDescriptionDataTypeBuilder().(*_ReferenceDescriptionDataTypeBuilder) + cb := NewReaderGroupMessageDataTypeBuilder().(*_ReaderGroupMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReferenceListEntryDataType() interface { - ReferenceListEntryDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetReaderDataType() interface { + DataSetReaderDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReferenceListEntryDataTypeBuilder + DataSetReaderDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReferenceListEntryDataTypeBuilder().(*_ReferenceListEntryDataTypeBuilder) + cb := NewDataSetReaderDataTypeBuilder().(*_DataSetReaderDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRolePermissionType() interface { - RolePermissionTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetReaderTransportDataType() interface { + DataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RolePermissionTypeBuilder + DataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRolePermissionTypeBuilder().(*_RolePermissionTypeBuilder) + cb := NewDataSetReaderTransportDataTypeBuilder().(*_DataSetReaderTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataTypeDefinition() interface { - DataTypeDefinitionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataSetReaderMessageDataType() interface { + DataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DataTypeDefinitionBuilder + DataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDataTypeDefinitionBuilder().(*_DataTypeDefinitionBuilder) + cb := NewDataSetReaderMessageDataTypeBuilder().(*_DataSetReaderMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsStructureField() interface { - StructureFieldBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSubscribedDataSetDataType() interface { + SubscribedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - StructureFieldBuilder + SubscribedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewStructureFieldBuilder().(*_StructureFieldBuilder) + cb := NewSubscribedDataSetDataTypeBuilder().(*_SubscribedDataSetDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsArgument() interface { - ArgumentBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsTargetVariablesDataType() interface { + TargetVariablesDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ArgumentBuilder + TargetVariablesDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewArgumentBuilder().(*_ArgumentBuilder) + cb := NewTargetVariablesDataTypeBuilder().(*_TargetVariablesDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsEnumValueType() interface { - EnumValueTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFieldTargetDataType() interface { + FieldTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - EnumValueTypeBuilder + FieldTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewEnumValueTypeBuilder().(*_EnumValueTypeBuilder) + cb := NewFieldTargetDataTypeBuilder().(*_FieldTargetDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsOptionSet() interface { - OptionSetBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSubscribedDataSetMirrorDataType() interface { + SubscribedDataSetMirrorDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - OptionSetBuilder + SubscribedDataSetMirrorDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewOptionSetBuilder().(*_OptionSetBuilder) + cb := NewSubscribedDataSetMirrorDataTypeBuilder().(*_SubscribedDataSetMirrorDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsTimeZoneDataType() interface { - TimeZoneDataTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfigurationDataType() interface { + PubSubConfigurationDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - TimeZoneDataTypeBuilder + PubSubConfigurationDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewTimeZoneDataTypeBuilder().(*_TimeZoneDataTypeBuilder) + cb := NewPubSubConfigurationDataTypeBuilder().(*_PubSubConfigurationDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsApplicationDescription() interface { - ApplicationDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsStandaloneSubscribedDataSetRefDataType() interface { + StandaloneSubscribedDataSetRefDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ApplicationDescriptionBuilder + StandaloneSubscribedDataSetRefDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewApplicationDescriptionBuilder().(*_ApplicationDescriptionBuilder) + cb := NewStandaloneSubscribedDataSetRefDataTypeBuilder().(*_StandaloneSubscribedDataSetRefDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRequestHeader() interface { - RequestHeaderBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsStandaloneSubscribedDataSetDataType() interface { + StandaloneSubscribedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RequestHeaderBuilder + StandaloneSubscribedDataSetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRequestHeaderBuilder().(*_RequestHeaderBuilder) + cb := NewStandaloneSubscribedDataSetDataTypeBuilder().(*_StandaloneSubscribedDataSetDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsResponseHeader() interface { - ResponseHeaderBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSecurityGroupDataType() interface { + SecurityGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ResponseHeaderBuilder + SecurityGroupDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewResponseHeaderBuilder().(*_ResponseHeaderBuilder) + cb := NewSecurityGroupDataTypeBuilder().(*_SecurityGroupDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsServiceFault() interface { - ServiceFaultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubKeyPushTargetDataType() interface { + PubSubKeyPushTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ServiceFaultBuilder + PubSubKeyPushTargetDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewServiceFaultBuilder().(*_ServiceFaultBuilder) + cb := NewPubSubKeyPushTargetDataTypeBuilder().(*_PubSubKeyPushTargetDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSessionlessInvokeRequestType() interface { - SessionlessInvokeRequestTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfiguration2DataType() interface { + PubSubConfiguration2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SessionlessInvokeRequestTypeBuilder + PubSubConfiguration2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSessionlessInvokeRequestTypeBuilder().(*_SessionlessInvokeRequestTypeBuilder) + cb := NewPubSubConfiguration2DataTypeBuilder().(*_PubSubConfiguration2DataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSessionlessInvokeResponseType() interface { - SessionlessInvokeResponseTypeBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUadpWriterGroupMessageDataType() interface { + UadpWriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SessionlessInvokeResponseTypeBuilder + UadpWriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSessionlessInvokeResponseTypeBuilder().(*_SessionlessInvokeResponseTypeBuilder) + cb := NewUadpWriterGroupMessageDataTypeBuilder().(*_UadpWriterGroupMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFindServersRequest() interface { - FindServersRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUadpDataSetWriterMessageDataType() interface { + UadpDataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FindServersRequestBuilder + UadpDataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFindServersRequestBuilder().(*_FindServersRequestBuilder) + cb := NewUadpDataSetWriterMessageDataTypeBuilder().(*_UadpDataSetWriterMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFindServersResponse() interface { - FindServersResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUadpDataSetReaderMessageDataType() interface { + UadpDataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FindServersResponseBuilder + UadpDataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFindServersResponseBuilder().(*_FindServersResponseBuilder) + cb := NewUadpDataSetReaderMessageDataTypeBuilder().(*_UadpDataSetReaderMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsServerOnNetwork() interface { - ServerOnNetworkBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsJsonWriterGroupMessageDataType() interface { + JsonWriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ServerOnNetworkBuilder + JsonWriterGroupMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewServerOnNetworkBuilder().(*_ServerOnNetworkBuilder) + cb := NewJsonWriterGroupMessageDataTypeBuilder().(*_JsonWriterGroupMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFindServersOnNetworkRequest() interface { - FindServersOnNetworkRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsJsonDataSetWriterMessageDataType() interface { + JsonDataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FindServersOnNetworkRequestBuilder + JsonDataSetWriterMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFindServersOnNetworkRequestBuilder().(*_FindServersOnNetworkRequestBuilder) + cb := NewJsonDataSetWriterMessageDataTypeBuilder().(*_JsonDataSetWriterMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFindServersOnNetworkResponse() interface { - FindServersOnNetworkResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsJsonDataSetReaderMessageDataType() interface { + JsonDataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FindServersOnNetworkResponseBuilder + JsonDataSetReaderMessageDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFindServersOnNetworkResponseBuilder().(*_FindServersOnNetworkResponseBuilder) + cb := NewJsonDataSetReaderMessageDataTypeBuilder().(*_JsonDataSetReaderMessageDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsUserTokenPolicy() interface { - UserTokenPolicyBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsQosDataType() interface { + QosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - UserTokenPolicyBuilder + QosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewUserTokenPolicyBuilder().(*_UserTokenPolicyBuilder) + cb := NewQosDataTypeBuilder().(*_QosDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsEndpointDescription() interface { - EndpointDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsTransmitQosDataType() interface { + TransmitQosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - EndpointDescriptionBuilder + TransmitQosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewEndpointDescriptionBuilder().(*_EndpointDescriptionBuilder) + cb := NewTransmitQosDataTypeBuilder().(*_TransmitQosDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsGetEndpointsRequest() interface { - GetEndpointsRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsTransmitQosPriorityDataType() interface { + TransmitQosPriorityDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - GetEndpointsRequestBuilder + TransmitQosPriorityDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewGetEndpointsRequestBuilder().(*_GetEndpointsRequestBuilder) + cb := NewTransmitQosPriorityDataTypeBuilder().(*_TransmitQosPriorityDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsGetEndpointsResponse() interface { - GetEndpointsResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReceiveQosDataType() interface { + ReceiveQosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - GetEndpointsResponseBuilder + ReceiveQosDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewGetEndpointsResponseBuilder().(*_GetEndpointsResponseBuilder) + cb := NewReceiveQosDataTypeBuilder().(*_ReceiveQosDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisteredServer() interface { - RegisteredServerBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReceiveQosPriorityDataType() interface { + ReceiveQosPriorityDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisteredServerBuilder + ReceiveQosPriorityDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisteredServerBuilder().(*_RegisteredServerBuilder) + cb := NewReceiveQosPriorityDataTypeBuilder().(*_ReceiveQosPriorityDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServerRequest() interface { - RegisterServerRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDatagramConnectionTransportDataType() interface { + DatagramConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterServerRequestBuilder + DatagramConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterServerRequestBuilder().(*_RegisterServerRequestBuilder) + cb := NewDatagramConnectionTransportDataTypeBuilder().(*_DatagramConnectionTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServerResponse() interface { - RegisterServerResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDatagramConnectionTransport2DataType() interface { + DatagramConnectionTransport2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterServerResponseBuilder + DatagramConnectionTransport2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterServerResponseBuilder().(*_RegisterServerResponseBuilder) + cb := NewDatagramConnectionTransport2DataTypeBuilder().(*_DatagramConnectionTransport2DataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDiscoveryConfiguration() interface { - DiscoveryConfigurationBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDatagramWriterGroupTransportDataType() interface { + DatagramWriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DiscoveryConfigurationBuilder + DatagramWriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDiscoveryConfigurationBuilder().(*_DiscoveryConfigurationBuilder) + cb := NewDatagramWriterGroupTransportDataTypeBuilder().(*_DatagramWriterGroupTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServer2Request() interface { - RegisterServer2RequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDatagramWriterGroupTransport2DataType() interface { + DatagramWriterGroupTransport2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterServer2RequestBuilder + DatagramWriterGroupTransport2DataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterServer2RequestBuilder().(*_RegisterServer2RequestBuilder) + cb := NewDatagramWriterGroupTransport2DataTypeBuilder().(*_DatagramWriterGroupTransport2DataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServer2Response() interface { - RegisterServer2ResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDatagramDataSetReaderTransportDataType() interface { + DatagramDataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterServer2ResponseBuilder + DatagramDataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterServer2ResponseBuilder().(*_RegisterServer2ResponseBuilder) + cb := NewDatagramDataSetReaderTransportDataTypeBuilder().(*_DatagramDataSetReaderTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsChannelSecurityToken() interface { - ChannelSecurityTokenBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsBrokerConnectionTransportDataType() interface { + BrokerConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ChannelSecurityTokenBuilder + BrokerConnectionTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewChannelSecurityTokenBuilder().(*_ChannelSecurityTokenBuilder) + cb := NewBrokerConnectionTransportDataTypeBuilder().(*_BrokerConnectionTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsOpenSecureChannelRequest() interface { - OpenSecureChannelRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsBrokerWriterGroupTransportDataType() interface { + BrokerWriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - OpenSecureChannelRequestBuilder + BrokerWriterGroupTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewOpenSecureChannelRequestBuilder().(*_OpenSecureChannelRequestBuilder) + cb := NewBrokerWriterGroupTransportDataTypeBuilder().(*_BrokerWriterGroupTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsOpenSecureChannelResponse() interface { - OpenSecureChannelResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsBrokerDataSetWriterTransportDataType() interface { + BrokerDataSetWriterTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - OpenSecureChannelResponseBuilder + BrokerDataSetWriterTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewOpenSecureChannelResponseBuilder().(*_OpenSecureChannelResponseBuilder) + cb := NewBrokerDataSetWriterTransportDataTypeBuilder().(*_BrokerDataSetWriterTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCloseSecureChannelRequest() interface { - CloseSecureChannelRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsBrokerDataSetReaderTransportDataType() interface { + BrokerDataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CloseSecureChannelRequestBuilder + BrokerDataSetReaderTransportDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCloseSecureChannelRequestBuilder().(*_CloseSecureChannelRequestBuilder) + cb := NewBrokerDataSetReaderTransportDataTypeBuilder().(*_BrokerDataSetReaderTransportDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCloseSecureChannelResponse() interface { - CloseSecureChannelResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfigurationRefDataType() interface { + PubSubConfigurationRefDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CloseSecureChannelResponseBuilder + PubSubConfigurationRefDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCloseSecureChannelResponseBuilder().(*_CloseSecureChannelResponseBuilder) + cb := NewPubSubConfigurationRefDataTypeBuilder().(*_PubSubConfigurationRefDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSignedSoftwareCertificate() interface { - SignedSoftwareCertificateBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPubSubConfigurationValueDataType() interface { + PubSubConfigurationValueDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SignedSoftwareCertificateBuilder + PubSubConfigurationValueDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSignedSoftwareCertificateBuilder().(*_SignedSoftwareCertificateBuilder) + cb := NewPubSubConfigurationValueDataTypeBuilder().(*_PubSubConfigurationValueDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsSignatureData() interface { - SignatureDataBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsAliasNameDataType() interface { + AliasNameDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - SignatureDataBuilder + AliasNameDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewSignatureDataBuilder().(*_SignatureDataBuilder) + cb := NewAliasNameDataTypeBuilder().(*_AliasNameDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCreateSessionRequest() interface { - CreateSessionRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUserManagementDataType() interface { + UserManagementDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CreateSessionRequestBuilder + UserManagementDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCreateSessionRequestBuilder().(*_CreateSessionRequestBuilder) + cb := NewUserManagementDataTypeBuilder().(*_UserManagementDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCreateSessionResponse() interface { - CreateSessionResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsPriorityMappingEntryType() interface { + PriorityMappingEntryTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CreateSessionResponseBuilder + PriorityMappingEntryTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCreateSessionResponseBuilder().(*_CreateSessionResponseBuilder) + cb := NewPriorityMappingEntryTypeBuilder().(*_PriorityMappingEntryTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsActivateSessionRequest() interface { - ActivateSessionRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReferenceDescriptionDataType() interface { + ReferenceDescriptionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ActivateSessionRequestBuilder + ReferenceDescriptionDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewActivateSessionRequestBuilder().(*_ActivateSessionRequestBuilder) + cb := NewReferenceDescriptionDataTypeBuilder().(*_ReferenceDescriptionDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsActivateSessionResponse() interface { - ActivateSessionResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReferenceListEntryDataType() interface { + ReferenceListEntryDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ActivateSessionResponseBuilder + ReferenceListEntryDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewActivateSessionResponseBuilder().(*_ActivateSessionResponseBuilder) + cb := NewReferenceListEntryDataTypeBuilder().(*_ReferenceListEntryDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCloseSessionRequest() interface { - CloseSessionRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsRolePermissionType() interface { + RolePermissionTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CloseSessionRequestBuilder + RolePermissionTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCloseSessionRequestBuilder().(*_CloseSessionRequestBuilder) + cb := NewRolePermissionTypeBuilder().(*_RolePermissionTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCloseSessionResponse() interface { - CloseSessionResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataTypeDefinition() interface { + DataTypeDefinitionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CloseSessionResponseBuilder + DataTypeDefinitionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCloseSessionResponseBuilder().(*_CloseSessionResponseBuilder) + cb := NewDataTypeDefinitionBuilder().(*_DataTypeDefinitionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCancelRequest() interface { - CancelRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsStructureField() interface { + StructureFieldBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CancelRequestBuilder + StructureFieldBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCancelRequestBuilder().(*_CancelRequestBuilder) + cb := NewStructureFieldBuilder().(*_StructureFieldBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCancelResponse() interface { - CancelResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsStructureDefinition() interface { + StructureDefinitionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CancelResponseBuilder + StructureDefinitionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCancelResponseBuilder().(*_CancelResponseBuilder) + cb := NewStructureDefinitionBuilder().(*_StructureDefinitionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsNodeAttributes() interface { - NodeAttributesBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEnumDefinition() interface { + EnumDefinitionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - NodeAttributesBuilder + EnumDefinitionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewNodeAttributesBuilder().(*_NodeAttributesBuilder) + cb := NewEnumDefinitionBuilder().(*_EnumDefinitionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsGenericAttributeValue() interface { - GenericAttributeValueBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsArgument() interface { + ArgumentBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - GenericAttributeValueBuilder + ArgumentBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewGenericAttributeValueBuilder().(*_GenericAttributeValueBuilder) + cb := NewArgumentBuilder().(*_ArgumentBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesItem() interface { - AddNodesItemBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEnumValueType() interface { + EnumValueTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddNodesItemBuilder + EnumValueTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddNodesItemBuilder().(*_AddNodesItemBuilder) + cb := NewEnumValueTypeBuilder().(*_EnumValueTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesResult() interface { - AddNodesResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEnumField() interface { + EnumFieldBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddNodesResultBuilder + EnumFieldBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddNodesResultBuilder().(*_AddNodesResultBuilder) + cb := NewEnumFieldBuilder().(*_EnumFieldBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesRequest() interface { - AddNodesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsOptionSet() interface { + OptionSetBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddNodesRequestBuilder + OptionSetBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddNodesRequestBuilder().(*_AddNodesRequestBuilder) + cb := NewOptionSetBuilder().(*_OptionSetBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesResponse() interface { - AddNodesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsTimeZoneDataType() interface { + TimeZoneDataTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddNodesResponseBuilder + TimeZoneDataTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddNodesResponseBuilder().(*_AddNodesResponseBuilder) + cb := NewTimeZoneDataTypeBuilder().(*_TimeZoneDataTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesItem() interface { - AddReferencesItemBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsApplicationDescription() interface { + ApplicationDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddReferencesItemBuilder + ApplicationDescriptionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddReferencesItemBuilder().(*_AddReferencesItemBuilder) + cb := NewApplicationDescriptionBuilder().(*_ApplicationDescriptionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesRequest() interface { - AddReferencesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsRequestHeader() interface { + RequestHeaderBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddReferencesRequestBuilder + RequestHeaderBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddReferencesRequestBuilder().(*_AddReferencesRequestBuilder) + cb := NewRequestHeaderBuilder().(*_RequestHeaderBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesResponse() interface { - AddReferencesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsResponseHeader() interface { + ResponseHeaderBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AddReferencesResponseBuilder + ResponseHeaderBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAddReferencesResponseBuilder().(*_AddReferencesResponseBuilder) + cb := NewResponseHeaderBuilder().(*_ResponseHeaderBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesItem() interface { - DeleteNodesItemBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsServiceFault() interface { + ServiceFaultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteNodesItemBuilder + ServiceFaultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteNodesItemBuilder().(*_DeleteNodesItemBuilder) + cb := NewServiceFaultBuilder().(*_ServiceFaultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesRequest() interface { - DeleteNodesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSessionlessInvokeRequestType() interface { + SessionlessInvokeRequestTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteNodesRequestBuilder + SessionlessInvokeRequestTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteNodesRequestBuilder().(*_DeleteNodesRequestBuilder) + cb := NewSessionlessInvokeRequestTypeBuilder().(*_SessionlessInvokeRequestTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesResponse() interface { - DeleteNodesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsSessionlessInvokeResponseType() interface { + SessionlessInvokeResponseTypeBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteNodesResponseBuilder + SessionlessInvokeResponseTypeBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteNodesResponseBuilder().(*_DeleteNodesResponseBuilder) + cb := NewSessionlessInvokeResponseTypeBuilder().(*_SessionlessInvokeResponseTypeBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesItem() interface { - DeleteReferencesItemBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFindServersRequest() interface { + FindServersRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteReferencesItemBuilder + FindServersRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteReferencesItemBuilder().(*_DeleteReferencesItemBuilder) + cb := NewFindServersRequestBuilder().(*_FindServersRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesRequest() interface { - DeleteReferencesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFindServersResponse() interface { + FindServersResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteReferencesRequestBuilder + FindServersResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteReferencesRequestBuilder().(*_DeleteReferencesRequestBuilder) + cb := NewFindServersResponseBuilder().(*_FindServersResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesResponse() interface { - DeleteReferencesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsServerOnNetwork() interface { + ServerOnNetworkBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - DeleteReferencesResponseBuilder + ServerOnNetworkBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewDeleteReferencesResponseBuilder().(*_DeleteReferencesResponseBuilder) + cb := NewServerOnNetworkBuilder().(*_ServerOnNetworkBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsViewDescription() interface { - ViewDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFindServersOnNetworkRequest() interface { + FindServersOnNetworkRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ViewDescriptionBuilder + FindServersOnNetworkRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewViewDescriptionBuilder().(*_ViewDescriptionBuilder) + cb := NewFindServersOnNetworkRequestBuilder().(*_FindServersOnNetworkRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseDescription() interface { - BrowseDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsFindServersOnNetworkResponse() interface { + FindServersOnNetworkResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseDescriptionBuilder + FindServersOnNetworkResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseDescriptionBuilder().(*_BrowseDescriptionBuilder) + cb := NewFindServersOnNetworkResponseBuilder().(*_FindServersOnNetworkResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReferenceDescription() interface { - ReferenceDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUserTokenPolicy() interface { + UserTokenPolicyBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReferenceDescriptionBuilder + UserTokenPolicyBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReferenceDescriptionBuilder().(*_ReferenceDescriptionBuilder) + cb := NewUserTokenPolicyBuilder().(*_UserTokenPolicyBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseResult() interface { - BrowseResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEndpointDescription() interface { + EndpointDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + EndpointDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewEndpointDescriptionBuilder().(*_EndpointDescriptionBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsGetEndpointsRequest() interface { + GetEndpointsRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + GetEndpointsRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewGetEndpointsRequestBuilder().(*_GetEndpointsRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsGetEndpointsResponse() interface { + GetEndpointsResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + GetEndpointsResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewGetEndpointsResponseBuilder().(*_GetEndpointsResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRegisteredServer() interface { + RegisteredServerBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RegisteredServerBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRegisteredServerBuilder().(*_RegisteredServerBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServerRequest() interface { + RegisterServerRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RegisterServerRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRegisterServerRequestBuilder().(*_RegisterServerRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServerResponse() interface { + RegisterServerResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RegisterServerResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRegisterServerResponseBuilder().(*_RegisterServerResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDiscoveryConfiguration() interface { + DiscoveryConfigurationBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DiscoveryConfigurationBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDiscoveryConfigurationBuilder().(*_DiscoveryConfigurationBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsMdnsDiscoveryConfiguration() interface { + MdnsDiscoveryConfigurationBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + MdnsDiscoveryConfigurationBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewMdnsDiscoveryConfigurationBuilder().(*_MdnsDiscoveryConfigurationBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServer2Request() interface { + RegisterServer2RequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RegisterServer2RequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRegisterServer2RequestBuilder().(*_RegisterServer2RequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterServer2Response() interface { + RegisterServer2ResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RegisterServer2ResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRegisterServer2ResponseBuilder().(*_RegisterServer2ResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsChannelSecurityToken() interface { + ChannelSecurityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ChannelSecurityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewChannelSecurityTokenBuilder().(*_ChannelSecurityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsOpenSecureChannelRequest() interface { + OpenSecureChannelRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + OpenSecureChannelRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewOpenSecureChannelRequestBuilder().(*_OpenSecureChannelRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsOpenSecureChannelResponse() interface { + OpenSecureChannelResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + OpenSecureChannelResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewOpenSecureChannelResponseBuilder().(*_OpenSecureChannelResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCloseSecureChannelRequest() interface { + CloseSecureChannelRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CloseSecureChannelRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCloseSecureChannelRequestBuilder().(*_CloseSecureChannelRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCloseSecureChannelResponse() interface { + CloseSecureChannelResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CloseSecureChannelResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCloseSecureChannelResponseBuilder().(*_CloseSecureChannelResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsSignedSoftwareCertificate() interface { + SignedSoftwareCertificateBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + SignedSoftwareCertificateBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewSignedSoftwareCertificateBuilder().(*_SignedSoftwareCertificateBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsSignatureData() interface { + SignatureDataBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + SignatureDataBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewSignatureDataBuilder().(*_SignatureDataBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCreateSessionRequest() interface { + CreateSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CreateSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCreateSessionRequestBuilder().(*_CreateSessionRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCreateSessionResponse() interface { + CreateSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CreateSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCreateSessionResponseBuilder().(*_CreateSessionResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsUserIdentityToken() interface { + UserIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + UserIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewUserIdentityTokenBuilder().(*_UserIdentityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAnonymousIdentityToken() interface { + AnonymousIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AnonymousIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAnonymousIdentityTokenBuilder().(*_AnonymousIdentityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsUserNameIdentityToken() interface { + UserNameIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + UserNameIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewUserNameIdentityTokenBuilder().(*_UserNameIdentityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsX509IdentityToken() interface { + X509IdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + X509IdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewX509IdentityTokenBuilder().(*_X509IdentityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsIssuedIdentityToken() interface { + IssuedIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + IssuedIdentityTokenBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewIssuedIdentityTokenBuilder().(*_IssuedIdentityTokenBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsActivateSessionRequest() interface { + ActivateSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ActivateSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewActivateSessionRequestBuilder().(*_ActivateSessionRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsActivateSessionResponse() interface { + ActivateSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ActivateSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewActivateSessionResponseBuilder().(*_ActivateSessionResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCloseSessionRequest() interface { + CloseSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CloseSessionRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCloseSessionRequestBuilder().(*_CloseSessionRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCloseSessionResponse() interface { + CloseSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CloseSessionResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCloseSessionResponseBuilder().(*_CloseSessionResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCancelRequest() interface { + CancelRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CancelRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCancelRequestBuilder().(*_CancelRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsCancelResponse() interface { + CancelResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + CancelResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewCancelResponseBuilder().(*_CancelResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsNodeAttributes() interface { + NodeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + NodeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewNodeAttributesBuilder().(*_NodeAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsObjectAttributes() interface { + ObjectAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ObjectAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewObjectAttributesBuilder().(*_ObjectAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsVariableAttributes() interface { + VariableAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + VariableAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewVariableAttributesBuilder().(*_VariableAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsMethodAttributes() interface { + MethodAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + MethodAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewMethodAttributesBuilder().(*_MethodAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsObjectTypeAttributes() interface { + ObjectTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ObjectTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewObjectTypeAttributesBuilder().(*_ObjectTypeAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsVariableTypeAttributes() interface { + VariableTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + VariableTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewVariableTypeAttributesBuilder().(*_VariableTypeAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsReferenceTypeAttributes() interface { + ReferenceTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ReferenceTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewReferenceTypeAttributesBuilder().(*_ReferenceTypeAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDataTypeAttributes() interface { + DataTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DataTypeAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDataTypeAttributesBuilder().(*_DataTypeAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsViewAttributes() interface { + ViewAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ViewAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewViewAttributesBuilder().(*_ViewAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsGenericAttributeValue() interface { + GenericAttributeValueBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + GenericAttributeValueBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewGenericAttributeValueBuilder().(*_GenericAttributeValueBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsGenericAttributes() interface { + GenericAttributesBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + GenericAttributesBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewGenericAttributesBuilder().(*_GenericAttributesBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesItem() interface { + AddNodesItemBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddNodesItemBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddNodesItemBuilder().(*_AddNodesItemBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesResult() interface { + AddNodesResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddNodesResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddNodesResultBuilder().(*_AddNodesResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesRequest() interface { + AddNodesRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddNodesRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddNodesRequestBuilder().(*_AddNodesRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddNodesResponse() interface { + AddNodesResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddNodesResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddNodesResponseBuilder().(*_AddNodesResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesItem() interface { + AddReferencesItemBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddReferencesItemBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddReferencesItemBuilder().(*_AddReferencesItemBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesRequest() interface { + AddReferencesRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddReferencesRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddReferencesRequestBuilder().(*_AddReferencesRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAddReferencesResponse() interface { + AddReferencesResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AddReferencesResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAddReferencesResponseBuilder().(*_AddReferencesResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesItem() interface { + DeleteNodesItemBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteNodesItemBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteNodesItemBuilder().(*_DeleteNodesItemBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesRequest() interface { + DeleteNodesRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteNodesRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteNodesRequestBuilder().(*_DeleteNodesRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteNodesResponse() interface { + DeleteNodesResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteNodesResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteNodesResponseBuilder().(*_DeleteNodesResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesItem() interface { + DeleteReferencesItemBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteReferencesItemBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteReferencesItemBuilder().(*_DeleteReferencesItemBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesRequest() interface { + DeleteReferencesRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteReferencesRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteReferencesRequestBuilder().(*_DeleteReferencesRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteReferencesResponse() interface { + DeleteReferencesResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DeleteReferencesResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDeleteReferencesResponseBuilder().(*_DeleteReferencesResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsViewDescription() interface { + ViewDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ViewDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewViewDescriptionBuilder().(*_ViewDescriptionBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseDescription() interface { + BrowseDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseDescriptionBuilder().(*_BrowseDescriptionBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsReferenceDescription() interface { + ReferenceDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ReferenceDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewReferenceDescriptionBuilder().(*_ReferenceDescriptionBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseResult() interface { + BrowseResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseResultBuilder().(*_BrowseResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseRequest() interface { + BrowseRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseRequestBuilder().(*_BrowseRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseResponse() interface { + BrowseResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseResponseBuilder().(*_BrowseResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseNextRequest() interface { + BrowseNextRequestBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseNextRequestBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseNextRequestBuilder().(*_BrowseNextRequestBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowseNextResponse() interface { + BrowseNextResponseBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowseNextResponseBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowseNextResponseBuilder().(*_BrowseNextResponseBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRelativePathElement() interface { + RelativePathElementBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RelativePathElementBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRelativePathElementBuilder().(*_RelativePathElementBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsRelativePath() interface { + RelativePathBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + RelativePathBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewRelativePathBuilder().(*_RelativePathBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePath() interface { + BrowsePathBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowsePathBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowsePathBuilder().(*_BrowsePathBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePathTarget() interface { + BrowsePathTargetBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowsePathTargetBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowsePathTargetBuilder().(*_BrowsePathTargetBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePathResult() interface { + BrowsePathResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + BrowsePathResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewBrowsePathResultBuilder().(*_BrowsePathResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsTranslateBrowsePathsToNodeIdsRequest() interface { + TranslateBrowsePathsToNodeIdsRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseResultBuilder + TranslateBrowsePathsToNodeIdsRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseResultBuilder().(*_BrowseResultBuilder) + cb := NewTranslateBrowsePathsToNodeIdsRequestBuilder().(*_TranslateBrowsePathsToNodeIdsRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseRequest() interface { - BrowseRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsTranslateBrowsePathsToNodeIdsResponse() interface { + TranslateBrowsePathsToNodeIdsResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseRequestBuilder + TranslateBrowsePathsToNodeIdsResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseRequestBuilder().(*_BrowseRequestBuilder) + cb := NewTranslateBrowsePathsToNodeIdsResponseBuilder().(*_TranslateBrowsePathsToNodeIdsResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseResponse() interface { - BrowseResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterNodesRequest() interface { + RegisterNodesRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseResponseBuilder + RegisterNodesRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseResponseBuilder().(*_BrowseResponseBuilder) + cb := NewRegisterNodesRequestBuilder().(*_RegisterNodesRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseNextRequest() interface { - BrowseNextRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsRegisterNodesResponse() interface { + RegisterNodesResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseNextRequestBuilder + RegisterNodesResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseNextRequestBuilder().(*_BrowseNextRequestBuilder) + cb := NewRegisterNodesResponseBuilder().(*_RegisterNodesResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowseNextResponse() interface { - BrowseNextResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUnregisterNodesRequest() interface { + UnregisterNodesRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowseNextResponseBuilder + UnregisterNodesRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowseNextResponseBuilder().(*_BrowseNextResponseBuilder) + cb := NewUnregisterNodesRequestBuilder().(*_UnregisterNodesRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRelativePathElement() interface { - RelativePathElementBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUnregisterNodesResponse() interface { + UnregisterNodesResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RelativePathElementBuilder + UnregisterNodesResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRelativePathElementBuilder().(*_RelativePathElementBuilder) + cb := NewUnregisterNodesResponseBuilder().(*_UnregisterNodesResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRelativePath() interface { - RelativePathBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEndpointConfiguration() interface { + EndpointConfigurationBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RelativePathBuilder + EndpointConfigurationBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRelativePathBuilder().(*_RelativePathBuilder) + cb := NewEndpointConfigurationBuilder().(*_EndpointConfigurationBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePath() interface { - BrowsePathBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsQueryDataDescription() interface { + QueryDataDescriptionBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowsePathBuilder + QueryDataDescriptionBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowsePathBuilder().(*_BrowsePathBuilder) + cb := NewQueryDataDescriptionBuilder().(*_QueryDataDescriptionBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePathTarget() interface { - BrowsePathTargetBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsNodeTypeDescription() interface { + NodeTypeDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + NodeTypeDescriptionBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewNodeTypeDescriptionBuilder().(*_NodeTypeDescriptionBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsQueryDataSet() interface { + QueryDataSetBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + QueryDataSetBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewQueryDataSetBuilder().(*_QueryDataSetBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsNodeReference() interface { + NodeReferenceBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + NodeReferenceBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewNodeReferenceBuilder().(*_NodeReferenceBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterElement() interface { + ContentFilterElementBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ContentFilterElementBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewContentFilterElementBuilder().(*_ContentFilterElementBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsContentFilter() interface { + ContentFilterBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ContentFilterBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewContentFilterBuilder().(*_ContentFilterBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsFilterOperand() interface { + FilterOperandBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + FilterOperandBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewFilterOperandBuilder().(*_FilterOperandBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsElementOperand() interface { + ElementOperandBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ElementOperandBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewElementOperandBuilder().(*_ElementOperandBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsLiteralOperand() interface { + LiteralOperandBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + LiteralOperandBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewLiteralOperandBuilder().(*_LiteralOperandBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsAttributeOperand() interface { + AttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + AttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewAttributeOperandBuilder().(*_AttributeOperandBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsSimpleAttributeOperand() interface { + SimpleAttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + SimpleAttributeOperandBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewSimpleAttributeOperandBuilder().(*_SimpleAttributeOperandBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterElementResult() interface { + ContentFilterElementResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ContentFilterElementResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewContentFilterElementResultBuilder().(*_ContentFilterElementResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterResult() interface { + ContentFilterResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ContentFilterResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewContentFilterResultBuilder().(*_ContentFilterResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsParsingResult() interface { + ParsingResultBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + ParsingResultBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewParsingResultBuilder().(*_ParsingResultBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectDefinitionBuilder) AsQueryFirstRequest() interface { + QueryFirstRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowsePathTargetBuilder + QueryFirstRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowsePathTargetBuilder().(*_BrowsePathTargetBuilder) + cb := NewQueryFirstRequestBuilder().(*_QueryFirstRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsBrowsePathResult() interface { - BrowsePathResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsQueryFirstResponse() interface { + QueryFirstResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - BrowsePathResultBuilder + QueryFirstResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewBrowsePathResultBuilder().(*_BrowsePathResultBuilder) + cb := NewQueryFirstResponseBuilder().(*_QueryFirstResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsTranslateBrowsePathsToNodeIdsRequest() interface { - TranslateBrowsePathsToNodeIdsRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsQueryNextRequest() interface { + QueryNextRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - TranslateBrowsePathsToNodeIdsRequestBuilder + QueryNextRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewTranslateBrowsePathsToNodeIdsRequestBuilder().(*_TranslateBrowsePathsToNodeIdsRequestBuilder) + cb := NewQueryNextRequestBuilder().(*_QueryNextRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsTranslateBrowsePathsToNodeIdsResponse() interface { - TranslateBrowsePathsToNodeIdsResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsQueryNextResponse() interface { + QueryNextResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - TranslateBrowsePathsToNodeIdsResponseBuilder + QueryNextResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewTranslateBrowsePathsToNodeIdsResponseBuilder().(*_TranslateBrowsePathsToNodeIdsResponseBuilder) + cb := NewQueryNextResponseBuilder().(*_QueryNextResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterNodesRequest() interface { - RegisterNodesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadValueId() interface { + ReadValueIdBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterNodesRequestBuilder + ReadValueIdBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterNodesRequestBuilder().(*_RegisterNodesRequestBuilder) + cb := NewReadValueIdBuilder().(*_ReadValueIdBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsRegisterNodesResponse() interface { - RegisterNodesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadRequest() interface { + ReadRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - RegisterNodesResponseBuilder + ReadRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewRegisterNodesResponseBuilder().(*_RegisterNodesResponseBuilder) + cb := NewReadRequestBuilder().(*_ReadRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsUnregisterNodesRequest() interface { - UnregisterNodesRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadResponse() interface { + ReadResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - UnregisterNodesRequestBuilder + ReadResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewUnregisterNodesRequestBuilder().(*_UnregisterNodesRequestBuilder) + cb := NewReadResponseBuilder().(*_ReadResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsUnregisterNodesResponse() interface { - UnregisterNodesResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadValueId() interface { + HistoryReadValueIdBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - UnregisterNodesResponseBuilder + HistoryReadValueIdBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewUnregisterNodesResponseBuilder().(*_UnregisterNodesResponseBuilder) + cb := NewHistoryReadValueIdBuilder().(*_HistoryReadValueIdBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsEndpointConfiguration() interface { - EndpointConfigurationBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadResult() interface { + HistoryReadResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - EndpointConfigurationBuilder + HistoryReadResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewEndpointConfigurationBuilder().(*_EndpointConfigurationBuilder) + cb := NewHistoryReadResultBuilder().(*_HistoryReadResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryDataDescription() interface { - QueryDataDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadDetails() interface { + HistoryReadDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryDataDescriptionBuilder + HistoryReadDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryDataDescriptionBuilder().(*_QueryDataDescriptionBuilder) + cb := NewHistoryReadDetailsBuilder().(*_HistoryReadDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsNodeTypeDescription() interface { - NodeTypeDescriptionBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadEventDetails() interface { + ReadEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - NodeTypeDescriptionBuilder + ReadEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewNodeTypeDescriptionBuilder().(*_NodeTypeDescriptionBuilder) + cb := NewReadEventDetailsBuilder().(*_ReadEventDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryDataSet() interface { - QueryDataSetBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadEventDetails2() interface { + ReadEventDetails2Builder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryDataSetBuilder + ReadEventDetails2Builder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryDataSetBuilder().(*_QueryDataSetBuilder) + cb := NewReadEventDetails2Builder().(*_ReadEventDetails2Builder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsNodeReference() interface { - NodeReferenceBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadRawModifiedDetails() interface { + ReadRawModifiedDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - NodeReferenceBuilder + ReadRawModifiedDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewNodeReferenceBuilder().(*_NodeReferenceBuilder) + cb := NewReadRawModifiedDetailsBuilder().(*_ReadRawModifiedDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterElement() interface { - ContentFilterElementBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadProcessedDetails() interface { + ReadProcessedDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ContentFilterElementBuilder + ReadProcessedDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewContentFilterElementBuilder().(*_ContentFilterElementBuilder) + cb := NewReadProcessedDetailsBuilder().(*_ReadProcessedDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsContentFilter() interface { - ContentFilterBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadAtTimeDetails() interface { + ReadAtTimeDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ContentFilterBuilder + ReadAtTimeDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewContentFilterBuilder().(*_ContentFilterBuilder) + cb := NewReadAtTimeDetailsBuilder().(*_ReadAtTimeDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsFilterOperand() interface { - FilterOperandBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsReadAnnotationDataDetails() interface { + ReadAnnotationDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - FilterOperandBuilder + ReadAnnotationDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewFilterOperandBuilder().(*_FilterOperandBuilder) + cb := NewReadAnnotationDataDetailsBuilder().(*_ReadAnnotationDataDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterElementResult() interface { - ContentFilterElementResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryData() interface { + HistoryDataBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ContentFilterElementResultBuilder + HistoryDataBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewContentFilterElementResultBuilder().(*_ContentFilterElementResultBuilder) + cb := NewHistoryDataBuilder().(*_HistoryDataBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsContentFilterResult() interface { - ContentFilterResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsModificationInfo() interface { + ModificationInfoBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ContentFilterResultBuilder + ModificationInfoBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewContentFilterResultBuilder().(*_ContentFilterResultBuilder) + cb := NewModificationInfoBuilder().(*_ModificationInfoBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsParsingResult() interface { - ParsingResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryModifiedData() interface { + HistoryModifiedDataBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ParsingResultBuilder + HistoryModifiedDataBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewParsingResultBuilder().(*_ParsingResultBuilder) + cb := NewHistoryModifiedDataBuilder().(*_HistoryModifiedDataBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryFirstRequest() interface { - QueryFirstRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryEvent() interface { + HistoryEventBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryFirstRequestBuilder + HistoryEventBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryFirstRequestBuilder().(*_QueryFirstRequestBuilder) + cb := NewHistoryEventBuilder().(*_HistoryEventBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryFirstResponse() interface { - QueryFirstResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryModifiedEvent() interface { + HistoryModifiedEventBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryFirstResponseBuilder + HistoryModifiedEventBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryFirstResponseBuilder().(*_QueryFirstResponseBuilder) + cb := NewHistoryModifiedEventBuilder().(*_HistoryModifiedEventBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryNextRequest() interface { - QueryNextRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadRequest() interface { + HistoryReadRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryNextRequestBuilder + HistoryReadRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryNextRequestBuilder().(*_QueryNextRequestBuilder) + cb := NewHistoryReadRequestBuilder().(*_HistoryReadRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsQueryNextResponse() interface { - QueryNextResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadResponse() interface { + HistoryReadResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - QueryNextResponseBuilder + HistoryReadResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewQueryNextResponseBuilder().(*_QueryNextResponseBuilder) + cb := NewHistoryReadResponseBuilder().(*_HistoryReadResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReadValueId() interface { - ReadValueIdBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriteValue() interface { + WriteValueBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReadValueIdBuilder + WriteValueBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReadValueIdBuilder().(*_ReadValueIdBuilder) + cb := NewWriteValueBuilder().(*_WriteValueBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReadRequest() interface { - ReadRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriteRequest() interface { + WriteRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReadRequestBuilder + WriteRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReadRequestBuilder().(*_ReadRequestBuilder) + cb := NewWriteRequestBuilder().(*_WriteRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsReadResponse() interface { - ReadResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsWriteResponse() interface { + WriteResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ReadResponseBuilder + WriteResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewReadResponseBuilder().(*_ReadResponseBuilder) + cb := NewWriteResponseBuilder().(*_WriteResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadValueId() interface { - HistoryReadValueIdBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateDetails() interface { + HistoryUpdateDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryReadValueIdBuilder + HistoryUpdateDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryReadValueIdBuilder().(*_HistoryReadValueIdBuilder) + cb := NewHistoryUpdateDetailsBuilder().(*_HistoryUpdateDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadResult() interface { - HistoryReadResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUpdateDataDetails() interface { + UpdateDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryReadResultBuilder + UpdateDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryReadResultBuilder().(*_HistoryReadResultBuilder) + cb := NewUpdateDataDetailsBuilder().(*_UpdateDataDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadDetails() interface { - HistoryReadDetailsBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUpdateStructureDataDetails() interface { + UpdateStructureDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryReadDetailsBuilder + UpdateStructureDataDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryReadDetailsBuilder().(*_HistoryReadDetailsBuilder) + cb := NewUpdateStructureDataDetailsBuilder().(*_UpdateStructureDataDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryData() interface { - HistoryDataBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsUpdateEventDetails() interface { + UpdateEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryDataBuilder + UpdateEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryDataBuilder().(*_HistoryDataBuilder) + cb := NewUpdateEventDetailsBuilder().(*_UpdateEventDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsModificationInfo() interface { - ModificationInfoBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteRawModifiedDetails() interface { + DeleteRawModifiedDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - ModificationInfoBuilder + DeleteRawModifiedDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewModificationInfoBuilder().(*_ModificationInfoBuilder) + cb := NewDeleteRawModifiedDetailsBuilder().(*_DeleteRawModifiedDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryEvent() interface { - HistoryEventBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteAtTimeDetails() interface { + DeleteAtTimeDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryEventBuilder + DeleteAtTimeDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryEventBuilder().(*_HistoryEventBuilder) + cb := NewDeleteAtTimeDetailsBuilder().(*_DeleteAtTimeDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadRequest() interface { - HistoryReadRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDeleteEventDetails() interface { + DeleteEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryReadRequestBuilder + DeleteEventDetailsBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryReadRequestBuilder().(*_HistoryReadRequestBuilder) + cb := NewDeleteEventDetailsBuilder().(*_DeleteEventDetailsBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryReadResponse() interface { - HistoryReadResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateResult() interface { + HistoryUpdateResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryReadResponseBuilder + HistoryUpdateResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryReadResponseBuilder().(*_HistoryReadResponseBuilder) + cb := NewHistoryUpdateResultBuilder().(*_HistoryUpdateResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsWriteValue() interface { - WriteValueBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateRequest() interface { + HistoryUpdateRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - WriteValueBuilder + HistoryUpdateRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewWriteValueBuilder().(*_WriteValueBuilder) + cb := NewHistoryUpdateRequestBuilder().(*_HistoryUpdateRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsWriteRequest() interface { - WriteRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateResponse() interface { + HistoryUpdateResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - WriteRequestBuilder + HistoryUpdateResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewWriteRequestBuilder().(*_WriteRequestBuilder) + cb := NewHistoryUpdateResponseBuilder().(*_HistoryUpdateResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsWriteResponse() interface { - WriteResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsCallMethodRequest() interface { + CallMethodRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - WriteResponseBuilder + CallMethodRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewWriteResponseBuilder().(*_WriteResponseBuilder) + cb := NewCallMethodRequestBuilder().(*_CallMethodRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateDetails() interface { - HistoryUpdateDetailsBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsCallMethodResult() interface { + CallMethodResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryUpdateDetailsBuilder + CallMethodResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryUpdateDetailsBuilder().(*_HistoryUpdateDetailsBuilder) + cb := NewCallMethodResultBuilder().(*_CallMethodResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateResult() interface { - HistoryUpdateResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsCallRequest() interface { + CallRequestBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryUpdateResultBuilder + CallRequestBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryUpdateResultBuilder().(*_HistoryUpdateResultBuilder) + cb := NewCallRequestBuilder().(*_CallRequestBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateRequest() interface { - HistoryUpdateRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsCallResponse() interface { + CallResponseBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryUpdateRequestBuilder + CallResponseBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryUpdateRequestBuilder().(*_HistoryUpdateRequestBuilder) + cb := NewCallResponseBuilder().(*_CallResponseBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsHistoryUpdateResponse() interface { - HistoryUpdateResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsMonitoringFilter() interface { + MonitoringFilterBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - HistoryUpdateResponseBuilder + MonitoringFilterBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewHistoryUpdateResponseBuilder().(*_HistoryUpdateResponseBuilder) + cb := NewMonitoringFilterBuilder().(*_MonitoringFilterBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCallMethodRequest() interface { - CallMethodRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsDataChangeFilter() interface { + DataChangeFilterBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CallMethodRequestBuilder + DataChangeFilterBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCallMethodRequestBuilder().(*_CallMethodRequestBuilder) + cb := NewDataChangeFilterBuilder().(*_DataChangeFilterBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCallMethodResult() interface { - CallMethodResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEventFilter() interface { + EventFilterBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CallMethodResultBuilder + EventFilterBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCallMethodResultBuilder().(*_CallMethodResultBuilder) + cb := NewEventFilterBuilder().(*_EventFilterBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCallRequest() interface { - CallRequestBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsAggregateConfiguration() interface { + AggregateConfigurationBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CallRequestBuilder + AggregateConfigurationBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCallRequestBuilder().(*_CallRequestBuilder) + cb := NewAggregateConfigurationBuilder().(*_AggregateConfigurationBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsCallResponse() interface { - CallResponseBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsAggregateFilter() interface { + AggregateFilterBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - CallResponseBuilder + AggregateFilterBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewCallResponseBuilder().(*_CallResponseBuilder) + cb := NewAggregateFilterBuilder().(*_AggregateFilterBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsMonitoringFilter() interface { - MonitoringFilterBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsMonitoringFilterResult() interface { + MonitoringFilterResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - MonitoringFilterBuilder + MonitoringFilterResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewMonitoringFilterBuilder().(*_MonitoringFilterBuilder) + cb := NewMonitoringFilterResultBuilder().(*_MonitoringFilterResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsAggregateConfiguration() interface { - AggregateConfigurationBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsEventFilterResult() interface { + EventFilterResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - AggregateConfigurationBuilder + EventFilterResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewAggregateConfigurationBuilder().(*_AggregateConfigurationBuilder) + cb := NewEventFilterResultBuilder().(*_EventFilterResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsMonitoringFilterResult() interface { - MonitoringFilterResultBuilder +func (b *_ExtensionObjectDefinitionBuilder) AsAggregateFilterResult() interface { + AggregateFilterResultBuilder Done() ExtensionObjectDefinitionBuilder } { if cb, ok := b.childBuilder.(interface { - MonitoringFilterResultBuilder + AggregateFilterResultBuilder Done() ExtensionObjectDefinitionBuilder }); ok { return cb } - cb := NewMonitoringFilterResultBuilder().(*_MonitoringFilterResultBuilder) + cb := NewAggregateFilterResultBuilder().(*_AggregateFilterResultBuilder) cb.parentBuilder = b b.childBuilder = cb return cb @@ -4368,6 +6043,22 @@ func (b *_ExtensionObjectDefinitionBuilder) AsNotificationData() interface { return cb } +func (b *_ExtensionObjectDefinitionBuilder) AsDataChangeNotification() interface { + DataChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + DataChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewDataChangeNotificationBuilder().(*_DataChangeNotificationBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + func (b *_ExtensionObjectDefinitionBuilder) AsMonitoredItemNotification() interface { MonitoredItemNotificationBuilder Done() ExtensionObjectDefinitionBuilder @@ -4384,6 +6075,22 @@ func (b *_ExtensionObjectDefinitionBuilder) AsMonitoredItemNotification() interf return cb } +func (b *_ExtensionObjectDefinitionBuilder) AsEventNotificationList() interface { + EventNotificationListBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + EventNotificationListBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewEventNotificationListBuilder().(*_EventNotificationListBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + func (b *_ExtensionObjectDefinitionBuilder) AsEventFieldList() interface { EventFieldListBuilder Done() ExtensionObjectDefinitionBuilder @@ -4416,6 +6123,22 @@ func (b *_ExtensionObjectDefinitionBuilder) AsHistoryEventFieldList() interface return cb } +func (b *_ExtensionObjectDefinitionBuilder) AsStatusChangeNotification() interface { + StatusChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder +} { + if cb, ok := b.childBuilder.(interface { + StatusChangeNotificationBuilder + Done() ExtensionObjectDefinitionBuilder + }); ok { + return cb + } + cb := NewStatusChangeNotificationBuilder().(*_StatusChangeNotificationBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + func (b *_ExtensionObjectDefinitionBuilder) AsSubscriptionAcknowledgement() interface { SubscriptionAcknowledgementBuilder Done() ExtensionObjectDefinitionBuilder @@ -4944,70 +6667,6 @@ func (b *_ExtensionObjectDefinitionBuilder) AsAnnotation() interface { return cb } -func (b *_ExtensionObjectDefinitionBuilder) AsDataChangeNotification() interface { - DataChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - DataChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder - }); ok { - return cb - } - cb := NewDataChangeNotificationBuilder().(*_DataChangeNotificationBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_ExtensionObjectDefinitionBuilder) AsEventNotificationList() interface { - EventNotificationListBuilder - Done() ExtensionObjectDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - EventNotificationListBuilder - Done() ExtensionObjectDefinitionBuilder - }); ok { - return cb - } - cb := NewEventNotificationListBuilder().(*_EventNotificationListBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_ExtensionObjectDefinitionBuilder) AsStatusChangeNotification() interface { - StatusChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - StatusChangeNotificationBuilder - Done() ExtensionObjectDefinitionBuilder - }); ok { - return cb - } - cb := NewStatusChangeNotificationBuilder().(*_StatusChangeNotificationBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_ExtensionObjectDefinitionBuilder) AsUserIdentityToken() interface { - UserIdentityTokenBuilder - Done() ExtensionObjectDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - UserIdentityTokenBuilder - Done() ExtensionObjectDefinitionBuilder - }); ok { - return cb - } - cb := NewUserIdentityTokenBuilder().(*_UserIdentityTokenBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - func (b *_ExtensionObjectDefinitionBuilder) Build() (ExtensionObjectDefinition, error) { v, err := b.PartialBuild() if err != nil { @@ -5080,13 +6739,13 @@ func (m *_ExtensionObjectDefinition) GetLengthInBytes(ctx context.Context) uint1 return m._SubType.GetLengthInBits(ctx) / 8 } -func ExtensionObjectDefinitionParse[T ExtensionObjectDefinition](ctx context.Context, theBytes []byte, identifier string) (T, error) { - return ExtensionObjectDefinitionParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), identifier) +func ExtensionObjectDefinitionParse[T ExtensionObjectDefinition](ctx context.Context, theBytes []byte, extensionId int32) (T, error) { + return ExtensionObjectDefinitionParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), extensionId) } -func ExtensionObjectDefinitionParseWithBufferProducer[T ExtensionObjectDefinition](identifier string) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { +func ExtensionObjectDefinitionParseWithBufferProducer[T ExtensionObjectDefinition](extensionId int32) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { return func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { - v, err := ExtensionObjectDefinitionParseWithBuffer[T](ctx, readBuffer, identifier) + v, err := ExtensionObjectDefinitionParseWithBuffer[T](ctx, readBuffer, extensionId) if err != nil { var zero T return zero, err @@ -5095,8 +6754,8 @@ func ExtensionObjectDefinitionParseWithBufferProducer[T ExtensionObjectDefinitio } } -func ExtensionObjectDefinitionParseWithBuffer[T ExtensionObjectDefinition](ctx context.Context, readBuffer utils.ReadBuffer, identifier string) (T, error) { - v, err := (&_ExtensionObjectDefinition{}).parse(ctx, readBuffer, identifier) +func ExtensionObjectDefinitionParseWithBuffer[T ExtensionObjectDefinition](ctx context.Context, readBuffer utils.ReadBuffer, extensionId int32) (T, error) { + v, err := (&_ExtensionObjectDefinition{}).parse(ctx, readBuffer, extensionId) if err != nil { var zero T return zero, err @@ -5109,7 +6768,7 @@ func ExtensionObjectDefinitionParseWithBuffer[T ExtensionObjectDefinition](ctx c return vc, nil } -func (m *_ExtensionObjectDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, identifier string) (__extensionObjectDefinition ExtensionObjectDefinition, err error) { +func (m *_ExtensionObjectDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, extensionId int32) (__extensionObjectDefinition ExtensionObjectDefinition, err error) { positionAware := readBuffer _ = positionAware if pullErr := readBuffer.PullContext("ExtensionObjectDefinition"); pullErr != nil { @@ -5121,936 +6780,1252 @@ func (m *_ExtensionObjectDefinition) parse(ctx context.Context, readBuffer utils // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) var _child ExtensionObjectDefinition switch { - case identifier == "0": // NullExtension - if _child, err = new(_NullExtension).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(0): // NullExtension + if _child, err = new(_NullExtension).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NullExtension for type-switch of ExtensionObjectDefinition") } - case identifier == "12758": // Union - if _child, err = new(_Union).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12758): // Union + if _child, err = new(_Union).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Union for type-switch of ExtensionObjectDefinition") } - case identifier == "14535": // KeyValuePair - if _child, err = new(_KeyValuePair).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(14535): // KeyValuePair + if _child, err = new(_KeyValuePair).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type KeyValuePair for type-switch of ExtensionObjectDefinition") } - case identifier == "16315": // AdditionalParametersType - if _child, err = new(_AdditionalParametersType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(16315): // AdditionalParametersType + if _child, err = new(_AdditionalParametersType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AdditionalParametersType for type-switch of ExtensionObjectDefinition") } - case identifier == "17550": // EphemeralKeyType - if _child, err = new(_EphemeralKeyType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(17550): // EphemeralKeyType + if _child, err = new(_EphemeralKeyType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EphemeralKeyType for type-switch of ExtensionObjectDefinition") } - case identifier == "15530": // EndpointType - if _child, err = new(_EndpointType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15530): // EndpointType + if _child, err = new(_EndpointType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EndpointType for type-switch of ExtensionObjectDefinition") } - case identifier == "32423": // BitFieldDefinition - if _child, err = new(_BitFieldDefinition).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32423): // BitFieldDefinition + if _child, err = new(_BitFieldDefinition).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BitFieldDefinition for type-switch of ExtensionObjectDefinition") } - case identifier == "18808": // RationalNumber - if _child, err = new(_RationalNumber).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(18808): // RationalNumber + if _child, err = new(_RationalNumber).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RationalNumber for type-switch of ExtensionObjectDefinition") } - case identifier == "18809": // OpcuaVector - if _child, err = new(_OpcuaVector).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(18809): // OpcuaVector + if _child, err = new(_OpcuaVector).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaVector for type-switch of ExtensionObjectDefinition") } - case identifier == "18811": // CartesianCoordinates - if _child, err = new(_CartesianCoordinates).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(18811): // CartesianCoordinates + if _child, err = new(_CartesianCoordinates).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CartesianCoordinates for type-switch of ExtensionObjectDefinition") } - case identifier == "18813": // Orientation - if _child, err = new(_Orientation).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(18813): // Orientation + if _child, err = new(_Orientation).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Orientation for type-switch of ExtensionObjectDefinition") } - case identifier == "18815": // Frame - if _child, err = new(_Frame).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(18815): // Frame + if _child, err = new(_Frame).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Frame for type-switch of ExtensionObjectDefinition") } - case identifier == "15636": // IdentityMappingRuleType - if _child, err = new(_IdentityMappingRuleType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15636): // IdentityMappingRuleType + if _child, err = new(_IdentityMappingRuleType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type IdentityMappingRuleType for type-switch of ExtensionObjectDefinition") } - case identifier == "23500": // CurrencyUnitType - if _child, err = new(_CurrencyUnitType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(23500): // CurrencyUnitType + if _child, err = new(_CurrencyUnitType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CurrencyUnitType for type-switch of ExtensionObjectDefinition") } - case identifier == "32436": // AnnotationDataType - if _child, err = new(_AnnotationDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32436): // AnnotationDataType + if _child, err = new(_AnnotationDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AnnotationDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "32437": // LinearConversionDataType - if _child, err = new(_LinearConversionDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32437): // LinearConversionDataType + if _child, err = new(_LinearConversionDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type LinearConversionDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "32440": // QuantityDimension - if _child, err = new(_QuantityDimension).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32440): // QuantityDimension + if _child, err = new(_QuantityDimension).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QuantityDimension for type-switch of ExtensionObjectDefinition") } - case identifier == "12556": // TrustListDataType - if _child, err = new(_TrustListDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12556): // TrustListDataType + if _child, err = new(_TrustListDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TrustListDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "32287": // TransactionErrorType - if _child, err = new(_TransactionErrorType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32287): // TransactionErrorType + if _child, err = new(_TransactionErrorType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TransactionErrorType for type-switch of ExtensionObjectDefinition") } - case identifier == "15536": // DataTypeSchemaHeader - if _child, err = new(_DataTypeSchemaHeader).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15536): // DataTypeSchemaHeader + if _child, err = new(_DataTypeSchemaHeader).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataTypeSchemaHeader for type-switch of ExtensionObjectDefinition") } - case identifier == "14527": // DataTypeDescription - if _child, err = new(_DataTypeDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(14527): // DataTypeDescription + if _child, err = new(_DataTypeDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataTypeDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "24107": // PortableQualifiedName - if _child, err = new(_PortableQualifiedName).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15489): // StructureDescription + if _child, err = new(_StructureDescription).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type StructureDescription for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15490): // EnumDescription + if _child, err = new(_EnumDescription).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EnumDescription for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15007): // SimpleTypeDescription + if _child, err = new(_SimpleTypeDescription).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type SimpleTypeDescription for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15008): // UABinaryFileDataType + if _child, err = new(_UABinaryFileDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UABinaryFileDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(24107): // PortableQualifiedName + if _child, err = new(_PortableQualifiedName).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PortableQualifiedName for type-switch of ExtensionObjectDefinition") } - case identifier == "24109": // UnsignedRationalNumber - if _child, err = new(_UnsignedRationalNumber).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(24108): // PortableNodeId + if _child, err = new(_PortableNodeId).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PortableNodeId for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(24109): // UnsignedRationalNumber + if _child, err = new(_UnsignedRationalNumber).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type UnsignedRationalNumber for type-switch of ExtensionObjectDefinition") } - case identifier == "14526": // FieldMetaData - if _child, err = new(_FieldMetaData).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(14525): // DataSetMetaDataType + if _child, err = new(_DataSetMetaDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DataSetMetaDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(14526): // FieldMetaData + if _child, err = new(_FieldMetaData).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FieldMetaData for type-switch of ExtensionObjectDefinition") } - case identifier == "14595": // ConfigurationVersionDataType - if _child, err = new(_ConfigurationVersionDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(14595): // ConfigurationVersionDataType + if _child, err = new(_ConfigurationVersionDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ConfigurationVersionDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15582": // PublishedDataSetSourceDataType - if _child, err = new(_PublishedDataSetSourceDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15580): // PublishedDataSetDataType + if _child, err = new(_PublishedDataSetDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PublishedDataSetDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15582): // PublishedDataSetSourceDataType + if _child, err = new(_PublishedDataSetSourceDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PublishedDataSetSourceDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "14275": // PublishedVariableDataType - if _child, err = new(_PublishedVariableDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(14275): // PublishedVariableDataType + if _child, err = new(_PublishedVariableDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PublishedVariableDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15599": // DataSetWriterDataType - if _child, err = new(_DataSetWriterDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15583): // PublishedDataItemsDataType + if _child, err = new(_PublishedDataItemsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PublishedDataItemsDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15584): // PublishedEventsDataType + if _child, err = new(_PublishedEventsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PublishedEventsDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(25271): // PublishedDataSetCustomSourceDataType + if _child, err = new(_PublishedDataSetCustomSourceDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PublishedDataSetCustomSourceDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15599): // DataSetWriterDataType + if _child, err = new(_DataSetWriterDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataSetWriterDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15600": // DataSetWriterTransportDataType - if _child, err = new(_DataSetWriterTransportDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15600): // DataSetWriterTransportDataType + if _child, err = new(_DataSetWriterTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataSetWriterTransportDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15607": // DataSetWriterMessageDataType - if _child, err = new(_DataSetWriterMessageDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15607): // DataSetWriterMessageDataType + if _child, err = new(_DataSetWriterMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataSetWriterMessageDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15611": // PubSubGroupDataType - if _child, err = new(_PubSubGroupDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15611): // PubSubGroupDataType + if _child, err = new(_PubSubGroupDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PubSubGroupDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15613": // WriterGroupTransportDataType - if _child, err = new(_WriterGroupTransportDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15482): // WriterGroupDataType + if _child, err = new(_WriterGroupDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type WriterGroupDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15613): // WriterGroupTransportDataType + if _child, err = new(_WriterGroupTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type WriterGroupTransportDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15618": // WriterGroupMessageDataType - if _child, err = new(_WriterGroupMessageDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15618): // WriterGroupMessageDataType + if _child, err = new(_WriterGroupMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type WriterGroupMessageDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15619": // PubSubConnectionDataType - if _child, err = new(_PubSubConnectionDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15619): // PubSubConnectionDataType + if _child, err = new(_PubSubConnectionDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PubSubConnectionDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15620": // ConnectionTransportDataType - if _child, err = new(_ConnectionTransportDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15620): // ConnectionTransportDataType + if _child, err = new(_ConnectionTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ConnectionTransportDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15504": // NetworkAddressDataType - if _child, err = new(_NetworkAddressDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15504): // NetworkAddressDataType + if _child, err = new(_NetworkAddressDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NetworkAddressDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15623": // ReaderGroupTransportDataType - if _child, err = new(_ReaderGroupTransportDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15512): // NetworkAddressUrlDataType + if _child, err = new(_NetworkAddressUrlDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type NetworkAddressUrlDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15522): // ReaderGroupDataType + if _child, err = new(_ReaderGroupDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReaderGroupDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15623): // ReaderGroupTransportDataType + if _child, err = new(_ReaderGroupTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReaderGroupTransportDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15624": // ReaderGroupMessageDataType - if _child, err = new(_ReaderGroupMessageDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15624): // ReaderGroupMessageDataType + if _child, err = new(_ReaderGroupMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReaderGroupMessageDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15630": // DataSetReaderTransportDataType - if _child, err = new(_DataSetReaderTransportDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15625): // DataSetReaderDataType + if _child, err = new(_DataSetReaderDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DataSetReaderDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15630): // DataSetReaderTransportDataType + if _child, err = new(_DataSetReaderTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataSetReaderTransportDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15631": // DataSetReaderMessageDataType - if _child, err = new(_DataSetReaderMessageDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15631): // DataSetReaderMessageDataType + if _child, err = new(_DataSetReaderMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataSetReaderMessageDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15632": // SubscribedDataSetDataType - if _child, err = new(_SubscribedDataSetDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15632): // SubscribedDataSetDataType + if _child, err = new(_SubscribedDataSetDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SubscribedDataSetDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "14746": // FieldTargetDataType - if _child, err = new(_FieldTargetDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15633): // TargetVariablesDataType + if _child, err = new(_TargetVariablesDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type TargetVariablesDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(14746): // FieldTargetDataType + if _child, err = new(_FieldTargetDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FieldTargetDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "15532": // PubSubConfigurationDataType - if _child, err = new(_PubSubConfigurationDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15637): // SubscribedDataSetMirrorDataType + if _child, err = new(_SubscribedDataSetMirrorDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type SubscribedDataSetMirrorDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15532): // PubSubConfigurationDataType + if _child, err = new(_PubSubConfigurationDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PubSubConfigurationDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "23603": // SecurityGroupDataType - if _child, err = new(_SecurityGroupDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(23601): // StandaloneSubscribedDataSetRefDataType + if _child, err = new(_StandaloneSubscribedDataSetRefDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type StandaloneSubscribedDataSetRefDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23602): // StandaloneSubscribedDataSetDataType + if _child, err = new(_StandaloneSubscribedDataSetDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type StandaloneSubscribedDataSetDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23603): // SecurityGroupDataType + if _child, err = new(_SecurityGroupDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SecurityGroupDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "25272": // PubSubKeyPushTargetDataType - if _child, err = new(_PubSubKeyPushTargetDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(25272): // PubSubKeyPushTargetDataType + if _child, err = new(_PubSubKeyPushTargetDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PubSubKeyPushTargetDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "23605": // QosDataType - if _child, err = new(_QosDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(23604): // PubSubConfiguration2DataType + if _child, err = new(_PubSubConfiguration2DataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PubSubConfiguration2DataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15647): // UadpWriterGroupMessageDataType + if _child, err = new(_UadpWriterGroupMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UadpWriterGroupMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15654): // UadpDataSetWriterMessageDataType + if _child, err = new(_UadpDataSetWriterMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UadpDataSetWriterMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15655): // UadpDataSetReaderMessageDataType + if _child, err = new(_UadpDataSetReaderMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UadpDataSetReaderMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15659): // JsonWriterGroupMessageDataType + if _child, err = new(_JsonWriterGroupMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type JsonWriterGroupMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15666): // JsonDataSetWriterMessageDataType + if _child, err = new(_JsonDataSetWriterMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type JsonDataSetWriterMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15667): // JsonDataSetReaderMessageDataType + if _child, err = new(_JsonDataSetReaderMessageDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type JsonDataSetReaderMessageDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23605): // QosDataType + if _child, err = new(_QosDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QosDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "25521": // PubSubConfigurationRefDataType - if _child, err = new(_PubSubConfigurationRefDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(23606): // TransmitQosDataType + if _child, err = new(_TransmitQosDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type TransmitQosDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23607): // TransmitQosPriorityDataType + if _child, err = new(_TransmitQosPriorityDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type TransmitQosPriorityDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23610): // ReceiveQosDataType + if _child, err = new(_ReceiveQosDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReceiveQosDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23611): // ReceiveQosPriorityDataType + if _child, err = new(_ReceiveQosPriorityDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReceiveQosPriorityDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(17469): // DatagramConnectionTransportDataType + if _child, err = new(_DatagramConnectionTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DatagramConnectionTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23614): // DatagramConnectionTransport2DataType + if _child, err = new(_DatagramConnectionTransport2DataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DatagramConnectionTransport2DataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15534): // DatagramWriterGroupTransportDataType + if _child, err = new(_DatagramWriterGroupTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DatagramWriterGroupTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23615): // DatagramWriterGroupTransport2DataType + if _child, err = new(_DatagramWriterGroupTransport2DataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DatagramWriterGroupTransport2DataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23616): // DatagramDataSetReaderTransportDataType + if _child, err = new(_DatagramDataSetReaderTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DatagramDataSetReaderTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15009): // BrokerConnectionTransportDataType + if _child, err = new(_BrokerConnectionTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type BrokerConnectionTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15669): // BrokerWriterGroupTransportDataType + if _child, err = new(_BrokerWriterGroupTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type BrokerWriterGroupTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15671): // BrokerDataSetWriterTransportDataType + if _child, err = new(_BrokerDataSetWriterTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type BrokerDataSetWriterTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(15672): // BrokerDataSetReaderTransportDataType + if _child, err = new(_BrokerDataSetReaderTransportDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type BrokerDataSetReaderTransportDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(25521): // PubSubConfigurationRefDataType + if _child, err = new(_PubSubConfigurationRefDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PubSubConfigurationRefDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "23470": // AliasNameDataType - if _child, err = new(_AliasNameDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(25522): // PubSubConfigurationValueDataType + if _child, err = new(_PubSubConfigurationValueDataType).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type PubSubConfigurationValueDataType for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23470): // AliasNameDataType + if _child, err = new(_AliasNameDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AliasNameDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "24283": // UserManagementDataType - if _child, err = new(_UserManagementDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(24283): // UserManagementDataType + if _child, err = new(_UserManagementDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type UserManagementDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "25222": // PriorityMappingEntryType - if _child, err = new(_PriorityMappingEntryType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(25222): // PriorityMappingEntryType + if _child, err = new(_PriorityMappingEntryType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PriorityMappingEntryType for type-switch of ExtensionObjectDefinition") } - case identifier == "32661": // ReferenceDescriptionDataType - if _child, err = new(_ReferenceDescriptionDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32661): // ReferenceDescriptionDataType + if _child, err = new(_ReferenceDescriptionDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReferenceDescriptionDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "32662": // ReferenceListEntryDataType - if _child, err = new(_ReferenceListEntryDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32662): // ReferenceListEntryDataType + if _child, err = new(_ReferenceListEntryDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReferenceListEntryDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "98": // RolePermissionType - if _child, err = new(_RolePermissionType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(98): // RolePermissionType + if _child, err = new(_RolePermissionType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RolePermissionType for type-switch of ExtensionObjectDefinition") } - case identifier == "99": // DataTypeDefinition - if _child, err = new(_DataTypeDefinition).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(99): // DataTypeDefinition + if _child, err = new(_DataTypeDefinition).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DataTypeDefinition for type-switch of ExtensionObjectDefinition") } - case identifier == "103": // StructureField - if _child, err = new(_StructureField).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(103): // StructureField + if _child, err = new(_StructureField).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type StructureField for type-switch of ExtensionObjectDefinition") } - case identifier == "298": // Argument - if _child, err = new(_Argument).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(101): // StructureDefinition + if _child, err = new(_StructureDefinition).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type StructureDefinition for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(102): // EnumDefinition + if _child, err = new(_EnumDefinition).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EnumDefinition for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(298): // Argument + if _child, err = new(_Argument).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Argument for type-switch of ExtensionObjectDefinition") } - case identifier == "7596": // EnumValueType - if _child, err = new(_EnumValueType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(7596): // EnumValueType + if _child, err = new(_EnumValueType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EnumValueType for type-switch of ExtensionObjectDefinition") } - case identifier == "12757": // OptionSet - if _child, err = new(_OptionSet).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(104): // EnumField + if _child, err = new(_EnumField).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EnumField for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(12757): // OptionSet + if _child, err = new(_OptionSet).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OptionSet for type-switch of ExtensionObjectDefinition") } - case identifier == "8914": // TimeZoneDataType - if _child, err = new(_TimeZoneDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(8914): // TimeZoneDataType + if _child, err = new(_TimeZoneDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TimeZoneDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "310": // ApplicationDescription - if _child, err = new(_ApplicationDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(310): // ApplicationDescription + if _child, err = new(_ApplicationDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ApplicationDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "391": // RequestHeader - if _child, err = new(_RequestHeader).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(391): // RequestHeader + if _child, err = new(_RequestHeader).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RequestHeader for type-switch of ExtensionObjectDefinition") } - case identifier == "394": // ResponseHeader - if _child, err = new(_ResponseHeader).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(394): // ResponseHeader + if _child, err = new(_ResponseHeader).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ResponseHeader for type-switch of ExtensionObjectDefinition") } - case identifier == "397": // ServiceFault - if _child, err = new(_ServiceFault).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(397): // ServiceFault + if _child, err = new(_ServiceFault).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ServiceFault for type-switch of ExtensionObjectDefinition") } - case identifier == "15903": // SessionlessInvokeRequestType - if _child, err = new(_SessionlessInvokeRequestType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(15903): // SessionlessInvokeRequestType + if _child, err = new(_SessionlessInvokeRequestType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SessionlessInvokeRequestType for type-switch of ExtensionObjectDefinition") } - case identifier == "21001": // SessionlessInvokeResponseType - if _child, err = new(_SessionlessInvokeResponseType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(21001): // SessionlessInvokeResponseType + if _child, err = new(_SessionlessInvokeResponseType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SessionlessInvokeResponseType for type-switch of ExtensionObjectDefinition") } - case identifier == "422": // FindServersRequest - if _child, err = new(_FindServersRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(422): // FindServersRequest + if _child, err = new(_FindServersRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FindServersRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "425": // FindServersResponse - if _child, err = new(_FindServersResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(425): // FindServersResponse + if _child, err = new(_FindServersResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FindServersResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "12191": // ServerOnNetwork - if _child, err = new(_ServerOnNetwork).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12191): // ServerOnNetwork + if _child, err = new(_ServerOnNetwork).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ServerOnNetwork for type-switch of ExtensionObjectDefinition") } - case identifier == "12192": // FindServersOnNetworkRequest - if _child, err = new(_FindServersOnNetworkRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12192): // FindServersOnNetworkRequest + if _child, err = new(_FindServersOnNetworkRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FindServersOnNetworkRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "12193": // FindServersOnNetworkResponse - if _child, err = new(_FindServersOnNetworkResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12193): // FindServersOnNetworkResponse + if _child, err = new(_FindServersOnNetworkResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FindServersOnNetworkResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "306": // UserTokenPolicy - if _child, err = new(_UserTokenPolicy).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(306): // UserTokenPolicy + if _child, err = new(_UserTokenPolicy).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type UserTokenPolicy for type-switch of ExtensionObjectDefinition") } - case identifier == "314": // EndpointDescription - if _child, err = new(_EndpointDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(314): // EndpointDescription + if _child, err = new(_EndpointDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EndpointDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "428": // GetEndpointsRequest - if _child, err = new(_GetEndpointsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(428): // GetEndpointsRequest + if _child, err = new(_GetEndpointsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type GetEndpointsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "431": // GetEndpointsResponse - if _child, err = new(_GetEndpointsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(431): // GetEndpointsResponse + if _child, err = new(_GetEndpointsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type GetEndpointsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "434": // RegisteredServer - if _child, err = new(_RegisteredServer).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(434): // RegisteredServer + if _child, err = new(_RegisteredServer).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisteredServer for type-switch of ExtensionObjectDefinition") } - case identifier == "437": // RegisterServerRequest - if _child, err = new(_RegisterServerRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(437): // RegisterServerRequest + if _child, err = new(_RegisterServerRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterServerRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "440": // RegisterServerResponse - if _child, err = new(_RegisterServerResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(440): // RegisterServerResponse + if _child, err = new(_RegisterServerResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterServerResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "12892": // DiscoveryConfiguration - if _child, err = new(_DiscoveryConfiguration).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12892): // DiscoveryConfiguration + if _child, err = new(_DiscoveryConfiguration).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DiscoveryConfiguration for type-switch of ExtensionObjectDefinition") } - case identifier == "12195": // RegisterServer2Request - if _child, err = new(_RegisterServer2Request).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12893): // MdnsDiscoveryConfiguration + if _child, err = new(_MdnsDiscoveryConfiguration).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type MdnsDiscoveryConfiguration for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(12195): // RegisterServer2Request + if _child, err = new(_RegisterServer2Request).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterServer2Request for type-switch of ExtensionObjectDefinition") } - case identifier == "12196": // RegisterServer2Response - if _child, err = new(_RegisterServer2Response).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12196): // RegisterServer2Response + if _child, err = new(_RegisterServer2Response).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterServer2Response for type-switch of ExtensionObjectDefinition") } - case identifier == "443": // ChannelSecurityToken - if _child, err = new(_ChannelSecurityToken).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(443): // ChannelSecurityToken + if _child, err = new(_ChannelSecurityToken).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ChannelSecurityToken for type-switch of ExtensionObjectDefinition") } - case identifier == "446": // OpenSecureChannelRequest - if _child, err = new(_OpenSecureChannelRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(446): // OpenSecureChannelRequest + if _child, err = new(_OpenSecureChannelRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpenSecureChannelRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "449": // OpenSecureChannelResponse - if _child, err = new(_OpenSecureChannelResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(449): // OpenSecureChannelResponse + if _child, err = new(_OpenSecureChannelResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpenSecureChannelResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "452": // CloseSecureChannelRequest - if _child, err = new(_CloseSecureChannelRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(452): // CloseSecureChannelRequest + if _child, err = new(_CloseSecureChannelRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CloseSecureChannelRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "455": // CloseSecureChannelResponse - if _child, err = new(_CloseSecureChannelResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(455): // CloseSecureChannelResponse + if _child, err = new(_CloseSecureChannelResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CloseSecureChannelResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "346": // SignedSoftwareCertificate - if _child, err = new(_SignedSoftwareCertificate).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(346): // SignedSoftwareCertificate + if _child, err = new(_SignedSoftwareCertificate).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SignedSoftwareCertificate for type-switch of ExtensionObjectDefinition") } - case identifier == "458": // SignatureData - if _child, err = new(_SignatureData).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(458): // SignatureData + if _child, err = new(_SignatureData).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SignatureData for type-switch of ExtensionObjectDefinition") } - case identifier == "461": // CreateSessionRequest - if _child, err = new(_CreateSessionRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(461): // CreateSessionRequest + if _child, err = new(_CreateSessionRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateSessionRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "464": // CreateSessionResponse - if _child, err = new(_CreateSessionResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(464): // CreateSessionResponse + if _child, err = new(_CreateSessionResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateSessionResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "467": // ActivateSessionRequest - if _child, err = new(_ActivateSessionRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(318): // UserIdentityToken + if _child, err = new(_UserIdentityToken).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UserIdentityToken for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(321): // AnonymousIdentityToken + if _child, err = new(_AnonymousIdentityToken).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type AnonymousIdentityToken for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(324): // UserNameIdentityToken + if _child, err = new(_UserNameIdentityToken).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UserNameIdentityToken for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(327): // X509IdentityToken + if _child, err = new(_X509IdentityToken).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type X509IdentityToken for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(940): // IssuedIdentityToken + if _child, err = new(_IssuedIdentityToken).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type IssuedIdentityToken for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(467): // ActivateSessionRequest + if _child, err = new(_ActivateSessionRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ActivateSessionRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "470": // ActivateSessionResponse - if _child, err = new(_ActivateSessionResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(470): // ActivateSessionResponse + if _child, err = new(_ActivateSessionResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ActivateSessionResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "473": // CloseSessionRequest - if _child, err = new(_CloseSessionRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(473): // CloseSessionRequest + if _child, err = new(_CloseSessionRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CloseSessionRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "476": // CloseSessionResponse - if _child, err = new(_CloseSessionResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(476): // CloseSessionResponse + if _child, err = new(_CloseSessionResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CloseSessionResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "479": // CancelRequest - if _child, err = new(_CancelRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(479): // CancelRequest + if _child, err = new(_CancelRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CancelRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "482": // CancelResponse - if _child, err = new(_CancelResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(482): // CancelResponse + if _child, err = new(_CancelResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CancelResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "351": // NodeAttributes - if _child, err = new(_NodeAttributes).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(351): // NodeAttributes + if _child, err = new(_NodeAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NodeAttributes for type-switch of ExtensionObjectDefinition") } - case identifier == "17608": // GenericAttributeValue - if _child, err = new(_GenericAttributeValue).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(354): // ObjectAttributes + if _child, err = new(_ObjectAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ObjectAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(357): // VariableAttributes + if _child, err = new(_VariableAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type VariableAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(360): // MethodAttributes + if _child, err = new(_MethodAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type MethodAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(363): // ObjectTypeAttributes + if _child, err = new(_ObjectTypeAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ObjectTypeAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(366): // VariableTypeAttributes + if _child, err = new(_VariableTypeAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type VariableTypeAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(369): // ReferenceTypeAttributes + if _child, err = new(_ReferenceTypeAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReferenceTypeAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(372): // DataTypeAttributes + if _child, err = new(_DataTypeAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DataTypeAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(375): // ViewAttributes + if _child, err = new(_ViewAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ViewAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(17608): // GenericAttributeValue + if _child, err = new(_GenericAttributeValue).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type GenericAttributeValue for type-switch of ExtensionObjectDefinition") } - case identifier == "378": // AddNodesItem - if _child, err = new(_AddNodesItem).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(17609): // GenericAttributes + if _child, err = new(_GenericAttributes).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type GenericAttributes for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(378): // AddNodesItem + if _child, err = new(_AddNodesItem).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddNodesItem for type-switch of ExtensionObjectDefinition") } - case identifier == "485": // AddNodesResult - if _child, err = new(_AddNodesResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(485): // AddNodesResult + if _child, err = new(_AddNodesResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddNodesResult for type-switch of ExtensionObjectDefinition") } - case identifier == "488": // AddNodesRequest - if _child, err = new(_AddNodesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(488): // AddNodesRequest + if _child, err = new(_AddNodesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddNodesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "491": // AddNodesResponse - if _child, err = new(_AddNodesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(491): // AddNodesResponse + if _child, err = new(_AddNodesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddNodesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "381": // AddReferencesItem - if _child, err = new(_AddReferencesItem).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(381): // AddReferencesItem + if _child, err = new(_AddReferencesItem).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddReferencesItem for type-switch of ExtensionObjectDefinition") } - case identifier == "494": // AddReferencesRequest - if _child, err = new(_AddReferencesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(494): // AddReferencesRequest + if _child, err = new(_AddReferencesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddReferencesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "497": // AddReferencesResponse - if _child, err = new(_AddReferencesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(497): // AddReferencesResponse + if _child, err = new(_AddReferencesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AddReferencesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "384": // DeleteNodesItem - if _child, err = new(_DeleteNodesItem).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(384): // DeleteNodesItem + if _child, err = new(_DeleteNodesItem).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteNodesItem for type-switch of ExtensionObjectDefinition") } - case identifier == "500": // DeleteNodesRequest - if _child, err = new(_DeleteNodesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(500): // DeleteNodesRequest + if _child, err = new(_DeleteNodesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteNodesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "503": // DeleteNodesResponse - if _child, err = new(_DeleteNodesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(503): // DeleteNodesResponse + if _child, err = new(_DeleteNodesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteNodesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "387": // DeleteReferencesItem - if _child, err = new(_DeleteReferencesItem).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(387): // DeleteReferencesItem + if _child, err = new(_DeleteReferencesItem).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteReferencesItem for type-switch of ExtensionObjectDefinition") } - case identifier == "506": // DeleteReferencesRequest - if _child, err = new(_DeleteReferencesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(506): // DeleteReferencesRequest + if _child, err = new(_DeleteReferencesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteReferencesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "509": // DeleteReferencesResponse - if _child, err = new(_DeleteReferencesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(509): // DeleteReferencesResponse + if _child, err = new(_DeleteReferencesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteReferencesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "513": // ViewDescription - if _child, err = new(_ViewDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(513): // ViewDescription + if _child, err = new(_ViewDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ViewDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "516": // BrowseDescription - if _child, err = new(_BrowseDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(516): // BrowseDescription + if _child, err = new(_BrowseDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "520": // ReferenceDescription - if _child, err = new(_ReferenceDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(520): // ReferenceDescription + if _child, err = new(_ReferenceDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReferenceDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "524": // BrowseResult - if _child, err = new(_BrowseResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(524): // BrowseResult + if _child, err = new(_BrowseResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseResult for type-switch of ExtensionObjectDefinition") } - case identifier == "527": // BrowseRequest - if _child, err = new(_BrowseRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(527): // BrowseRequest + if _child, err = new(_BrowseRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "530": // BrowseResponse - if _child, err = new(_BrowseResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(530): // BrowseResponse + if _child, err = new(_BrowseResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "533": // BrowseNextRequest - if _child, err = new(_BrowseNextRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(533): // BrowseNextRequest + if _child, err = new(_BrowseNextRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseNextRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "536": // BrowseNextResponse - if _child, err = new(_BrowseNextResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(536): // BrowseNextResponse + if _child, err = new(_BrowseNextResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowseNextResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "539": // RelativePathElement - if _child, err = new(_RelativePathElement).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(539): // RelativePathElement + if _child, err = new(_RelativePathElement).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RelativePathElement for type-switch of ExtensionObjectDefinition") } - case identifier == "542": // RelativePath - if _child, err = new(_RelativePath).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(542): // RelativePath + if _child, err = new(_RelativePath).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RelativePath for type-switch of ExtensionObjectDefinition") } - case identifier == "545": // BrowsePath - if _child, err = new(_BrowsePath).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(545): // BrowsePath + if _child, err = new(_BrowsePath).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowsePath for type-switch of ExtensionObjectDefinition") } - case identifier == "548": // BrowsePathTarget - if _child, err = new(_BrowsePathTarget).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(548): // BrowsePathTarget + if _child, err = new(_BrowsePathTarget).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowsePathTarget for type-switch of ExtensionObjectDefinition") } - case identifier == "551": // BrowsePathResult - if _child, err = new(_BrowsePathResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(551): // BrowsePathResult + if _child, err = new(_BrowsePathResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BrowsePathResult for type-switch of ExtensionObjectDefinition") } - case identifier == "554": // TranslateBrowsePathsToNodeIdsRequest - if _child, err = new(_TranslateBrowsePathsToNodeIdsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(554): // TranslateBrowsePathsToNodeIdsRequest + if _child, err = new(_TranslateBrowsePathsToNodeIdsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TranslateBrowsePathsToNodeIdsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "557": // TranslateBrowsePathsToNodeIdsResponse - if _child, err = new(_TranslateBrowsePathsToNodeIdsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(557): // TranslateBrowsePathsToNodeIdsResponse + if _child, err = new(_TranslateBrowsePathsToNodeIdsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TranslateBrowsePathsToNodeIdsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "560": // RegisterNodesRequest - if _child, err = new(_RegisterNodesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(560): // RegisterNodesRequest + if _child, err = new(_RegisterNodesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterNodesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "563": // RegisterNodesResponse - if _child, err = new(_RegisterNodesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(563): // RegisterNodesResponse + if _child, err = new(_RegisterNodesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RegisterNodesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "566": // UnregisterNodesRequest - if _child, err = new(_UnregisterNodesRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(566): // UnregisterNodesRequest + if _child, err = new(_UnregisterNodesRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type UnregisterNodesRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "569": // UnregisterNodesResponse - if _child, err = new(_UnregisterNodesResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(569): // UnregisterNodesResponse + if _child, err = new(_UnregisterNodesResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type UnregisterNodesResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "333": // EndpointConfiguration - if _child, err = new(_EndpointConfiguration).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(333): // EndpointConfiguration + if _child, err = new(_EndpointConfiguration).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EndpointConfiguration for type-switch of ExtensionObjectDefinition") } - case identifier == "572": // QueryDataDescription - if _child, err = new(_QueryDataDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(572): // QueryDataDescription + if _child, err = new(_QueryDataDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryDataDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "575": // NodeTypeDescription - if _child, err = new(_NodeTypeDescription).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(575): // NodeTypeDescription + if _child, err = new(_NodeTypeDescription).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NodeTypeDescription for type-switch of ExtensionObjectDefinition") } - case identifier == "579": // QueryDataSet - if _child, err = new(_QueryDataSet).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(579): // QueryDataSet + if _child, err = new(_QueryDataSet).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryDataSet for type-switch of ExtensionObjectDefinition") } - case identifier == "582": // NodeReference - if _child, err = new(_NodeReference).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(582): // NodeReference + if _child, err = new(_NodeReference).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NodeReference for type-switch of ExtensionObjectDefinition") } - case identifier == "585": // ContentFilterElement - if _child, err = new(_ContentFilterElement).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(585): // ContentFilterElement + if _child, err = new(_ContentFilterElement).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ContentFilterElement for type-switch of ExtensionObjectDefinition") } - case identifier == "588": // ContentFilter - if _child, err = new(_ContentFilter).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(588): // ContentFilter + if _child, err = new(_ContentFilter).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ContentFilter for type-switch of ExtensionObjectDefinition") } - case identifier == "591": // FilterOperand - if _child, err = new(_FilterOperand).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(591): // FilterOperand + if _child, err = new(_FilterOperand).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type FilterOperand for type-switch of ExtensionObjectDefinition") } - case identifier == "606": // ContentFilterElementResult - if _child, err = new(_ContentFilterElementResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(594): // ElementOperand + if _child, err = new(_ElementOperand).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ElementOperand for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(597): // LiteralOperand + if _child, err = new(_LiteralOperand).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type LiteralOperand for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(600): // AttributeOperand + if _child, err = new(_AttributeOperand).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type AttributeOperand for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(603): // SimpleAttributeOperand + if _child, err = new(_SimpleAttributeOperand).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type SimpleAttributeOperand for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(606): // ContentFilterElementResult + if _child, err = new(_ContentFilterElementResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ContentFilterElementResult for type-switch of ExtensionObjectDefinition") } - case identifier == "609": // ContentFilterResult - if _child, err = new(_ContentFilterResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(609): // ContentFilterResult + if _child, err = new(_ContentFilterResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ContentFilterResult for type-switch of ExtensionObjectDefinition") } - case identifier == "612": // ParsingResult - if _child, err = new(_ParsingResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(612): // ParsingResult + if _child, err = new(_ParsingResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ParsingResult for type-switch of ExtensionObjectDefinition") } - case identifier == "615": // QueryFirstRequest - if _child, err = new(_QueryFirstRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(615): // QueryFirstRequest + if _child, err = new(_QueryFirstRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryFirstRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "618": // QueryFirstResponse - if _child, err = new(_QueryFirstResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(618): // QueryFirstResponse + if _child, err = new(_QueryFirstResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryFirstResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "621": // QueryNextRequest - if _child, err = new(_QueryNextRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(621): // QueryNextRequest + if _child, err = new(_QueryNextRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryNextRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "624": // QueryNextResponse - if _child, err = new(_QueryNextResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(624): // QueryNextResponse + if _child, err = new(_QueryNextResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type QueryNextResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "628": // ReadValueId - if _child, err = new(_ReadValueId).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(628): // ReadValueId + if _child, err = new(_ReadValueId).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReadValueId for type-switch of ExtensionObjectDefinition") } - case identifier == "631": // ReadRequest - if _child, err = new(_ReadRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(631): // ReadRequest + if _child, err = new(_ReadRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReadRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "634": // ReadResponse - if _child, err = new(_ReadResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(634): // ReadResponse + if _child, err = new(_ReadResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ReadResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "637": // HistoryReadValueId - if _child, err = new(_HistoryReadValueId).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(637): // HistoryReadValueId + if _child, err = new(_HistoryReadValueId).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryReadValueId for type-switch of ExtensionObjectDefinition") } - case identifier == "640": // HistoryReadResult - if _child, err = new(_HistoryReadResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(640): // HistoryReadResult + if _child, err = new(_HistoryReadResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryReadResult for type-switch of ExtensionObjectDefinition") } - case identifier == "643": // HistoryReadDetails - if _child, err = new(_HistoryReadDetails).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(643): // HistoryReadDetails + if _child, err = new(_HistoryReadDetails).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryReadDetails for type-switch of ExtensionObjectDefinition") } - case identifier == "658": // HistoryData - if _child, err = new(_HistoryData).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(646): // ReadEventDetails + if _child, err = new(_ReadEventDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadEventDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(32801): // ReadEventDetails2 + if _child, err = new(_ReadEventDetails2).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadEventDetails2 for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(649): // ReadRawModifiedDetails + if _child, err = new(_ReadRawModifiedDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadRawModifiedDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(652): // ReadProcessedDetails + if _child, err = new(_ReadProcessedDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadProcessedDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(655): // ReadAtTimeDetails + if _child, err = new(_ReadAtTimeDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadAtTimeDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(23499): // ReadAnnotationDataDetails + if _child, err = new(_ReadAnnotationDataDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type ReadAnnotationDataDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(658): // HistoryData + if _child, err = new(_HistoryData).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryData for type-switch of ExtensionObjectDefinition") } - case identifier == "11218": // ModificationInfo - if _child, err = new(_ModificationInfo).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(11218): // ModificationInfo + if _child, err = new(_ModificationInfo).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModificationInfo for type-switch of ExtensionObjectDefinition") } - case identifier == "661": // HistoryEvent - if _child, err = new(_HistoryEvent).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(11219): // HistoryModifiedData + if _child, err = new(_HistoryModifiedData).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type HistoryModifiedData for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(661): // HistoryEvent + if _child, err = new(_HistoryEvent).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryEvent for type-switch of ExtensionObjectDefinition") } - case identifier == "664": // HistoryReadRequest - if _child, err = new(_HistoryReadRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(32826): // HistoryModifiedEvent + if _child, err = new(_HistoryModifiedEvent).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type HistoryModifiedEvent for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(664): // HistoryReadRequest + if _child, err = new(_HistoryReadRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryReadRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "667": // HistoryReadResponse - if _child, err = new(_HistoryReadResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(667): // HistoryReadResponse + if _child, err = new(_HistoryReadResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryReadResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "670": // WriteValue - if _child, err = new(_WriteValue).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(670): // WriteValue + if _child, err = new(_WriteValue).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type WriteValue for type-switch of ExtensionObjectDefinition") } - case identifier == "673": // WriteRequest - if _child, err = new(_WriteRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(673): // WriteRequest + if _child, err = new(_WriteRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type WriteRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "676": // WriteResponse - if _child, err = new(_WriteResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(676): // WriteResponse + if _child, err = new(_WriteResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type WriteResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "679": // HistoryUpdateDetails - if _child, err = new(_HistoryUpdateDetails).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(679): // HistoryUpdateDetails + if _child, err = new(_HistoryUpdateDetails).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryUpdateDetails for type-switch of ExtensionObjectDefinition") } - case identifier == "697": // HistoryUpdateResult - if _child, err = new(_HistoryUpdateResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(682): // UpdateDataDetails + if _child, err = new(_UpdateDataDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UpdateDataDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(11297): // UpdateStructureDataDetails + if _child, err = new(_UpdateStructureDataDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UpdateStructureDataDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(685): // UpdateEventDetails + if _child, err = new(_UpdateEventDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type UpdateEventDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(688): // DeleteRawModifiedDetails + if _child, err = new(_DeleteRawModifiedDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DeleteRawModifiedDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(691): // DeleteAtTimeDetails + if _child, err = new(_DeleteAtTimeDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DeleteAtTimeDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(694): // DeleteEventDetails + if _child, err = new(_DeleteEventDetails).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DeleteEventDetails for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(697): // HistoryUpdateResult + if _child, err = new(_HistoryUpdateResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryUpdateResult for type-switch of ExtensionObjectDefinition") } - case identifier == "700": // HistoryUpdateRequest - if _child, err = new(_HistoryUpdateRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(700): // HistoryUpdateRequest + if _child, err = new(_HistoryUpdateRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryUpdateRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "703": // HistoryUpdateResponse - if _child, err = new(_HistoryUpdateResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(703): // HistoryUpdateResponse + if _child, err = new(_HistoryUpdateResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryUpdateResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "706": // CallMethodRequest - if _child, err = new(_CallMethodRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(706): // CallMethodRequest + if _child, err = new(_CallMethodRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CallMethodRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "709": // CallMethodResult - if _child, err = new(_CallMethodResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(709): // CallMethodResult + if _child, err = new(_CallMethodResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CallMethodResult for type-switch of ExtensionObjectDefinition") } - case identifier == "712": // CallRequest - if _child, err = new(_CallRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(712): // CallRequest + if _child, err = new(_CallRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CallRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "715": // CallResponse - if _child, err = new(_CallResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(715): // CallResponse + if _child, err = new(_CallResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CallResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "721": // MonitoringFilter - if _child, err = new(_MonitoringFilter).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(721): // MonitoringFilter + if _child, err = new(_MonitoringFilter).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoringFilter for type-switch of ExtensionObjectDefinition") } - case identifier == "950": // AggregateConfiguration - if _child, err = new(_AggregateConfiguration).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(724): // DataChangeFilter + if _child, err = new(_DataChangeFilter).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DataChangeFilter for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(727): // EventFilter + if _child, err = new(_EventFilter).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EventFilter for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(950): // AggregateConfiguration + if _child, err = new(_AggregateConfiguration).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AggregateConfiguration for type-switch of ExtensionObjectDefinition") } - case identifier == "733": // MonitoringFilterResult - if _child, err = new(_MonitoringFilterResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(730): // AggregateFilter + if _child, err = new(_AggregateFilter).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type AggregateFilter for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(733): // MonitoringFilterResult + if _child, err = new(_MonitoringFilterResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoringFilterResult for type-switch of ExtensionObjectDefinition") } - case identifier == "742": // MonitoringParameters - if _child, err = new(_MonitoringParameters).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(736): // EventFilterResult + if _child, err = new(_EventFilterResult).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EventFilterResult for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(739): // AggregateFilterResult + if _child, err = new(_AggregateFilterResult).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type AggregateFilterResult for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(742): // MonitoringParameters + if _child, err = new(_MonitoringParameters).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoringParameters for type-switch of ExtensionObjectDefinition") } - case identifier == "745": // MonitoredItemCreateRequest - if _child, err = new(_MonitoredItemCreateRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(745): // MonitoredItemCreateRequest + if _child, err = new(_MonitoredItemCreateRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoredItemCreateRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "748": // MonitoredItemCreateResult - if _child, err = new(_MonitoredItemCreateResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(748): // MonitoredItemCreateResult + if _child, err = new(_MonitoredItemCreateResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoredItemCreateResult for type-switch of ExtensionObjectDefinition") } - case identifier == "751": // CreateMonitoredItemsRequest - if _child, err = new(_CreateMonitoredItemsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(751): // CreateMonitoredItemsRequest + if _child, err = new(_CreateMonitoredItemsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateMonitoredItemsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "754": // CreateMonitoredItemsResponse - if _child, err = new(_CreateMonitoredItemsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(754): // CreateMonitoredItemsResponse + if _child, err = new(_CreateMonitoredItemsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateMonitoredItemsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "757": // MonitoredItemModifyRequest - if _child, err = new(_MonitoredItemModifyRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(757): // MonitoredItemModifyRequest + if _child, err = new(_MonitoredItemModifyRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoredItemModifyRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "760": // MonitoredItemModifyResult - if _child, err = new(_MonitoredItemModifyResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(760): // MonitoredItemModifyResult + if _child, err = new(_MonitoredItemModifyResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoredItemModifyResult for type-switch of ExtensionObjectDefinition") } - case identifier == "763": // ModifyMonitoredItemsRequest - if _child, err = new(_ModifyMonitoredItemsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(763): // ModifyMonitoredItemsRequest + if _child, err = new(_ModifyMonitoredItemsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModifyMonitoredItemsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "766": // ModifyMonitoredItemsResponse - if _child, err = new(_ModifyMonitoredItemsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(766): // ModifyMonitoredItemsResponse + if _child, err = new(_ModifyMonitoredItemsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModifyMonitoredItemsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "769": // SetMonitoringModeRequest - if _child, err = new(_SetMonitoringModeRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(769): // SetMonitoringModeRequest + if _child, err = new(_SetMonitoringModeRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetMonitoringModeRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "772": // SetMonitoringModeResponse - if _child, err = new(_SetMonitoringModeResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(772): // SetMonitoringModeResponse + if _child, err = new(_SetMonitoringModeResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetMonitoringModeResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "775": // SetTriggeringRequest - if _child, err = new(_SetTriggeringRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(775): // SetTriggeringRequest + if _child, err = new(_SetTriggeringRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetTriggeringRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "778": // SetTriggeringResponse - if _child, err = new(_SetTriggeringResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(778): // SetTriggeringResponse + if _child, err = new(_SetTriggeringResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetTriggeringResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "781": // DeleteMonitoredItemsRequest - if _child, err = new(_DeleteMonitoredItemsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(781): // DeleteMonitoredItemsRequest + if _child, err = new(_DeleteMonitoredItemsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteMonitoredItemsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "784": // DeleteMonitoredItemsResponse - if _child, err = new(_DeleteMonitoredItemsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(784): // DeleteMonitoredItemsResponse + if _child, err = new(_DeleteMonitoredItemsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteMonitoredItemsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "787": // CreateSubscriptionRequest - if _child, err = new(_CreateSubscriptionRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(787): // CreateSubscriptionRequest + if _child, err = new(_CreateSubscriptionRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateSubscriptionRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "790": // CreateSubscriptionResponse - if _child, err = new(_CreateSubscriptionResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(790): // CreateSubscriptionResponse + if _child, err = new(_CreateSubscriptionResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type CreateSubscriptionResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "793": // ModifySubscriptionRequest - if _child, err = new(_ModifySubscriptionRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(793): // ModifySubscriptionRequest + if _child, err = new(_ModifySubscriptionRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModifySubscriptionRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "796": // ModifySubscriptionResponse - if _child, err = new(_ModifySubscriptionResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(796): // ModifySubscriptionResponse + if _child, err = new(_ModifySubscriptionResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModifySubscriptionResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "799": // SetPublishingModeRequest - if _child, err = new(_SetPublishingModeRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(799): // SetPublishingModeRequest + if _child, err = new(_SetPublishingModeRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetPublishingModeRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "802": // SetPublishingModeResponse - if _child, err = new(_SetPublishingModeResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(802): // SetPublishingModeResponse + if _child, err = new(_SetPublishingModeResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SetPublishingModeResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "805": // NotificationMessage - if _child, err = new(_NotificationMessage).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(805): // NotificationMessage + if _child, err = new(_NotificationMessage).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NotificationMessage for type-switch of ExtensionObjectDefinition") } - case identifier == "947": // NotificationData - if _child, err = new(_NotificationData).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(947): // NotificationData + if _child, err = new(_NotificationData).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NotificationData for type-switch of ExtensionObjectDefinition") } - case identifier == "808": // MonitoredItemNotification - if _child, err = new(_MonitoredItemNotification).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(811): // DataChangeNotification + if _child, err = new(_DataChangeNotification).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type DataChangeNotification for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(808): // MonitoredItemNotification + if _child, err = new(_MonitoredItemNotification).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type MonitoredItemNotification for type-switch of ExtensionObjectDefinition") } - case identifier == "919": // EventFieldList - if _child, err = new(_EventFieldList).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(916): // EventNotificationList + if _child, err = new(_EventNotificationList).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type EventNotificationList for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(919): // EventFieldList + if _child, err = new(_EventFieldList).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EventFieldList for type-switch of ExtensionObjectDefinition") } - case identifier == "922": // HistoryEventFieldList - if _child, err = new(_HistoryEventFieldList).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(922): // HistoryEventFieldList + if _child, err = new(_HistoryEventFieldList).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type HistoryEventFieldList for type-switch of ExtensionObjectDefinition") } - case identifier == "823": // SubscriptionAcknowledgement - if _child, err = new(_SubscriptionAcknowledgement).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(820): // StatusChangeNotification + if _child, err = new(_StatusChangeNotification).parse(ctx, readBuffer, m, extensionId); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type StatusChangeNotification for type-switch of ExtensionObjectDefinition") + } + case extensionId == int32(823): // SubscriptionAcknowledgement + if _child, err = new(_SubscriptionAcknowledgement).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SubscriptionAcknowledgement for type-switch of ExtensionObjectDefinition") } - case identifier == "826": // PublishRequest - if _child, err = new(_PublishRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(826): // PublishRequest + if _child, err = new(_PublishRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PublishRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "829": // PublishResponse - if _child, err = new(_PublishResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(829): // PublishResponse + if _child, err = new(_PublishResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type PublishResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "832": // RepublishRequest - if _child, err = new(_RepublishRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(832): // RepublishRequest + if _child, err = new(_RepublishRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RepublishRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "835": // RepublishResponse - if _child, err = new(_RepublishResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(835): // RepublishResponse + if _child, err = new(_RepublishResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RepublishResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "838": // TransferResult - if _child, err = new(_TransferResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(838): // TransferResult + if _child, err = new(_TransferResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TransferResult for type-switch of ExtensionObjectDefinition") } - case identifier == "841": // TransferSubscriptionsRequest - if _child, err = new(_TransferSubscriptionsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(841): // TransferSubscriptionsRequest + if _child, err = new(_TransferSubscriptionsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TransferSubscriptionsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "844": // TransferSubscriptionsResponse - if _child, err = new(_TransferSubscriptionsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(844): // TransferSubscriptionsResponse + if _child, err = new(_TransferSubscriptionsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type TransferSubscriptionsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "847": // DeleteSubscriptionsRequest - if _child, err = new(_DeleteSubscriptionsRequest).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(847): // DeleteSubscriptionsRequest + if _child, err = new(_DeleteSubscriptionsRequest).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteSubscriptionsRequest for type-switch of ExtensionObjectDefinition") } - case identifier == "850": // DeleteSubscriptionsResponse - if _child, err = new(_DeleteSubscriptionsResponse).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(850): // DeleteSubscriptionsResponse + if _child, err = new(_DeleteSubscriptionsResponse).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DeleteSubscriptionsResponse for type-switch of ExtensionObjectDefinition") } - case identifier == "340": // BuildInfo - if _child, err = new(_BuildInfo).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(340): // BuildInfo + if _child, err = new(_BuildInfo).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BuildInfo for type-switch of ExtensionObjectDefinition") } - case identifier == "855": // RedundantServerDataType - if _child, err = new(_RedundantServerDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(855): // RedundantServerDataType + if _child, err = new(_RedundantServerDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type RedundantServerDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "11945": // EndpointUrlListDataType - if _child, err = new(_EndpointUrlListDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(11945): // EndpointUrlListDataType + if _child, err = new(_EndpointUrlListDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EndpointUrlListDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "11946": // NetworkGroupDataType - if _child, err = new(_NetworkGroupDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(11946): // NetworkGroupDataType + if _child, err = new(_NetworkGroupDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type NetworkGroupDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "858": // SamplingIntervalDiagnosticsDataType - if _child, err = new(_SamplingIntervalDiagnosticsDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(858): // SamplingIntervalDiagnosticsDataType + if _child, err = new(_SamplingIntervalDiagnosticsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SamplingIntervalDiagnosticsDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "861": // ServerDiagnosticsSummaryDataType - if _child, err = new(_ServerDiagnosticsSummaryDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(861): // ServerDiagnosticsSummaryDataType + if _child, err = new(_ServerDiagnosticsSummaryDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ServerDiagnosticsSummaryDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "864": // ServerStatusDataType - if _child, err = new(_ServerStatusDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(864): // ServerStatusDataType + if _child, err = new(_ServerStatusDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ServerStatusDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "867": // SessionDiagnosticsDataType - if _child, err = new(_SessionDiagnosticsDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(867): // SessionDiagnosticsDataType + if _child, err = new(_SessionDiagnosticsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SessionDiagnosticsDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "870": // SessionSecurityDiagnosticsDataType - if _child, err = new(_SessionSecurityDiagnosticsDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(870): // SessionSecurityDiagnosticsDataType + if _child, err = new(_SessionSecurityDiagnosticsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SessionSecurityDiagnosticsDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "873": // ServiceCounterDataType - if _child, err = new(_ServiceCounterDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(873): // ServiceCounterDataType + if _child, err = new(_ServiceCounterDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ServiceCounterDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "301": // StatusResult - if _child, err = new(_StatusResult).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(301): // StatusResult + if _child, err = new(_StatusResult).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type StatusResult for type-switch of ExtensionObjectDefinition") } - case identifier == "876": // SubscriptionDiagnosticsDataType - if _child, err = new(_SubscriptionDiagnosticsDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(876): // SubscriptionDiagnosticsDataType + if _child, err = new(_SubscriptionDiagnosticsDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SubscriptionDiagnosticsDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "879": // ModelChangeStructureDataType - if _child, err = new(_ModelChangeStructureDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(879): // ModelChangeStructureDataType + if _child, err = new(_ModelChangeStructureDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ModelChangeStructureDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "899": // SemanticChangeStructureDataType - if _child, err = new(_SemanticChangeStructureDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(899): // SemanticChangeStructureDataType + if _child, err = new(_SemanticChangeStructureDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type SemanticChangeStructureDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "886": // Range - if _child, err = new(_Range).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(886): // Range + if _child, err = new(_Range).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Range for type-switch of ExtensionObjectDefinition") } - case identifier == "889": // EUInformation - if _child, err = new(_EUInformation).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(889): // EUInformation + if _child, err = new(_EUInformation).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type EUInformation for type-switch of ExtensionObjectDefinition") } - case identifier == "12173": // ComplexNumberType - if _child, err = new(_ComplexNumberType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12173): // ComplexNumberType + if _child, err = new(_ComplexNumberType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ComplexNumberType for type-switch of ExtensionObjectDefinition") } - case identifier == "12174": // DoubleComplexNumberType - if _child, err = new(_DoubleComplexNumberType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12174): // DoubleComplexNumberType + if _child, err = new(_DoubleComplexNumberType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type DoubleComplexNumberType for type-switch of ExtensionObjectDefinition") } - case identifier == "12081": // AxisInformation - if _child, err = new(_AxisInformation).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12081): // AxisInformation + if _child, err = new(_AxisInformation).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type AxisInformation for type-switch of ExtensionObjectDefinition") } - case identifier == "12082": // XVType - if _child, err = new(_XVType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(12082): // XVType + if _child, err = new(_XVType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type XVType for type-switch of ExtensionObjectDefinition") } - case identifier == "896": // ProgramDiagnosticDataType - if _child, err = new(_ProgramDiagnosticDataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(896): // ProgramDiagnosticDataType + if _child, err = new(_ProgramDiagnosticDataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ProgramDiagnosticDataType for type-switch of ExtensionObjectDefinition") } - case identifier == "24035": // ProgramDiagnostic2DataType - if _child, err = new(_ProgramDiagnostic2DataType).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(24035): // ProgramDiagnostic2DataType + if _child, err = new(_ProgramDiagnostic2DataType).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ProgramDiagnostic2DataType for type-switch of ExtensionObjectDefinition") } - case identifier == "893": // Annotation - if _child, err = new(_Annotation).parse(ctx, readBuffer, m, identifier); err != nil { + case extensionId == int32(893): // Annotation + if _child, err = new(_Annotation).parse(ctx, readBuffer, m, extensionId); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type Annotation for type-switch of ExtensionObjectDefinition") } - case identifier == "811": // DataChangeNotification - if _child, err = new(_DataChangeNotification).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type DataChangeNotification for type-switch of ExtensionObjectDefinition") - } - case identifier == "916": // EventNotificationList - if _child, err = new(_EventNotificationList).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type EventNotificationList for type-switch of ExtensionObjectDefinition") - } - case identifier == "820": // StatusChangeNotification - if _child, err = new(_StatusChangeNotification).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type StatusChangeNotification for type-switch of ExtensionObjectDefinition") - } - case identifier == "316": // UserIdentityToken - if _child, err = new(_UserIdentityToken).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type UserIdentityToken for type-switch of ExtensionObjectDefinition") - } default: - return nil, errors.Errorf("Unmapped type for parameters [identifier=%v]", identifier) + return nil, errors.Errorf("Unmapped type for parameters [extensionId=%v]", extensionId) } if closeErr := readBuffer.CloseContext("ExtensionObjectDefinition"); closeErr != nil { diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensionObjectEncodingMask.go b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectEncodingMask.go index c414ac27777..7147286d427 100644 --- a/plc4go/protocols/opcua/readwrite/model/ExtensionObjectEncodingMask.go +++ b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectEncodingMask.go @@ -41,8 +41,8 @@ type ExtensionObjectEncodingMask interface { utils.Copyable // GetTypeIdSpecified returns TypeIdSpecified (property field) GetTypeIdSpecified() bool - // GetXmlbody returns Xmlbody (property field) - GetXmlbody() bool + // GetXmlBody returns XmlBody (property field) + GetXmlBody() bool // GetBinaryBody returns BinaryBody (property field) GetBinaryBody() bool // IsExtensionObjectEncodingMask is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -54,7 +54,7 @@ type ExtensionObjectEncodingMask interface { // _ExtensionObjectEncodingMask is the data-structure of this message type _ExtensionObjectEncodingMask struct { TypeIdSpecified bool - Xmlbody bool + XmlBody bool BinaryBody bool // Reserved Fields reservedField0 *int8 @@ -63,8 +63,8 @@ type _ExtensionObjectEncodingMask struct { var _ ExtensionObjectEncodingMask = (*_ExtensionObjectEncodingMask)(nil) // NewExtensionObjectEncodingMask factory function for _ExtensionObjectEncodingMask -func NewExtensionObjectEncodingMask(typeIdSpecified bool, xmlbody bool, binaryBody bool) *_ExtensionObjectEncodingMask { - return &_ExtensionObjectEncodingMask{TypeIdSpecified: typeIdSpecified, Xmlbody: xmlbody, BinaryBody: binaryBody} +func NewExtensionObjectEncodingMask(typeIdSpecified bool, xmlBody bool, binaryBody bool) *_ExtensionObjectEncodingMask { + return &_ExtensionObjectEncodingMask{TypeIdSpecified: typeIdSpecified, XmlBody: xmlBody, BinaryBody: binaryBody} } /////////////////////////////////////////////////////////// @@ -76,11 +76,11 @@ func NewExtensionObjectEncodingMask(typeIdSpecified bool, xmlbody bool, binaryBo type ExtensionObjectEncodingMaskBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(typeIdSpecified bool, xmlbody bool, binaryBody bool) ExtensionObjectEncodingMaskBuilder + WithMandatoryFields(typeIdSpecified bool, xmlBody bool, binaryBody bool) ExtensionObjectEncodingMaskBuilder // WithTypeIdSpecified adds TypeIdSpecified (property field) WithTypeIdSpecified(bool) ExtensionObjectEncodingMaskBuilder - // WithXmlbody adds Xmlbody (property field) - WithXmlbody(bool) ExtensionObjectEncodingMaskBuilder + // WithXmlBody adds XmlBody (property field) + WithXmlBody(bool) ExtensionObjectEncodingMaskBuilder // WithBinaryBody adds BinaryBody (property field) WithBinaryBody(bool) ExtensionObjectEncodingMaskBuilder // Build builds the ExtensionObjectEncodingMask or returns an error if something is wrong @@ -102,8 +102,8 @@ type _ExtensionObjectEncodingMaskBuilder struct { var _ (ExtensionObjectEncodingMaskBuilder) = (*_ExtensionObjectEncodingMaskBuilder)(nil) -func (b *_ExtensionObjectEncodingMaskBuilder) WithMandatoryFields(typeIdSpecified bool, xmlbody bool, binaryBody bool) ExtensionObjectEncodingMaskBuilder { - return b.WithTypeIdSpecified(typeIdSpecified).WithXmlbody(xmlbody).WithBinaryBody(binaryBody) +func (b *_ExtensionObjectEncodingMaskBuilder) WithMandatoryFields(typeIdSpecified bool, xmlBody bool, binaryBody bool) ExtensionObjectEncodingMaskBuilder { + return b.WithTypeIdSpecified(typeIdSpecified).WithXmlBody(xmlBody).WithBinaryBody(binaryBody) } func (b *_ExtensionObjectEncodingMaskBuilder) WithTypeIdSpecified(typeIdSpecified bool) ExtensionObjectEncodingMaskBuilder { @@ -111,8 +111,8 @@ func (b *_ExtensionObjectEncodingMaskBuilder) WithTypeIdSpecified(typeIdSpecifie return b } -func (b *_ExtensionObjectEncodingMaskBuilder) WithXmlbody(xmlbody bool) ExtensionObjectEncodingMaskBuilder { - b.Xmlbody = xmlbody +func (b *_ExtensionObjectEncodingMaskBuilder) WithXmlBody(xmlBody bool) ExtensionObjectEncodingMaskBuilder { + b.XmlBody = xmlBody return b } @@ -166,8 +166,8 @@ func (m *_ExtensionObjectEncodingMask) GetTypeIdSpecified() bool { return m.TypeIdSpecified } -func (m *_ExtensionObjectEncodingMask) GetXmlbody() bool { - return m.Xmlbody +func (m *_ExtensionObjectEncodingMask) GetXmlBody() bool { + return m.XmlBody } func (m *_ExtensionObjectEncodingMask) GetBinaryBody() bool { @@ -203,7 +203,7 @@ func (m *_ExtensionObjectEncodingMask) GetLengthInBits(ctx context.Context) uint // Simple field (typeIdSpecified) lengthInBits += 1 - // Simple field (xmlbody) + // Simple field (xmlBody) lengthInBits += 1 // Simple field (binaryBody) @@ -255,11 +255,11 @@ func (m *_ExtensionObjectEncodingMask) parse(ctx context.Context, readBuffer uti } m.TypeIdSpecified = typeIdSpecified - xmlbody, err := ReadSimpleField(ctx, "xmlbody", ReadBoolean(readBuffer)) + xmlBody, err := ReadSimpleField(ctx, "xmlBody", ReadBoolean(readBuffer)) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'xmlbody' field")) + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'xmlBody' field")) } - m.Xmlbody = xmlbody + m.XmlBody = xmlBody binaryBody, err := ReadSimpleField(ctx, "binaryBody", ReadBoolean(readBuffer)) if err != nil { @@ -299,8 +299,8 @@ func (m *_ExtensionObjectEncodingMask) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(err, "Error serializing 'typeIdSpecified' field") } - if err := WriteSimpleField[bool](ctx, "xmlbody", m.GetXmlbody(), WriteBoolean(writeBuffer)); err != nil { - return errors.Wrap(err, "Error serializing 'xmlbody' field") + if err := WriteSimpleField[bool](ctx, "xmlBody", m.GetXmlBody(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'xmlBody' field") } if err := WriteSimpleField[bool](ctx, "binaryBody", m.GetBinaryBody(), WriteBoolean(writeBuffer)); err != nil { @@ -325,7 +325,7 @@ func (m *_ExtensionObjectEncodingMask) deepCopy() *_ExtensionObjectEncodingMask } _ExtensionObjectEncodingMaskCopy := &_ExtensionObjectEncodingMask{ m.TypeIdSpecified, - m.Xmlbody, + m.XmlBody, m.BinaryBody, m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/ExtensionObjectWithMask.go b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectWithMask.go new file mode 100644 index 00000000000..b092ad4ec2d --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ExtensionObjectWithMask.go @@ -0,0 +1,444 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ExtensionObjectWithMask is the corresponding interface of ExtensionObjectWithMask +type ExtensionObjectWithMask interface { + ExtensionObjectWithMaskContract + ExtensionObjectWithMaskRequirements + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + // IsExtensionObjectWithMask is a marker method to prevent unintentional type checks (interfaces of same signature) + IsExtensionObjectWithMask() + // CreateBuilder creates a ExtensionObjectWithMaskBuilder + CreateExtensionObjectWithMaskBuilder() ExtensionObjectWithMaskBuilder +} + +// ExtensionObjectWithMaskContract provides a set of functions which can be overwritten by a sub struct +type ExtensionObjectWithMaskContract interface { + ExtensionObjectContract + // GetEncodingMask returns EncodingMask (property field) + GetEncodingMask() ExtensionObjectEncodingMask + // GetExtensionId() returns a parser argument + GetExtensionId() int32 + // GetIncludeEncodingMask returns IncludeEncodingMask (discriminator field) + GetIncludeEncodingMask() bool + // IsExtensionObjectWithMask is a marker method to prevent unintentional type checks (interfaces of same signature) + IsExtensionObjectWithMask() + // CreateBuilder creates a ExtensionObjectWithMaskBuilder + CreateExtensionObjectWithMaskBuilder() ExtensionObjectWithMaskBuilder +} + +// ExtensionObjectWithMaskRequirements provides a set of functions which need to be implemented by a sub struct +type ExtensionObjectWithMaskRequirements interface { + ExtensionObjectRequirements + GetLengthInBits(ctx context.Context) uint16 + GetLengthInBytes(ctx context.Context) uint16 +} + +// _ExtensionObjectWithMask is the data-structure of this message +type _ExtensionObjectWithMask struct { + ExtensionObjectContract + _SubType interface { + ExtensionObjectWithMaskContract + ExtensionObjectWithMaskRequirements + } + EncodingMask ExtensionObjectEncodingMask + + // Arguments. + ExtensionId int32 +} + +var _ ExtensionObjectWithMaskContract = (*_ExtensionObjectWithMask)(nil) + +// NewExtensionObjectWithMask factory function for _ExtensionObjectWithMask +func NewExtensionObjectWithMask(typeId ExpandedNodeId, encodingMask ExtensionObjectEncodingMask, extensionId int32) *_ExtensionObjectWithMask { + if encodingMask == nil { + panic("encodingMask of type ExtensionObjectEncodingMask for ExtensionObjectWithMask must not be nil") + } + _result := &_ExtensionObjectWithMask{ + ExtensionObjectContract: NewExtensionObject(typeId), + EncodingMask: encodingMask, + } + _result.ExtensionObjectContract.(*_ExtensionObject)._SubType = _result._SubType + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ExtensionObjectWithMaskBuilder is a builder for ExtensionObjectWithMask +type ExtensionObjectWithMaskBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(encodingMask ExtensionObjectEncodingMask) ExtensionObjectWithMaskBuilder + // WithEncodingMask adds EncodingMask (property field) + WithEncodingMask(ExtensionObjectEncodingMask) ExtensionObjectWithMaskBuilder + // WithEncodingMaskBuilder adds EncodingMask (property field) which is build by the builder + WithEncodingMaskBuilder(func(ExtensionObjectEncodingMaskBuilder) ExtensionObjectEncodingMaskBuilder) ExtensionObjectWithMaskBuilder + // AsBinaryExtensionObjectWithMask converts this build to a subType of ExtensionObjectWithMask. It is always possible to return to current builder using Done() + AsBinaryExtensionObjectWithMask() interface { + BinaryExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder + } + // AsNullExtensionObjectWithMask converts this build to a subType of ExtensionObjectWithMask. It is always possible to return to current builder using Done() + AsNullExtensionObjectWithMask() interface { + NullExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder + } + // Build builds the ExtensionObjectWithMask or returns an error if something is wrong + PartialBuild() (ExtensionObjectWithMaskContract, error) + // MustBuild does the same as Build but panics on error + PartialMustBuild() ExtensionObjectWithMaskContract + // Build builds the ExtensionObjectWithMask or returns an error if something is wrong + Build() (ExtensionObjectWithMask, error) + // MustBuild does the same as Build but panics on error + MustBuild() ExtensionObjectWithMask +} + +// NewExtensionObjectWithMaskBuilder() creates a ExtensionObjectWithMaskBuilder +func NewExtensionObjectWithMaskBuilder() ExtensionObjectWithMaskBuilder { + return &_ExtensionObjectWithMaskBuilder{_ExtensionObjectWithMask: new(_ExtensionObjectWithMask)} +} + +type _ExtensionObjectWithMaskChildBuilder interface { + utils.Copyable + setParent(ExtensionObjectWithMaskContract) + buildForExtensionObjectWithMask() (ExtensionObjectWithMask, error) +} + +type _ExtensionObjectWithMaskBuilder struct { + *_ExtensionObjectWithMask + + parentBuilder *_ExtensionObjectBuilder + + childBuilder _ExtensionObjectWithMaskChildBuilder + + err *utils.MultiError +} + +var _ (ExtensionObjectWithMaskBuilder) = (*_ExtensionObjectWithMaskBuilder)(nil) + +func (b *_ExtensionObjectWithMaskBuilder) setParent(contract ExtensionObjectContract) { + b.ExtensionObjectContract = contract +} + +func (b *_ExtensionObjectWithMaskBuilder) WithMandatoryFields(encodingMask ExtensionObjectEncodingMask) ExtensionObjectWithMaskBuilder { + return b.WithEncodingMask(encodingMask) +} + +func (b *_ExtensionObjectWithMaskBuilder) WithEncodingMask(encodingMask ExtensionObjectEncodingMask) ExtensionObjectWithMaskBuilder { + b.EncodingMask = encodingMask + return b +} + +func (b *_ExtensionObjectWithMaskBuilder) WithEncodingMaskBuilder(builderSupplier func(ExtensionObjectEncodingMaskBuilder) ExtensionObjectEncodingMaskBuilder) ExtensionObjectWithMaskBuilder { + builder := builderSupplier(b.EncodingMask.CreateExtensionObjectEncodingMaskBuilder()) + var err error + b.EncodingMask, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectEncodingMaskBuilder failed")) + } + return b +} + +func (b *_ExtensionObjectWithMaskBuilder) PartialBuild() (ExtensionObjectWithMaskContract, error) { + if b.EncodingMask == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'encodingMask' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ExtensionObjectWithMask.deepCopy(), nil +} + +func (b *_ExtensionObjectWithMaskBuilder) PartialMustBuild() ExtensionObjectWithMaskContract { + build, err := b.PartialBuild() + if err != nil { + panic(err) + } + return build +} + +func (b *_ExtensionObjectWithMaskBuilder) AsBinaryExtensionObjectWithMask() interface { + BinaryExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder +} { + if cb, ok := b.childBuilder.(interface { + BinaryExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder + }); ok { + return cb + } + cb := NewBinaryExtensionObjectWithMaskBuilder().(*_BinaryExtensionObjectWithMaskBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +func (b *_ExtensionObjectWithMaskBuilder) AsNullExtensionObjectWithMask() interface { + NullExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder +} { + if cb, ok := b.childBuilder.(interface { + NullExtensionObjectWithMaskBuilder + Done() ExtensionObjectWithMaskBuilder + }); ok { + return cb + } + cb := NewNullExtensionObjectWithMaskBuilder().(*_NullExtensionObjectWithMaskBuilder) + cb.parentBuilder = b + b.childBuilder = cb + return cb +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ExtensionObjectWithMaskBuilder) Done() ExtensionObjectBuilder { + return b.parentBuilder +} + +func (b *_ExtensionObjectWithMaskBuilder) buildForExtensionObject() (ExtensionObject, error) { + return b.Build() +} + +func (b *_ExtensionObjectWithMaskBuilder) Build() (ExtensionObjectWithMask, error) { + v, err := b.PartialBuild() + if err != nil { + return nil, errors.Wrap(err, "error occurred during partial build") + } + if b.childBuilder == nil { + return nil, errors.New("no child builder present") + } + b.childBuilder.setParent(v) + return b.childBuilder.buildForExtensionObjectWithMask() +} + +func (b *_ExtensionObjectWithMaskBuilder) MustBuild() ExtensionObjectWithMask { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +func (b *_ExtensionObjectWithMaskBuilder) DeepCopy() any { + _copy := b.CreateExtensionObjectWithMaskBuilder().(*_ExtensionObjectWithMaskBuilder) + _copy.childBuilder = b.childBuilder.DeepCopy().(_ExtensionObjectWithMaskChildBuilder) + _copy.childBuilder.setParent(_copy) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateExtensionObjectWithMaskBuilder creates a ExtensionObjectWithMaskBuilder +func (b *_ExtensionObjectWithMask) CreateExtensionObjectWithMaskBuilder() ExtensionObjectWithMaskBuilder { + if b == nil { + return NewExtensionObjectWithMaskBuilder() + } + return &_ExtensionObjectWithMaskBuilder{_ExtensionObjectWithMask: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ExtensionObjectWithMask) GetIncludeEncodingMask() bool { + return bool(true) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ExtensionObjectWithMask) GetEncodingMask() ExtensionObjectEncodingMask { + return m.EncodingMask +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastExtensionObjectWithMask(structType any) ExtensionObjectWithMask { + if casted, ok := structType.(ExtensionObjectWithMask); ok { + return casted + } + if casted, ok := structType.(*ExtensionObjectWithMask); ok { + return *casted + } + return nil +} + +func (m *_ExtensionObjectWithMask) GetTypeName() string { + return "ExtensionObjectWithMask" +} + +func (m *_ExtensionObjectWithMask) getLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(0) + + // Simple field (encodingMask) + lengthInBits += m.EncodingMask.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_ExtensionObjectWithMask) GetLengthInBits(ctx context.Context) uint16 { + return m._SubType.GetLengthInBits(ctx) +} + +func (m *_ExtensionObjectWithMask) GetLengthInBytes(ctx context.Context) uint16 { + return m._SubType.GetLengthInBits(ctx) / 8 +} + +func (m *_ExtensionObjectWithMask) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObject, extensionId int32, includeEncodingMask bool) (__extensionObjectWithMask ExtensionObjectWithMask, err error) { + m.ExtensionObjectContract = parent + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ExtensionObjectWithMask"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ExtensionObjectWithMask") + } + currentPos := positionAware.GetPos() + _ = currentPos + + encodingMask, err := ReadSimpleField[ExtensionObjectEncodingMask](ctx, "encodingMask", ReadComplex[ExtensionObjectEncodingMask](ExtensionObjectEncodingMaskParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'encodingMask' field")) + } + m.EncodingMask = encodingMask + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + var _child ExtensionObjectWithMask + switch { + case encodingMask.GetXmlBody() == (false) && encodingMask.GetBinaryBody() == (true): // BinaryExtensionObjectWithMask + if _child, err = new(_BinaryExtensionObjectWithMask).parse(ctx, readBuffer, m, extensionId, includeEncodingMask); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type BinaryExtensionObjectWithMask for type-switch of ExtensionObjectWithMask") + } + case encodingMask.GetXmlBody() == (false) && encodingMask.GetBinaryBody() == (false): // NullExtensionObjectWithMask + if _child, err = new(_NullExtensionObjectWithMask).parse(ctx, readBuffer, m, extensionId, includeEncodingMask); err != nil { + return nil, errors.Wrap(err, "Error parsing sub-type NullExtensionObjectWithMask for type-switch of ExtensionObjectWithMask") + } + default: + return nil, errors.Errorf("Unmapped type for parameters [encodingMaskxmlBody=%v, encodingMaskbinaryBody=%v]", encodingMask.GetXmlBody(), encodingMask.GetBinaryBody()) + } + + if closeErr := readBuffer.CloseContext("ExtensionObjectWithMask"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ExtensionObjectWithMask") + } + + parent._SubType = _child + return _child, nil +} + +func (pm *_ExtensionObjectWithMask) serializeParent(ctx context.Context, writeBuffer utils.WriteBuffer, child ExtensionObjectWithMask, serializeChildFunction func() error) error { + // We redirect all calls through client as some methods are only implemented there + m := child + _ = m + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ExtensionObjectWithMask"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ExtensionObjectWithMask") + } + + if err := WriteSimpleField[ExtensionObjectEncodingMask](ctx, "encodingMask", m.GetEncodingMask(), WriteComplex[ExtensionObjectEncodingMask](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'encodingMask' field") + } + + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") + } + + if popErr := writeBuffer.PopContext("ExtensionObjectWithMask"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ExtensionObjectWithMask") + } + return nil + } + return pm.ExtensionObjectContract.(*_ExtensionObject).serializeParent(ctx, writeBuffer, m, ser) +} + +//// +// Arguments Getter + +func (m *_ExtensionObjectWithMask) GetExtensionId() int32 { + return m.ExtensionId +} + +// +//// + +func (m *_ExtensionObjectWithMask) IsExtensionObjectWithMask() {} + +func (m *_ExtensionObjectWithMask) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ExtensionObjectWithMask) deepCopy() *_ExtensionObjectWithMask { + if m == nil { + return nil + } + _ExtensionObjectWithMaskCopy := &_ExtensionObjectWithMask{ + m.ExtensionObjectContract.(*_ExtensionObject).deepCopy(), + nil, // will be set by child + m.EncodingMask.DeepCopy().(ExtensionObjectEncodingMask), + m.ExtensionId, + } + m.ExtensionObjectContract.(*_ExtensionObject)._SubType = m + return _ExtensionObjectWithMaskCopy +} diff --git a/plc4go/protocols/opcua/readwrite/model/FieldMetaData.go b/plc4go/protocols/opcua/readwrite/model/FieldMetaData.go index ecfaacd77c5..5478a90fe91 100644 --- a/plc4go/protocols/opcua/readwrite/model/FieldMetaData.go +++ b/plc4go/protocols/opcua/readwrite/model/FieldMetaData.go @@ -52,18 +52,14 @@ type FieldMetaData interface { GetDataType() NodeId // GetValueRank returns ValueRank (property field) GetValueRank() int32 - // GetNoOfArrayDimensions returns NoOfArrayDimensions (property field) - GetNoOfArrayDimensions() int32 // GetArrayDimensions returns ArrayDimensions (property field) GetArrayDimensions() []uint32 // GetMaxStringLength returns MaxStringLength (property field) GetMaxStringLength() uint32 // GetDataSetFieldId returns DataSetFieldId (property field) GetDataSetFieldId() GuidValue - // GetNoOfProperties returns NoOfProperties (property field) - GetNoOfProperties() int32 // GetProperties returns Properties (property field) - GetProperties() []ExtensionObjectDefinition + GetProperties() []KeyValuePair // IsFieldMetaData is a marker method to prevent unintentional type checks (interfaces of same signature) IsFieldMetaData() // CreateBuilder creates a FieldMetaDataBuilder @@ -73,25 +69,23 @@ type FieldMetaData interface { // _FieldMetaData is the data-structure of this message type _FieldMetaData struct { ExtensionObjectDefinitionContract - Name PascalString - Description LocalizedText - FieldFlags DataSetFieldFlags - BuiltInType uint8 - DataType NodeId - ValueRank int32 - NoOfArrayDimensions int32 - ArrayDimensions []uint32 - MaxStringLength uint32 - DataSetFieldId GuidValue - NoOfProperties int32 - Properties []ExtensionObjectDefinition + Name PascalString + Description LocalizedText + FieldFlags DataSetFieldFlags + BuiltInType uint8 + DataType NodeId + ValueRank int32 + ArrayDimensions []uint32 + MaxStringLength uint32 + DataSetFieldId GuidValue + Properties []KeyValuePair } var _ FieldMetaData = (*_FieldMetaData)(nil) var _ ExtensionObjectDefinitionRequirements = (*_FieldMetaData)(nil) // NewFieldMetaData factory function for _FieldMetaData -func NewFieldMetaData(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, noOfProperties int32, properties []ExtensionObjectDefinition) *_FieldMetaData { +func NewFieldMetaData(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, properties []KeyValuePair) *_FieldMetaData { if name == nil { panic("name of type PascalString for FieldMetaData must not be nil") } @@ -112,11 +106,9 @@ func NewFieldMetaData(name PascalString, description LocalizedText, fieldFlags D BuiltInType: builtInType, DataType: dataType, ValueRank: valueRank, - NoOfArrayDimensions: noOfArrayDimensions, ArrayDimensions: arrayDimensions, MaxStringLength: maxStringLength, DataSetFieldId: dataSetFieldId, - NoOfProperties: noOfProperties, Properties: properties, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -132,7 +124,7 @@ func NewFieldMetaData(name PascalString, description LocalizedText, fieldFlags D type FieldMetaDataBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, noOfProperties int32, properties []ExtensionObjectDefinition) FieldMetaDataBuilder + WithMandatoryFields(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, properties []KeyValuePair) FieldMetaDataBuilder // WithName adds Name (property field) WithName(PascalString) FieldMetaDataBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -151,8 +143,6 @@ type FieldMetaDataBuilder interface { WithDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) FieldMetaDataBuilder // WithValueRank adds ValueRank (property field) WithValueRank(int32) FieldMetaDataBuilder - // WithNoOfArrayDimensions adds NoOfArrayDimensions (property field) - WithNoOfArrayDimensions(int32) FieldMetaDataBuilder // WithArrayDimensions adds ArrayDimensions (property field) WithArrayDimensions(...uint32) FieldMetaDataBuilder // WithMaxStringLength adds MaxStringLength (property field) @@ -161,10 +151,8 @@ type FieldMetaDataBuilder interface { WithDataSetFieldId(GuidValue) FieldMetaDataBuilder // WithDataSetFieldIdBuilder adds DataSetFieldId (property field) which is build by the builder WithDataSetFieldIdBuilder(func(GuidValueBuilder) GuidValueBuilder) FieldMetaDataBuilder - // WithNoOfProperties adds NoOfProperties (property field) - WithNoOfProperties(int32) FieldMetaDataBuilder // WithProperties adds Properties (property field) - WithProperties(...ExtensionObjectDefinition) FieldMetaDataBuilder + WithProperties(...KeyValuePair) FieldMetaDataBuilder // Build builds the FieldMetaData or returns an error if something is wrong Build() (FieldMetaData, error) // MustBuild does the same as Build but panics on error @@ -190,8 +178,8 @@ func (b *_FieldMetaDataBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_FieldMetaDataBuilder) WithMandatoryFields(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, noOfProperties int32, properties []ExtensionObjectDefinition) FieldMetaDataBuilder { - return b.WithName(name).WithDescription(description).WithFieldFlags(fieldFlags).WithBuiltInType(builtInType).WithDataType(dataType).WithValueRank(valueRank).WithNoOfArrayDimensions(noOfArrayDimensions).WithArrayDimensions(arrayDimensions...).WithMaxStringLength(maxStringLength).WithDataSetFieldId(dataSetFieldId).WithNoOfProperties(noOfProperties).WithProperties(properties...) +func (b *_FieldMetaDataBuilder) WithMandatoryFields(name PascalString, description LocalizedText, fieldFlags DataSetFieldFlags, builtInType uint8, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, dataSetFieldId GuidValue, properties []KeyValuePair) FieldMetaDataBuilder { + return b.WithName(name).WithDescription(description).WithFieldFlags(fieldFlags).WithBuiltInType(builtInType).WithDataType(dataType).WithValueRank(valueRank).WithArrayDimensions(arrayDimensions...).WithMaxStringLength(maxStringLength).WithDataSetFieldId(dataSetFieldId).WithProperties(properties...) } func (b *_FieldMetaDataBuilder) WithName(name PascalString) FieldMetaDataBuilder { @@ -263,11 +251,6 @@ func (b *_FieldMetaDataBuilder) WithValueRank(valueRank int32) FieldMetaDataBuil return b } -func (b *_FieldMetaDataBuilder) WithNoOfArrayDimensions(noOfArrayDimensions int32) FieldMetaDataBuilder { - b.NoOfArrayDimensions = noOfArrayDimensions - return b -} - func (b *_FieldMetaDataBuilder) WithArrayDimensions(arrayDimensions ...uint32) FieldMetaDataBuilder { b.ArrayDimensions = arrayDimensions return b @@ -296,12 +279,7 @@ func (b *_FieldMetaDataBuilder) WithDataSetFieldIdBuilder(builderSupplier func(G return b } -func (b *_FieldMetaDataBuilder) WithNoOfProperties(noOfProperties int32) FieldMetaDataBuilder { - b.NoOfProperties = noOfProperties - return b -} - -func (b *_FieldMetaDataBuilder) WithProperties(properties ...ExtensionObjectDefinition) FieldMetaDataBuilder { +func (b *_FieldMetaDataBuilder) WithProperties(properties ...KeyValuePair) FieldMetaDataBuilder { b.Properties = properties return b } @@ -380,8 +358,8 @@ func (b *_FieldMetaData) CreateFieldMetaDataBuilder() FieldMetaDataBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FieldMetaData) GetIdentifier() string { - return "14526" +func (m *_FieldMetaData) GetExtensionId() int32 { + return int32(14526) } /////////////////////// @@ -422,10 +400,6 @@ func (m *_FieldMetaData) GetValueRank() int32 { return m.ValueRank } -func (m *_FieldMetaData) GetNoOfArrayDimensions() int32 { - return m.NoOfArrayDimensions -} - func (m *_FieldMetaData) GetArrayDimensions() []uint32 { return m.ArrayDimensions } @@ -438,11 +412,7 @@ func (m *_FieldMetaData) GetDataSetFieldId() GuidValue { return m.DataSetFieldId } -func (m *_FieldMetaData) GetNoOfProperties() int32 { - return m.NoOfProperties -} - -func (m *_FieldMetaData) GetProperties() []ExtensionObjectDefinition { +func (m *_FieldMetaData) GetProperties() []KeyValuePair { return m.Properties } @@ -487,7 +457,7 @@ func (m *_FieldMetaData) GetLengthInBits(ctx context.Context) uint16 { // Simple field (valueRank) lengthInBits += 32 - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32 // Array field @@ -501,7 +471,7 @@ func (m *_FieldMetaData) GetLengthInBits(ctx context.Context) uint16 { // Simple field (dataSetFieldId) lengthInBits += m.DataSetFieldId.GetLengthInBits(ctx) - // Simple field (noOfProperties) + // Implicit Field (noOfProperties) lengthInBits += 32 // Array field @@ -521,7 +491,7 @@ func (m *_FieldMetaData) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_FieldMetaData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__fieldMetaData FieldMetaData, err error) { +func (m *_FieldMetaData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__fieldMetaData FieldMetaData, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -568,11 +538,11 @@ func (m *_FieldMetaData) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.ValueRank = valueRank - noOfArrayDimensions, err := ReadSimpleField(ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) + noOfArrayDimensions, err := ReadImplicitField[int32](ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfArrayDimensions' field")) } - m.NoOfArrayDimensions = noOfArrayDimensions + _ = noOfArrayDimensions arrayDimensions, err := ReadCountArrayField[uint32](ctx, "arrayDimensions", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfArrayDimensions)) if err != nil { @@ -592,13 +562,13 @@ func (m *_FieldMetaData) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.DataSetFieldId = dataSetFieldId - noOfProperties, err := ReadSimpleField(ctx, "noOfProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfProperties, err := ReadImplicitField[int32](ctx, "noOfProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfProperties' field")) } - m.NoOfProperties = noOfProperties + _ = noOfProperties - properties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "properties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfProperties)) + properties, err := ReadCountArrayField[KeyValuePair](ctx, "properties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'properties' field")) } @@ -652,8 +622,8 @@ func (m *_FieldMetaData) SerializeWithWriteBuffer(ctx context.Context, writeBuff if err := WriteSimpleField[int32](ctx, "valueRank", m.GetValueRank(), WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'valueRank' field") } - - if err := WriteSimpleField[int32](ctx, "noOfArrayDimensions", m.GetNoOfArrayDimensions(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfArrayDimensions := int32(utils.InlineIf(bool((m.GetArrayDimensions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetArrayDimensions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfArrayDimensions", noOfArrayDimensions, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfArrayDimensions' field") } @@ -668,8 +638,8 @@ func (m *_FieldMetaData) SerializeWithWriteBuffer(ctx context.Context, writeBuff if err := WriteSimpleField[GuidValue](ctx, "dataSetFieldId", m.GetDataSetFieldId(), WriteComplex[GuidValue](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'dataSetFieldId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfProperties", m.GetNoOfProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfProperties := int32(utils.InlineIf(bool((m.GetProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfProperties", noOfProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfProperties' field") } @@ -703,12 +673,10 @@ func (m *_FieldMetaData) deepCopy() *_FieldMetaData { m.BuiltInType, m.DataType.DeepCopy().(NodeId), m.ValueRank, - m.NoOfArrayDimensions, utils.DeepCopySlice[uint32, uint32](m.ArrayDimensions), m.MaxStringLength, m.DataSetFieldId.DeepCopy().(GuidValue), - m.NoOfProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Properties), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.Properties), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _FieldMetaDataCopy diff --git a/plc4go/protocols/opcua/readwrite/model/FieldTargetDataType.go b/plc4go/protocols/opcua/readwrite/model/FieldTargetDataType.go index affd4feddec..a7c94f9681a 100644 --- a/plc4go/protocols/opcua/readwrite/model/FieldTargetDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/FieldTargetDataType.go @@ -349,8 +349,8 @@ func (b *_FieldTargetDataType) CreateFieldTargetDataTypeBuilder() FieldTargetDat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FieldTargetDataType) GetIdentifier() string { - return "14746" +func (m *_FieldTargetDataType) GetExtensionId() int32 { + return int32(14746) } /////////////////////// @@ -446,7 +446,7 @@ func (m *_FieldTargetDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_FieldTargetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__fieldTargetDataType FieldTargetDataType, err error) { +func (m *_FieldTargetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__fieldTargetDataType FieldTargetDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/FilterOperand.go b/plc4go/protocols/opcua/readwrite/model/FilterOperand.go index 03ae3c7f8cd..c9c30543012 100644 --- a/plc4go/protocols/opcua/readwrite/model/FilterOperand.go +++ b/plc4go/protocols/opcua/readwrite/model/FilterOperand.go @@ -150,8 +150,8 @@ func (b *_FilterOperand) CreateFilterOperandBuilder() FilterOperandBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FilterOperand) GetIdentifier() string { - return "591" +func (m *_FilterOperand) GetExtensionId() int32 { + return int32(591) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_FilterOperand) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_FilterOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__filterOperand FilterOperand, err error) { +func (m *_FilterOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__filterOperand FilterOperand, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkRequest.go b/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkRequest.go index fcba10e6ed6..62073634e38 100644 --- a/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkRequest.go @@ -41,13 +41,11 @@ type FindServersOnNetworkRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetStartingRecordId returns StartingRecordId (property field) GetStartingRecordId() uint32 // GetMaxRecordsToReturn returns MaxRecordsToReturn (property field) GetMaxRecordsToReturn() uint32 - // GetNoOfServerCapabilityFilter returns NoOfServerCapabilityFilter (property field) - GetNoOfServerCapabilityFilter() int32 // GetServerCapabilityFilter returns ServerCapabilityFilter (property field) GetServerCapabilityFilter() []PascalString // IsFindServersOnNetworkRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +57,25 @@ type FindServersOnNetworkRequest interface { // _FindServersOnNetworkRequest is the data-structure of this message type _FindServersOnNetworkRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - StartingRecordId uint32 - MaxRecordsToReturn uint32 - NoOfServerCapabilityFilter int32 - ServerCapabilityFilter []PascalString + RequestHeader RequestHeader + StartingRecordId uint32 + MaxRecordsToReturn uint32 + ServerCapabilityFilter []PascalString } var _ FindServersOnNetworkRequest = (*_FindServersOnNetworkRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_FindServersOnNetworkRequest)(nil) // NewFindServersOnNetworkRequest factory function for _FindServersOnNetworkRequest -func NewFindServersOnNetworkRequest(requestHeader ExtensionObjectDefinition, startingRecordId uint32, maxRecordsToReturn uint32, noOfServerCapabilityFilter int32, serverCapabilityFilter []PascalString) *_FindServersOnNetworkRequest { +func NewFindServersOnNetworkRequest(requestHeader RequestHeader, startingRecordId uint32, maxRecordsToReturn uint32, serverCapabilityFilter []PascalString) *_FindServersOnNetworkRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for FindServersOnNetworkRequest must not be nil") + panic("requestHeader of type RequestHeader for FindServersOnNetworkRequest must not be nil") } _result := &_FindServersOnNetworkRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, StartingRecordId: startingRecordId, MaxRecordsToReturn: maxRecordsToReturn, - NoOfServerCapabilityFilter: noOfServerCapabilityFilter, ServerCapabilityFilter: serverCapabilityFilter, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +91,15 @@ func NewFindServersOnNetworkRequest(requestHeader ExtensionObjectDefinition, sta type FindServersOnNetworkRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, startingRecordId uint32, maxRecordsToReturn uint32, noOfServerCapabilityFilter int32, serverCapabilityFilter []PascalString) FindServersOnNetworkRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, startingRecordId uint32, maxRecordsToReturn uint32, serverCapabilityFilter []PascalString) FindServersOnNetworkRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) FindServersOnNetworkRequestBuilder + WithRequestHeader(RequestHeader) FindServersOnNetworkRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersOnNetworkRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) FindServersOnNetworkRequestBuilder // WithStartingRecordId adds StartingRecordId (property field) WithStartingRecordId(uint32) FindServersOnNetworkRequestBuilder // WithMaxRecordsToReturn adds MaxRecordsToReturn (property field) WithMaxRecordsToReturn(uint32) FindServersOnNetworkRequestBuilder - // WithNoOfServerCapabilityFilter adds NoOfServerCapabilityFilter (property field) - WithNoOfServerCapabilityFilter(int32) FindServersOnNetworkRequestBuilder // WithServerCapabilityFilter adds ServerCapabilityFilter (property field) WithServerCapabilityFilter(...PascalString) FindServersOnNetworkRequestBuilder // Build builds the FindServersOnNetworkRequest or returns an error if something is wrong @@ -133,24 +127,24 @@ func (b *_FindServersOnNetworkRequestBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_FindServersOnNetworkRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, startingRecordId uint32, maxRecordsToReturn uint32, noOfServerCapabilityFilter int32, serverCapabilityFilter []PascalString) FindServersOnNetworkRequestBuilder { - return b.WithRequestHeader(requestHeader).WithStartingRecordId(startingRecordId).WithMaxRecordsToReturn(maxRecordsToReturn).WithNoOfServerCapabilityFilter(noOfServerCapabilityFilter).WithServerCapabilityFilter(serverCapabilityFilter...) +func (b *_FindServersOnNetworkRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, startingRecordId uint32, maxRecordsToReturn uint32, serverCapabilityFilter []PascalString) FindServersOnNetworkRequestBuilder { + return b.WithRequestHeader(requestHeader).WithStartingRecordId(startingRecordId).WithMaxRecordsToReturn(maxRecordsToReturn).WithServerCapabilityFilter(serverCapabilityFilter...) } -func (b *_FindServersOnNetworkRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) FindServersOnNetworkRequestBuilder { +func (b *_FindServersOnNetworkRequestBuilder) WithRequestHeader(requestHeader RequestHeader) FindServersOnNetworkRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_FindServersOnNetworkRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersOnNetworkRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_FindServersOnNetworkRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) FindServersOnNetworkRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -165,11 +159,6 @@ func (b *_FindServersOnNetworkRequestBuilder) WithMaxRecordsToReturn(maxRecordsT return b } -func (b *_FindServersOnNetworkRequestBuilder) WithNoOfServerCapabilityFilter(noOfServerCapabilityFilter int32) FindServersOnNetworkRequestBuilder { - b.NoOfServerCapabilityFilter = noOfServerCapabilityFilter - return b -} - func (b *_FindServersOnNetworkRequestBuilder) WithServerCapabilityFilter(serverCapabilityFilter ...PascalString) FindServersOnNetworkRequestBuilder { b.ServerCapabilityFilter = serverCapabilityFilter return b @@ -231,8 +220,8 @@ func (b *_FindServersOnNetworkRequest) CreateFindServersOnNetworkRequestBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FindServersOnNetworkRequest) GetIdentifier() string { - return "12192" +func (m *_FindServersOnNetworkRequest) GetExtensionId() int32 { + return int32(12192) } /////////////////////// @@ -249,7 +238,7 @@ func (m *_FindServersOnNetworkRequest) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_FindServersOnNetworkRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_FindServersOnNetworkRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -261,10 +250,6 @@ func (m *_FindServersOnNetworkRequest) GetMaxRecordsToReturn() uint32 { return m.MaxRecordsToReturn } -func (m *_FindServersOnNetworkRequest) GetNoOfServerCapabilityFilter() int32 { - return m.NoOfServerCapabilityFilter -} - func (m *_FindServersOnNetworkRequest) GetServerCapabilityFilter() []PascalString { return m.ServerCapabilityFilter } @@ -301,7 +286,7 @@ func (m *_FindServersOnNetworkRequest) GetLengthInBits(ctx context.Context) uint // Simple field (maxRecordsToReturn) lengthInBits += 32 - // Simple field (noOfServerCapabilityFilter) + // Implicit Field (noOfServerCapabilityFilter) lengthInBits += 32 // Array field @@ -321,7 +306,7 @@ func (m *_FindServersOnNetworkRequest) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_FindServersOnNetworkRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__findServersOnNetworkRequest FindServersOnNetworkRequest, err error) { +func (m *_FindServersOnNetworkRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__findServersOnNetworkRequest FindServersOnNetworkRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -332,7 +317,7 @@ func (m *_FindServersOnNetworkRequest) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -350,11 +335,11 @@ func (m *_FindServersOnNetworkRequest) parse(ctx context.Context, readBuffer uti } m.MaxRecordsToReturn = maxRecordsToReturn - noOfServerCapabilityFilter, err := ReadSimpleField(ctx, "noOfServerCapabilityFilter", ReadSignedInt(readBuffer, uint8(32))) + noOfServerCapabilityFilter, err := ReadImplicitField[int32](ctx, "noOfServerCapabilityFilter", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerCapabilityFilter' field")) } - m.NoOfServerCapabilityFilter = noOfServerCapabilityFilter + _ = noOfServerCapabilityFilter serverCapabilityFilter, err := ReadCountArrayField[PascalString](ctx, "serverCapabilityFilter", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerCapabilityFilter)) if err != nil { @@ -387,7 +372,7 @@ func (m *_FindServersOnNetworkRequest) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(pushErr, "Error pushing for FindServersOnNetworkRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -398,8 +383,8 @@ func (m *_FindServersOnNetworkRequest) SerializeWithWriteBuffer(ctx context.Cont if err := WriteSimpleField[uint32](ctx, "maxRecordsToReturn", m.GetMaxRecordsToReturn(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'maxRecordsToReturn' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerCapabilityFilter", m.GetNoOfServerCapabilityFilter(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerCapabilityFilter := int32(utils.InlineIf(bool((m.GetServerCapabilityFilter()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerCapabilityFilter()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerCapabilityFilter", noOfServerCapabilityFilter, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerCapabilityFilter' field") } @@ -427,10 +412,9 @@ func (m *_FindServersOnNetworkRequest) deepCopy() *_FindServersOnNetworkRequest } _FindServersOnNetworkRequestCopy := &_FindServersOnNetworkRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.StartingRecordId, m.MaxRecordsToReturn, - m.NoOfServerCapabilityFilter, utils.DeepCopySlice[PascalString, PascalString](m.ServerCapabilityFilter), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkResponse.go b/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkResponse.go index 9fad3518ea8..fac3027baf7 100644 --- a/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/FindServersOnNetworkResponse.go @@ -41,13 +41,11 @@ type FindServersOnNetworkResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetLastCounterResetTime returns LastCounterResetTime (property field) GetLastCounterResetTime() int64 - // GetNoOfServers returns NoOfServers (property field) - GetNoOfServers() int32 // GetServers returns Servers (property field) - GetServers() []ExtensionObjectDefinition + GetServers() []ServerOnNetwork // IsFindServersOnNetworkResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsFindServersOnNetworkResponse() // CreateBuilder creates a FindServersOnNetworkResponseBuilder @@ -57,25 +55,23 @@ type FindServersOnNetworkResponse interface { // _FindServersOnNetworkResponse is the data-structure of this message type _FindServersOnNetworkResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader LastCounterResetTime int64 - NoOfServers int32 - Servers []ExtensionObjectDefinition + Servers []ServerOnNetwork } var _ FindServersOnNetworkResponse = (*_FindServersOnNetworkResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_FindServersOnNetworkResponse)(nil) // NewFindServersOnNetworkResponse factory function for _FindServersOnNetworkResponse -func NewFindServersOnNetworkResponse(responseHeader ExtensionObjectDefinition, lastCounterResetTime int64, noOfServers int32, servers []ExtensionObjectDefinition) *_FindServersOnNetworkResponse { +func NewFindServersOnNetworkResponse(responseHeader ResponseHeader, lastCounterResetTime int64, servers []ServerOnNetwork) *_FindServersOnNetworkResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for FindServersOnNetworkResponse must not be nil") + panic("responseHeader of type ResponseHeader for FindServersOnNetworkResponse must not be nil") } _result := &_FindServersOnNetworkResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, LastCounterResetTime: lastCounterResetTime, - NoOfServers: noOfServers, Servers: servers, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -91,17 +87,15 @@ func NewFindServersOnNetworkResponse(responseHeader ExtensionObjectDefinition, l type FindServersOnNetworkResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, lastCounterResetTime int64, noOfServers int32, servers []ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, lastCounterResetTime int64, servers []ServerOnNetwork) FindServersOnNetworkResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder + WithResponseHeader(ResponseHeader) FindServersOnNetworkResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersOnNetworkResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) FindServersOnNetworkResponseBuilder // WithLastCounterResetTime adds LastCounterResetTime (property field) WithLastCounterResetTime(int64) FindServersOnNetworkResponseBuilder - // WithNoOfServers adds NoOfServers (property field) - WithNoOfServers(int32) FindServersOnNetworkResponseBuilder // WithServers adds Servers (property field) - WithServers(...ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder + WithServers(...ServerOnNetwork) FindServersOnNetworkResponseBuilder // Build builds the FindServersOnNetworkResponse or returns an error if something is wrong Build() (FindServersOnNetworkResponse, error) // MustBuild does the same as Build but panics on error @@ -127,24 +121,24 @@ func (b *_FindServersOnNetworkResponseBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_FindServersOnNetworkResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, lastCounterResetTime int64, noOfServers int32, servers []ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder { - return b.WithResponseHeader(responseHeader).WithLastCounterResetTime(lastCounterResetTime).WithNoOfServers(noOfServers).WithServers(servers...) +func (b *_FindServersOnNetworkResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, lastCounterResetTime int64, servers []ServerOnNetwork) FindServersOnNetworkResponseBuilder { + return b.WithResponseHeader(responseHeader).WithLastCounterResetTime(lastCounterResetTime).WithServers(servers...) } -func (b *_FindServersOnNetworkResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder { +func (b *_FindServersOnNetworkResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) FindServersOnNetworkResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_FindServersOnNetworkResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersOnNetworkResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_FindServersOnNetworkResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) FindServersOnNetworkResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -154,12 +148,7 @@ func (b *_FindServersOnNetworkResponseBuilder) WithLastCounterResetTime(lastCoun return b } -func (b *_FindServersOnNetworkResponseBuilder) WithNoOfServers(noOfServers int32) FindServersOnNetworkResponseBuilder { - b.NoOfServers = noOfServers - return b -} - -func (b *_FindServersOnNetworkResponseBuilder) WithServers(servers ...ExtensionObjectDefinition) FindServersOnNetworkResponseBuilder { +func (b *_FindServersOnNetworkResponseBuilder) WithServers(servers ...ServerOnNetwork) FindServersOnNetworkResponseBuilder { b.Servers = servers return b } @@ -220,8 +209,8 @@ func (b *_FindServersOnNetworkResponse) CreateFindServersOnNetworkResponseBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FindServersOnNetworkResponse) GetIdentifier() string { - return "12193" +func (m *_FindServersOnNetworkResponse) GetExtensionId() int32 { + return int32(12193) } /////////////////////// @@ -238,7 +227,7 @@ func (m *_FindServersOnNetworkResponse) GetParent() ExtensionObjectDefinitionCon /////////////////////// Accessors for property fields. /////////////////////// -func (m *_FindServersOnNetworkResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_FindServersOnNetworkResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -246,11 +235,7 @@ func (m *_FindServersOnNetworkResponse) GetLastCounterResetTime() int64 { return m.LastCounterResetTime } -func (m *_FindServersOnNetworkResponse) GetNoOfServers() int32 { - return m.NoOfServers -} - -func (m *_FindServersOnNetworkResponse) GetServers() []ExtensionObjectDefinition { +func (m *_FindServersOnNetworkResponse) GetServers() []ServerOnNetwork { return m.Servers } @@ -283,7 +268,7 @@ func (m *_FindServersOnNetworkResponse) GetLengthInBits(ctx context.Context) uin // Simple field (lastCounterResetTime) lengthInBits += 64 - // Simple field (noOfServers) + // Implicit Field (noOfServers) lengthInBits += 32 // Array field @@ -303,7 +288,7 @@ func (m *_FindServersOnNetworkResponse) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_FindServersOnNetworkResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__findServersOnNetworkResponse FindServersOnNetworkResponse, err error) { +func (m *_FindServersOnNetworkResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__findServersOnNetworkResponse FindServersOnNetworkResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -314,7 +299,7 @@ func (m *_FindServersOnNetworkResponse) parse(ctx context.Context, readBuffer ut currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -326,13 +311,13 @@ func (m *_FindServersOnNetworkResponse) parse(ctx context.Context, readBuffer ut } m.LastCounterResetTime = lastCounterResetTime - noOfServers, err := ReadSimpleField(ctx, "noOfServers", ReadSignedInt(readBuffer, uint8(32))) + noOfServers, err := ReadImplicitField[int32](ctx, "noOfServers", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServers' field")) } - m.NoOfServers = noOfServers + _ = noOfServers - servers, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "servers", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("12191")), readBuffer), uint64(noOfServers)) + servers, err := ReadCountArrayField[ServerOnNetwork](ctx, "servers", ReadComplex[ServerOnNetwork](ExtensionObjectDefinitionParseWithBufferProducer[ServerOnNetwork]((int32)(int32(12191))), readBuffer), uint64(noOfServers)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'servers' field")) } @@ -363,15 +348,15 @@ func (m *_FindServersOnNetworkResponse) SerializeWithWriteBuffer(ctx context.Con return errors.Wrap(pushErr, "Error pushing for FindServersOnNetworkResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } if err := WriteSimpleField[int64](ctx, "lastCounterResetTime", m.GetLastCounterResetTime(), WriteSignedLong(writeBuffer, 64)); err != nil { return errors.Wrap(err, "Error serializing 'lastCounterResetTime' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServers", m.GetNoOfServers(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServers := int32(utils.InlineIf(bool((m.GetServers()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServers()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServers", noOfServers, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServers' field") } @@ -399,10 +384,9 @@ func (m *_FindServersOnNetworkResponse) deepCopy() *_FindServersOnNetworkRespons } _FindServersOnNetworkResponseCopy := &_FindServersOnNetworkResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.LastCounterResetTime, - m.NoOfServers, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Servers), + utils.DeepCopySlice[ServerOnNetwork, ServerOnNetwork](m.Servers), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _FindServersOnNetworkResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/FindServersRequest.go b/plc4go/protocols/opcua/readwrite/model/FindServersRequest.go index 80819778428..0fb31cdafa6 100644 --- a/plc4go/protocols/opcua/readwrite/model/FindServersRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/FindServersRequest.go @@ -41,15 +41,11 @@ type FindServersRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetEndpointUrl returns EndpointUrl (property field) GetEndpointUrl() PascalString - // GetNoOfLocaleIds returns NoOfLocaleIds (property field) - GetNoOfLocaleIds() int32 // GetLocaleIds returns LocaleIds (property field) GetLocaleIds() []PascalString - // GetNoOfServerUris returns NoOfServerUris (property field) - GetNoOfServerUris() int32 // GetServerUris returns ServerUris (property field) GetServerUris() []PascalString // IsFindServersRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -61,21 +57,19 @@ type FindServersRequest interface { // _FindServersRequest is the data-structure of this message type _FindServersRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - EndpointUrl PascalString - NoOfLocaleIds int32 - LocaleIds []PascalString - NoOfServerUris int32 - ServerUris []PascalString + RequestHeader RequestHeader + EndpointUrl PascalString + LocaleIds []PascalString + ServerUris []PascalString } var _ FindServersRequest = (*_FindServersRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_FindServersRequest)(nil) // NewFindServersRequest factory function for _FindServersRequest -func NewFindServersRequest(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfServerUris int32, serverUris []PascalString) *_FindServersRequest { +func NewFindServersRequest(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, serverUris []PascalString) *_FindServersRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for FindServersRequest must not be nil") + panic("requestHeader of type RequestHeader for FindServersRequest must not be nil") } if endpointUrl == nil { panic("endpointUrl of type PascalString for FindServersRequest must not be nil") @@ -84,9 +78,7 @@ func NewFindServersRequest(requestHeader ExtensionObjectDefinition, endpointUrl ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, EndpointUrl: endpointUrl, - NoOfLocaleIds: noOfLocaleIds, LocaleIds: localeIds, - NoOfServerUris: noOfServerUris, ServerUris: serverUris, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -102,21 +94,17 @@ func NewFindServersRequest(requestHeader ExtensionObjectDefinition, endpointUrl type FindServersRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfServerUris int32, serverUris []PascalString) FindServersRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, serverUris []PascalString) FindServersRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) FindServersRequestBuilder + WithRequestHeader(RequestHeader) FindServersRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) FindServersRequestBuilder // WithEndpointUrl adds EndpointUrl (property field) WithEndpointUrl(PascalString) FindServersRequestBuilder // WithEndpointUrlBuilder adds EndpointUrl (property field) which is build by the builder WithEndpointUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) FindServersRequestBuilder - // WithNoOfLocaleIds adds NoOfLocaleIds (property field) - WithNoOfLocaleIds(int32) FindServersRequestBuilder // WithLocaleIds adds LocaleIds (property field) WithLocaleIds(...PascalString) FindServersRequestBuilder - // WithNoOfServerUris adds NoOfServerUris (property field) - WithNoOfServerUris(int32) FindServersRequestBuilder // WithServerUris adds ServerUris (property field) WithServerUris(...PascalString) FindServersRequestBuilder // Build builds the FindServersRequest or returns an error if something is wrong @@ -144,24 +132,24 @@ func (b *_FindServersRequestBuilder) setParent(contract ExtensionObjectDefinitio b.ExtensionObjectDefinitionContract = contract } -func (b *_FindServersRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfServerUris int32, serverUris []PascalString) FindServersRequestBuilder { - return b.WithRequestHeader(requestHeader).WithEndpointUrl(endpointUrl).WithNoOfLocaleIds(noOfLocaleIds).WithLocaleIds(localeIds...).WithNoOfServerUris(noOfServerUris).WithServerUris(serverUris...) +func (b *_FindServersRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, serverUris []PascalString) FindServersRequestBuilder { + return b.WithRequestHeader(requestHeader).WithEndpointUrl(endpointUrl).WithLocaleIds(localeIds...).WithServerUris(serverUris...) } -func (b *_FindServersRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) FindServersRequestBuilder { +func (b *_FindServersRequestBuilder) WithRequestHeader(requestHeader RequestHeader) FindServersRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_FindServersRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_FindServersRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) FindServersRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -184,21 +172,11 @@ func (b *_FindServersRequestBuilder) WithEndpointUrlBuilder(builderSupplier func return b } -func (b *_FindServersRequestBuilder) WithNoOfLocaleIds(noOfLocaleIds int32) FindServersRequestBuilder { - b.NoOfLocaleIds = noOfLocaleIds - return b -} - func (b *_FindServersRequestBuilder) WithLocaleIds(localeIds ...PascalString) FindServersRequestBuilder { b.LocaleIds = localeIds return b } -func (b *_FindServersRequestBuilder) WithNoOfServerUris(noOfServerUris int32) FindServersRequestBuilder { - b.NoOfServerUris = noOfServerUris - return b -} - func (b *_FindServersRequestBuilder) WithServerUris(serverUris ...PascalString) FindServersRequestBuilder { b.ServerUris = serverUris return b @@ -266,8 +244,8 @@ func (b *_FindServersRequest) CreateFindServersRequestBuilder() FindServersReque /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FindServersRequest) GetIdentifier() string { - return "422" +func (m *_FindServersRequest) GetExtensionId() int32 { + return int32(422) } /////////////////////// @@ -284,7 +262,7 @@ func (m *_FindServersRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_FindServersRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_FindServersRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -292,18 +270,10 @@ func (m *_FindServersRequest) GetEndpointUrl() PascalString { return m.EndpointUrl } -func (m *_FindServersRequest) GetNoOfLocaleIds() int32 { - return m.NoOfLocaleIds -} - func (m *_FindServersRequest) GetLocaleIds() []PascalString { return m.LocaleIds } -func (m *_FindServersRequest) GetNoOfServerUris() int32 { - return m.NoOfServerUris -} - func (m *_FindServersRequest) GetServerUris() []PascalString { return m.ServerUris } @@ -337,7 +307,7 @@ func (m *_FindServersRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (endpointUrl) lengthInBits += m.EndpointUrl.GetLengthInBits(ctx) - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32 // Array field @@ -350,7 +320,7 @@ func (m *_FindServersRequest) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32 // Array field @@ -370,7 +340,7 @@ func (m *_FindServersRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_FindServersRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__findServersRequest FindServersRequest, err error) { +func (m *_FindServersRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__findServersRequest FindServersRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -381,7 +351,7 @@ func (m *_FindServersRequest) parse(ctx context.Context, readBuffer utils.ReadBu currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -393,11 +363,11 @@ func (m *_FindServersRequest) parse(ctx context.Context, readBuffer utils.ReadBu } m.EndpointUrl = endpointUrl - noOfLocaleIds, err := ReadSimpleField(ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) } - m.NoOfLocaleIds = noOfLocaleIds + _ = noOfLocaleIds localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) if err != nil { @@ -405,11 +375,11 @@ func (m *_FindServersRequest) parse(ctx context.Context, readBuffer utils.ReadBu } m.LocaleIds = localeIds - noOfServerUris, err := ReadSimpleField(ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) + noOfServerUris, err := ReadImplicitField[int32](ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerUris' field")) } - m.NoOfServerUris = noOfServerUris + _ = noOfServerUris serverUris, err := ReadCountArrayField[PascalString](ctx, "serverUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerUris)) if err != nil { @@ -442,23 +412,23 @@ func (m *_FindServersRequest) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(pushErr, "Error pushing for FindServersRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } if err := WriteSimpleField[PascalString](ctx, "endpointUrl", m.GetEndpointUrl(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'endpointUrl' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLocaleIds", m.GetNoOfLocaleIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") } if err := WriteComplexTypeArrayField(ctx, "localeIds", m.GetLocaleIds(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'localeIds' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerUris", m.GetNoOfServerUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerUris := int32(utils.InlineIf(bool((m.GetServerUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerUris", noOfServerUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerUris' field") } @@ -486,11 +456,9 @@ func (m *_FindServersRequest) deepCopy() *_FindServersRequest { } _FindServersRequestCopy := &_FindServersRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.EndpointUrl.DeepCopy().(PascalString), - m.NoOfLocaleIds, utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), - m.NoOfServerUris, utils.DeepCopySlice[PascalString, PascalString](m.ServerUris), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/FindServersResponse.go b/plc4go/protocols/opcua/readwrite/model/FindServersResponse.go index 18e61d55e9b..2d1a7bc48ab 100644 --- a/plc4go/protocols/opcua/readwrite/model/FindServersResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/FindServersResponse.go @@ -41,11 +41,9 @@ type FindServersResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfServers returns NoOfServers (property field) - GetNoOfServers() int32 + GetResponseHeader() ResponseHeader // GetServers returns Servers (property field) - GetServers() []ExtensionObjectDefinition + GetServers() []ApplicationDescription // IsFindServersResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsFindServersResponse() // CreateBuilder creates a FindServersResponseBuilder @@ -55,23 +53,21 @@ type FindServersResponse interface { // _FindServersResponse is the data-structure of this message type _FindServersResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfServers int32 - Servers []ExtensionObjectDefinition + ResponseHeader ResponseHeader + Servers []ApplicationDescription } var _ FindServersResponse = (*_FindServersResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_FindServersResponse)(nil) // NewFindServersResponse factory function for _FindServersResponse -func NewFindServersResponse(responseHeader ExtensionObjectDefinition, noOfServers int32, servers []ExtensionObjectDefinition) *_FindServersResponse { +func NewFindServersResponse(responseHeader ResponseHeader, servers []ApplicationDescription) *_FindServersResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for FindServersResponse must not be nil") + panic("responseHeader of type ResponseHeader for FindServersResponse must not be nil") } _result := &_FindServersResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfServers: noOfServers, Servers: servers, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewFindServersResponse(responseHeader ExtensionObjectDefinition, noOfServer type FindServersResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfServers int32, servers []ExtensionObjectDefinition) FindServersResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, servers []ApplicationDescription) FindServersResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) FindServersResponseBuilder + WithResponseHeader(ResponseHeader) FindServersResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersResponseBuilder - // WithNoOfServers adds NoOfServers (property field) - WithNoOfServers(int32) FindServersResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) FindServersResponseBuilder // WithServers adds Servers (property field) - WithServers(...ExtensionObjectDefinition) FindServersResponseBuilder + WithServers(...ApplicationDescription) FindServersResponseBuilder // Build builds the FindServersResponse or returns an error if something is wrong Build() (FindServersResponse, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_FindServersResponseBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_FindServersResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfServers int32, servers []ExtensionObjectDefinition) FindServersResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfServers(noOfServers).WithServers(servers...) +func (b *_FindServersResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, servers []ApplicationDescription) FindServersResponseBuilder { + return b.WithResponseHeader(responseHeader).WithServers(servers...) } -func (b *_FindServersResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) FindServersResponseBuilder { +func (b *_FindServersResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) FindServersResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_FindServersResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) FindServersResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_FindServersResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) FindServersResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_FindServersResponseBuilder) WithNoOfServers(noOfServers int32) FindServersResponseBuilder { - b.NoOfServers = noOfServers - return b -} - -func (b *_FindServersResponseBuilder) WithServers(servers ...ExtensionObjectDefinition) FindServersResponseBuilder { +func (b *_FindServersResponseBuilder) WithServers(servers ...ApplicationDescription) FindServersResponseBuilder { b.Servers = servers return b } @@ -209,8 +198,8 @@ func (b *_FindServersResponse) CreateFindServersResponseBuilder() FindServersRes /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_FindServersResponse) GetIdentifier() string { - return "425" +func (m *_FindServersResponse) GetExtensionId() int32 { + return int32(425) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_FindServersResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_FindServersResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_FindServersResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_FindServersResponse) GetNoOfServers() int32 { - return m.NoOfServers -} - -func (m *_FindServersResponse) GetServers() []ExtensionObjectDefinition { +func (m *_FindServersResponse) GetServers() []ApplicationDescription { return m.Servers } @@ -265,7 +250,7 @@ func (m *_FindServersResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfServers) + // Implicit Field (noOfServers) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_FindServersResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_FindServersResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__findServersResponse FindServersResponse, err error) { +func (m *_FindServersResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__findServersResponse FindServersResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_FindServersResponse) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfServers, err := ReadSimpleField(ctx, "noOfServers", ReadSignedInt(readBuffer, uint8(32))) + noOfServers, err := ReadImplicitField[int32](ctx, "noOfServers", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServers' field")) } - m.NoOfServers = noOfServers + _ = noOfServers - servers, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "servers", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("310")), readBuffer), uint64(noOfServers)) + servers, err := ReadCountArrayField[ApplicationDescription](ctx, "servers", ReadComplex[ApplicationDescription](ExtensionObjectDefinitionParseWithBufferProducer[ApplicationDescription]((int32)(int32(310))), readBuffer), uint64(noOfServers)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'servers' field")) } @@ -339,11 +324,11 @@ func (m *_FindServersResponse) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for FindServersResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServers", m.GetNoOfServers(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServers := int32(utils.InlineIf(bool((m.GetServers()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServers()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServers", noOfServers, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServers' field") } @@ -371,9 +356,8 @@ func (m *_FindServersResponse) deepCopy() *_FindServersResponse { } _FindServersResponseCopy := &_FindServersResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfServers, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Servers), + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[ApplicationDescription, ApplicationDescription](m.Servers), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _FindServersResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/Frame.go b/plc4go/protocols/opcua/readwrite/model/Frame.go index f273b678cbb..9dce2507a40 100644 --- a/plc4go/protocols/opcua/readwrite/model/Frame.go +++ b/plc4go/protocols/opcua/readwrite/model/Frame.go @@ -150,8 +150,8 @@ func (b *_Frame) CreateFrameBuilder() FrameBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Frame) GetIdentifier() string { - return "18815" +func (m *_Frame) GetExtensionId() int32 { + return int32(18815) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_Frame) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Frame) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__frame Frame, err error) { +func (m *_Frame) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__frame Frame, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/GenericAttributeValue.go b/plc4go/protocols/opcua/readwrite/model/GenericAttributeValue.go index 5c7108defed..acd6553d8e4 100644 --- a/plc4go/protocols/opcua/readwrite/model/GenericAttributeValue.go +++ b/plc4go/protocols/opcua/readwrite/model/GenericAttributeValue.go @@ -198,8 +198,8 @@ func (b *_GenericAttributeValue) CreateGenericAttributeValueBuilder() GenericAtt /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_GenericAttributeValue) GetIdentifier() string { - return "17608" +func (m *_GenericAttributeValue) GetExtensionId() int32 { + return int32(17608) } /////////////////////// @@ -260,7 +260,7 @@ func (m *_GenericAttributeValue) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_GenericAttributeValue) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__genericAttributeValue GenericAttributeValue, err error) { +func (m *_GenericAttributeValue) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__genericAttributeValue GenericAttributeValue, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/GenericAttributes.go b/plc4go/protocols/opcua/readwrite/model/GenericAttributes.go new file mode 100644 index 00000000000..5ded2dad8f5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/GenericAttributes.go @@ -0,0 +1,519 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// GenericAttributes is the corresponding interface of GenericAttributes +type GenericAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetAttributeValues returns AttributeValues (property field) + GetAttributeValues() []GenericAttributeValue + // IsGenericAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsGenericAttributes() + // CreateBuilder creates a GenericAttributesBuilder + CreateGenericAttributesBuilder() GenericAttributesBuilder +} + +// _GenericAttributes is the data-structure of this message +type _GenericAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + AttributeValues []GenericAttributeValue +} + +var _ GenericAttributes = (*_GenericAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_GenericAttributes)(nil) + +// NewGenericAttributes factory function for _GenericAttributes +func NewGenericAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, attributeValues []GenericAttributeValue) *_GenericAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for GenericAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for GenericAttributes must not be nil") + } + _result := &_GenericAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + AttributeValues: attributeValues, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// GenericAttributesBuilder is a builder for GenericAttributes +type GenericAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, attributeValues []GenericAttributeValue) GenericAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) GenericAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) GenericAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) GenericAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) GenericAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) GenericAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) GenericAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) GenericAttributesBuilder + // WithAttributeValues adds AttributeValues (property field) + WithAttributeValues(...GenericAttributeValue) GenericAttributesBuilder + // Build builds the GenericAttributes or returns an error if something is wrong + Build() (GenericAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() GenericAttributes +} + +// NewGenericAttributesBuilder() creates a GenericAttributesBuilder +func NewGenericAttributesBuilder() GenericAttributesBuilder { + return &_GenericAttributesBuilder{_GenericAttributes: new(_GenericAttributes)} +} + +type _GenericAttributesBuilder struct { + *_GenericAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (GenericAttributesBuilder) = (*_GenericAttributesBuilder)(nil) + +func (b *_GenericAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_GenericAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, attributeValues []GenericAttributeValue) GenericAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithAttributeValues(attributeValues...) +} + +func (b *_GenericAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) GenericAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_GenericAttributesBuilder) WithDisplayName(displayName LocalizedText) GenericAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_GenericAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) GenericAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_GenericAttributesBuilder) WithDescription(description LocalizedText) GenericAttributesBuilder { + b.Description = description + return b +} + +func (b *_GenericAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) GenericAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_GenericAttributesBuilder) WithWriteMask(writeMask uint32) GenericAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_GenericAttributesBuilder) WithUserWriteMask(userWriteMask uint32) GenericAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_GenericAttributesBuilder) WithAttributeValues(attributeValues ...GenericAttributeValue) GenericAttributesBuilder { + b.AttributeValues = attributeValues + return b +} + +func (b *_GenericAttributesBuilder) Build() (GenericAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._GenericAttributes.deepCopy(), nil +} + +func (b *_GenericAttributesBuilder) MustBuild() GenericAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_GenericAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_GenericAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_GenericAttributesBuilder) DeepCopy() any { + _copy := b.CreateGenericAttributesBuilder().(*_GenericAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateGenericAttributesBuilder creates a GenericAttributesBuilder +func (b *_GenericAttributes) CreateGenericAttributesBuilder() GenericAttributesBuilder { + if b == nil { + return NewGenericAttributesBuilder() + } + return &_GenericAttributesBuilder{_GenericAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_GenericAttributes) GetExtensionId() int32 { + return int32(17609) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_GenericAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_GenericAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_GenericAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_GenericAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_GenericAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_GenericAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_GenericAttributes) GetAttributeValues() []GenericAttributeValue { + return m.AttributeValues +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastGenericAttributes(structType any) GenericAttributes { + if casted, ok := structType.(GenericAttributes); ok { + return casted + } + if casted, ok := structType.(*GenericAttributes); ok { + return *casted + } + return nil +} + +func (m *_GenericAttributes) GetTypeName() string { + return "GenericAttributes" +} + +func (m *_GenericAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Implicit Field (noOfAttributeValues) + lengthInBits += 32 + + // Array field + if len(m.AttributeValues) > 0 { + for _curItem, element := range m.AttributeValues { + arrayCtx := utils.CreateArrayContext(ctx, len(m.AttributeValues), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_GenericAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_GenericAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__genericAttributes GenericAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("GenericAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for GenericAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + noOfAttributeValues, err := ReadImplicitField[int32](ctx, "noOfAttributeValues", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAttributeValues' field")) + } + _ = noOfAttributeValues + + attributeValues, err := ReadCountArrayField[GenericAttributeValue](ctx, "attributeValues", ReadComplex[GenericAttributeValue](ExtensionObjectDefinitionParseWithBufferProducer[GenericAttributeValue]((int32)(int32(17608))), readBuffer), uint64(noOfAttributeValues)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'attributeValues' field")) + } + m.AttributeValues = attributeValues + + if closeErr := readBuffer.CloseContext("GenericAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for GenericAttributes") + } + + return m, nil +} + +func (m *_GenericAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_GenericAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("GenericAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for GenericAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + noOfAttributeValues := int32(utils.InlineIf(bool((m.GetAttributeValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAttributeValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAttributeValues", noOfAttributeValues, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfAttributeValues' field") + } + + if err := WriteComplexTypeArrayField(ctx, "attributeValues", m.GetAttributeValues(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'attributeValues' field") + } + + if popErr := writeBuffer.PopContext("GenericAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for GenericAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_GenericAttributes) IsGenericAttributes() {} + +func (m *_GenericAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_GenericAttributes) deepCopy() *_GenericAttributes { + if m == nil { + return nil + } + _GenericAttributesCopy := &_GenericAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + utils.DeepCopySlice[GenericAttributeValue, GenericAttributeValue](m.AttributeValues), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _GenericAttributesCopy +} + +func (m *_GenericAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/GetEndpointsRequest.go b/plc4go/protocols/opcua/readwrite/model/GetEndpointsRequest.go index 27328cc47d1..bf439ab19c3 100644 --- a/plc4go/protocols/opcua/readwrite/model/GetEndpointsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/GetEndpointsRequest.go @@ -41,15 +41,11 @@ type GetEndpointsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetEndpointUrl returns EndpointUrl (property field) GetEndpointUrl() PascalString - // GetNoOfLocaleIds returns NoOfLocaleIds (property field) - GetNoOfLocaleIds() int32 // GetLocaleIds returns LocaleIds (property field) GetLocaleIds() []PascalString - // GetNoOfProfileUris returns NoOfProfileUris (property field) - GetNoOfProfileUris() int32 // GetProfileUris returns ProfileUris (property field) GetProfileUris() []PascalString // IsGetEndpointsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -61,21 +57,19 @@ type GetEndpointsRequest interface { // _GetEndpointsRequest is the data-structure of this message type _GetEndpointsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - EndpointUrl PascalString - NoOfLocaleIds int32 - LocaleIds []PascalString - NoOfProfileUris int32 - ProfileUris []PascalString + RequestHeader RequestHeader + EndpointUrl PascalString + LocaleIds []PascalString + ProfileUris []PascalString } var _ GetEndpointsRequest = (*_GetEndpointsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_GetEndpointsRequest)(nil) // NewGetEndpointsRequest factory function for _GetEndpointsRequest -func NewGetEndpointsRequest(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfProfileUris int32, profileUris []PascalString) *_GetEndpointsRequest { +func NewGetEndpointsRequest(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, profileUris []PascalString) *_GetEndpointsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for GetEndpointsRequest must not be nil") + panic("requestHeader of type RequestHeader for GetEndpointsRequest must not be nil") } if endpointUrl == nil { panic("endpointUrl of type PascalString for GetEndpointsRequest must not be nil") @@ -84,9 +78,7 @@ func NewGetEndpointsRequest(requestHeader ExtensionObjectDefinition, endpointUrl ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, EndpointUrl: endpointUrl, - NoOfLocaleIds: noOfLocaleIds, LocaleIds: localeIds, - NoOfProfileUris: noOfProfileUris, ProfileUris: profileUris, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -102,21 +94,17 @@ func NewGetEndpointsRequest(requestHeader ExtensionObjectDefinition, endpointUrl type GetEndpointsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfProfileUris int32, profileUris []PascalString) GetEndpointsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, profileUris []PascalString) GetEndpointsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) GetEndpointsRequestBuilder + WithRequestHeader(RequestHeader) GetEndpointsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) GetEndpointsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) GetEndpointsRequestBuilder // WithEndpointUrl adds EndpointUrl (property field) WithEndpointUrl(PascalString) GetEndpointsRequestBuilder // WithEndpointUrlBuilder adds EndpointUrl (property field) which is build by the builder WithEndpointUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) GetEndpointsRequestBuilder - // WithNoOfLocaleIds adds NoOfLocaleIds (property field) - WithNoOfLocaleIds(int32) GetEndpointsRequestBuilder // WithLocaleIds adds LocaleIds (property field) WithLocaleIds(...PascalString) GetEndpointsRequestBuilder - // WithNoOfProfileUris adds NoOfProfileUris (property field) - WithNoOfProfileUris(int32) GetEndpointsRequestBuilder // WithProfileUris adds ProfileUris (property field) WithProfileUris(...PascalString) GetEndpointsRequestBuilder // Build builds the GetEndpointsRequest or returns an error if something is wrong @@ -144,24 +132,24 @@ func (b *_GetEndpointsRequestBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_GetEndpointsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, noOfProfileUris int32, profileUris []PascalString) GetEndpointsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithEndpointUrl(endpointUrl).WithNoOfLocaleIds(noOfLocaleIds).WithLocaleIds(localeIds...).WithNoOfProfileUris(noOfProfileUris).WithProfileUris(profileUris...) +func (b *_GetEndpointsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, endpointUrl PascalString, localeIds []PascalString, profileUris []PascalString) GetEndpointsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithEndpointUrl(endpointUrl).WithLocaleIds(localeIds...).WithProfileUris(profileUris...) } -func (b *_GetEndpointsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) GetEndpointsRequestBuilder { +func (b *_GetEndpointsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) GetEndpointsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_GetEndpointsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) GetEndpointsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_GetEndpointsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) GetEndpointsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -184,21 +172,11 @@ func (b *_GetEndpointsRequestBuilder) WithEndpointUrlBuilder(builderSupplier fun return b } -func (b *_GetEndpointsRequestBuilder) WithNoOfLocaleIds(noOfLocaleIds int32) GetEndpointsRequestBuilder { - b.NoOfLocaleIds = noOfLocaleIds - return b -} - func (b *_GetEndpointsRequestBuilder) WithLocaleIds(localeIds ...PascalString) GetEndpointsRequestBuilder { b.LocaleIds = localeIds return b } -func (b *_GetEndpointsRequestBuilder) WithNoOfProfileUris(noOfProfileUris int32) GetEndpointsRequestBuilder { - b.NoOfProfileUris = noOfProfileUris - return b -} - func (b *_GetEndpointsRequestBuilder) WithProfileUris(profileUris ...PascalString) GetEndpointsRequestBuilder { b.ProfileUris = profileUris return b @@ -266,8 +244,8 @@ func (b *_GetEndpointsRequest) CreateGetEndpointsRequestBuilder() GetEndpointsRe /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_GetEndpointsRequest) GetIdentifier() string { - return "428" +func (m *_GetEndpointsRequest) GetExtensionId() int32 { + return int32(428) } /////////////////////// @@ -284,7 +262,7 @@ func (m *_GetEndpointsRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_GetEndpointsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_GetEndpointsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -292,18 +270,10 @@ func (m *_GetEndpointsRequest) GetEndpointUrl() PascalString { return m.EndpointUrl } -func (m *_GetEndpointsRequest) GetNoOfLocaleIds() int32 { - return m.NoOfLocaleIds -} - func (m *_GetEndpointsRequest) GetLocaleIds() []PascalString { return m.LocaleIds } -func (m *_GetEndpointsRequest) GetNoOfProfileUris() int32 { - return m.NoOfProfileUris -} - func (m *_GetEndpointsRequest) GetProfileUris() []PascalString { return m.ProfileUris } @@ -337,7 +307,7 @@ func (m *_GetEndpointsRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (endpointUrl) lengthInBits += m.EndpointUrl.GetLengthInBits(ctx) - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32 // Array field @@ -350,7 +320,7 @@ func (m *_GetEndpointsRequest) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfProfileUris) + // Implicit Field (noOfProfileUris) lengthInBits += 32 // Array field @@ -370,7 +340,7 @@ func (m *_GetEndpointsRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_GetEndpointsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__getEndpointsRequest GetEndpointsRequest, err error) { +func (m *_GetEndpointsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__getEndpointsRequest GetEndpointsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -381,7 +351,7 @@ func (m *_GetEndpointsRequest) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -393,11 +363,11 @@ func (m *_GetEndpointsRequest) parse(ctx context.Context, readBuffer utils.ReadB } m.EndpointUrl = endpointUrl - noOfLocaleIds, err := ReadSimpleField(ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) } - m.NoOfLocaleIds = noOfLocaleIds + _ = noOfLocaleIds localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) if err != nil { @@ -405,11 +375,11 @@ func (m *_GetEndpointsRequest) parse(ctx context.Context, readBuffer utils.ReadB } m.LocaleIds = localeIds - noOfProfileUris, err := ReadSimpleField(ctx, "noOfProfileUris", ReadSignedInt(readBuffer, uint8(32))) + noOfProfileUris, err := ReadImplicitField[int32](ctx, "noOfProfileUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfProfileUris' field")) } - m.NoOfProfileUris = noOfProfileUris + _ = noOfProfileUris profileUris, err := ReadCountArrayField[PascalString](ctx, "profileUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfProfileUris)) if err != nil { @@ -442,23 +412,23 @@ func (m *_GetEndpointsRequest) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for GetEndpointsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } if err := WriteSimpleField[PascalString](ctx, "endpointUrl", m.GetEndpointUrl(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'endpointUrl' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLocaleIds", m.GetNoOfLocaleIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") } if err := WriteComplexTypeArrayField(ctx, "localeIds", m.GetLocaleIds(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'localeIds' field") } - - if err := WriteSimpleField[int32](ctx, "noOfProfileUris", m.GetNoOfProfileUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfProfileUris := int32(utils.InlineIf(bool((m.GetProfileUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetProfileUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfProfileUris", noOfProfileUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfProfileUris' field") } @@ -486,11 +456,9 @@ func (m *_GetEndpointsRequest) deepCopy() *_GetEndpointsRequest { } _GetEndpointsRequestCopy := &_GetEndpointsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.EndpointUrl.DeepCopy().(PascalString), - m.NoOfLocaleIds, utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), - m.NoOfProfileUris, utils.DeepCopySlice[PascalString, PascalString](m.ProfileUris), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/GetEndpointsResponse.go b/plc4go/protocols/opcua/readwrite/model/GetEndpointsResponse.go index 4cc9c984cfb..0d90cd5b0e3 100644 --- a/plc4go/protocols/opcua/readwrite/model/GetEndpointsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/GetEndpointsResponse.go @@ -41,11 +41,9 @@ type GetEndpointsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfEndpoints returns NoOfEndpoints (property field) - GetNoOfEndpoints() int32 + GetResponseHeader() ResponseHeader // GetEndpoints returns Endpoints (property field) - GetEndpoints() []ExtensionObjectDefinition + GetEndpoints() []EndpointDescription // IsGetEndpointsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsGetEndpointsResponse() // CreateBuilder creates a GetEndpointsResponseBuilder @@ -55,23 +53,21 @@ type GetEndpointsResponse interface { // _GetEndpointsResponse is the data-structure of this message type _GetEndpointsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfEndpoints int32 - Endpoints []ExtensionObjectDefinition + ResponseHeader ResponseHeader + Endpoints []EndpointDescription } var _ GetEndpointsResponse = (*_GetEndpointsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_GetEndpointsResponse)(nil) // NewGetEndpointsResponse factory function for _GetEndpointsResponse -func NewGetEndpointsResponse(responseHeader ExtensionObjectDefinition, noOfEndpoints int32, endpoints []ExtensionObjectDefinition) *_GetEndpointsResponse { +func NewGetEndpointsResponse(responseHeader ResponseHeader, endpoints []EndpointDescription) *_GetEndpointsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for GetEndpointsResponse must not be nil") + panic("responseHeader of type ResponseHeader for GetEndpointsResponse must not be nil") } _result := &_GetEndpointsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfEndpoints: noOfEndpoints, Endpoints: endpoints, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewGetEndpointsResponse(responseHeader ExtensionObjectDefinition, noOfEndpo type GetEndpointsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfEndpoints int32, endpoints []ExtensionObjectDefinition) GetEndpointsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, endpoints []EndpointDescription) GetEndpointsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) GetEndpointsResponseBuilder + WithResponseHeader(ResponseHeader) GetEndpointsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) GetEndpointsResponseBuilder - // WithNoOfEndpoints adds NoOfEndpoints (property field) - WithNoOfEndpoints(int32) GetEndpointsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) GetEndpointsResponseBuilder // WithEndpoints adds Endpoints (property field) - WithEndpoints(...ExtensionObjectDefinition) GetEndpointsResponseBuilder + WithEndpoints(...EndpointDescription) GetEndpointsResponseBuilder // Build builds the GetEndpointsResponse or returns an error if something is wrong Build() (GetEndpointsResponse, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_GetEndpointsResponseBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_GetEndpointsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfEndpoints int32, endpoints []ExtensionObjectDefinition) GetEndpointsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfEndpoints(noOfEndpoints).WithEndpoints(endpoints...) +func (b *_GetEndpointsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, endpoints []EndpointDescription) GetEndpointsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithEndpoints(endpoints...) } -func (b *_GetEndpointsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) GetEndpointsResponseBuilder { +func (b *_GetEndpointsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) GetEndpointsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_GetEndpointsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) GetEndpointsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_GetEndpointsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) GetEndpointsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_GetEndpointsResponseBuilder) WithNoOfEndpoints(noOfEndpoints int32) GetEndpointsResponseBuilder { - b.NoOfEndpoints = noOfEndpoints - return b -} - -func (b *_GetEndpointsResponseBuilder) WithEndpoints(endpoints ...ExtensionObjectDefinition) GetEndpointsResponseBuilder { +func (b *_GetEndpointsResponseBuilder) WithEndpoints(endpoints ...EndpointDescription) GetEndpointsResponseBuilder { b.Endpoints = endpoints return b } @@ -209,8 +198,8 @@ func (b *_GetEndpointsResponse) CreateGetEndpointsResponseBuilder() GetEndpoints /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_GetEndpointsResponse) GetIdentifier() string { - return "431" +func (m *_GetEndpointsResponse) GetExtensionId() int32 { + return int32(431) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_GetEndpointsResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_GetEndpointsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_GetEndpointsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_GetEndpointsResponse) GetNoOfEndpoints() int32 { - return m.NoOfEndpoints -} - -func (m *_GetEndpointsResponse) GetEndpoints() []ExtensionObjectDefinition { +func (m *_GetEndpointsResponse) GetEndpoints() []EndpointDescription { return m.Endpoints } @@ -265,7 +250,7 @@ func (m *_GetEndpointsResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfEndpoints) + // Implicit Field (noOfEndpoints) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_GetEndpointsResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_GetEndpointsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__getEndpointsResponse GetEndpointsResponse, err error) { +func (m *_GetEndpointsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__getEndpointsResponse GetEndpointsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_GetEndpointsResponse) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfEndpoints, err := ReadSimpleField(ctx, "noOfEndpoints", ReadSignedInt(readBuffer, uint8(32))) + noOfEndpoints, err := ReadImplicitField[int32](ctx, "noOfEndpoints", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEndpoints' field")) } - m.NoOfEndpoints = noOfEndpoints + _ = noOfEndpoints - endpoints, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "endpoints", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("314")), readBuffer), uint64(noOfEndpoints)) + endpoints, err := ReadCountArrayField[EndpointDescription](ctx, "endpoints", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfEndpoints)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endpoints' field")) } @@ -339,11 +324,11 @@ func (m *_GetEndpointsResponse) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for GetEndpointsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfEndpoints", m.GetNoOfEndpoints(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEndpoints := int32(utils.InlineIf(bool((m.GetEndpoints()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEndpoints()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEndpoints", noOfEndpoints, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEndpoints' field") } @@ -371,9 +356,8 @@ func (m *_GetEndpointsResponse) deepCopy() *_GetEndpointsResponse { } _GetEndpointsResponseCopy := &_GetEndpointsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfEndpoints, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Endpoints), + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.Endpoints), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _GetEndpointsResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryData.go b/plc4go/protocols/opcua/readwrite/model/HistoryData.go index 8b1e5466879..df02ead6d94 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryData.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryData.go @@ -40,8 +40,6 @@ type HistoryData interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfDataValues returns NoOfDataValues (property field) - GetNoOfDataValues() int32 // GetDataValues returns DataValues (property field) GetDataValues() []DataValue // IsHistoryData is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,18 +51,16 @@ type HistoryData interface { // _HistoryData is the data-structure of this message type _HistoryData struct { ExtensionObjectDefinitionContract - NoOfDataValues int32 - DataValues []DataValue + DataValues []DataValue } var _ HistoryData = (*_HistoryData)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryData)(nil) // NewHistoryData factory function for _HistoryData -func NewHistoryData(noOfDataValues int32, dataValues []DataValue) *_HistoryData { +func NewHistoryData(dataValues []DataValue) *_HistoryData { _result := &_HistoryData{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfDataValues: noOfDataValues, DataValues: dataValues, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,9 +76,7 @@ func NewHistoryData(noOfDataValues int32, dataValues []DataValue) *_HistoryData type HistoryDataBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfDataValues int32, dataValues []DataValue) HistoryDataBuilder - // WithNoOfDataValues adds NoOfDataValues (property field) - WithNoOfDataValues(int32) HistoryDataBuilder + WithMandatoryFields(dataValues []DataValue) HistoryDataBuilder // WithDataValues adds DataValues (property field) WithDataValues(...DataValue) HistoryDataBuilder // Build builds the HistoryData or returns an error if something is wrong @@ -110,13 +104,8 @@ func (b *_HistoryDataBuilder) setParent(contract ExtensionObjectDefinitionContra b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryDataBuilder) WithMandatoryFields(noOfDataValues int32, dataValues []DataValue) HistoryDataBuilder { - return b.WithNoOfDataValues(noOfDataValues).WithDataValues(dataValues...) -} - -func (b *_HistoryDataBuilder) WithNoOfDataValues(noOfDataValues int32) HistoryDataBuilder { - b.NoOfDataValues = noOfDataValues - return b +func (b *_HistoryDataBuilder) WithMandatoryFields(dataValues []DataValue) HistoryDataBuilder { + return b.WithDataValues(dataValues...) } func (b *_HistoryDataBuilder) WithDataValues(dataValues ...DataValue) HistoryDataBuilder { @@ -174,8 +163,8 @@ func (b *_HistoryData) CreateHistoryDataBuilder() HistoryDataBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryData) GetIdentifier() string { - return "658" +func (m *_HistoryData) GetExtensionId() int32 { + return int32(658) } /////////////////////// @@ -192,10 +181,6 @@ func (m *_HistoryData) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryData) GetNoOfDataValues() int32 { - return m.NoOfDataValues -} - func (m *_HistoryData) GetDataValues() []DataValue { return m.DataValues } @@ -223,7 +208,7 @@ func (m *_HistoryData) GetTypeName() string { func (m *_HistoryData) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfDataValues) + // Implicit Field (noOfDataValues) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_HistoryData) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyData HistoryData, err error) { +func (m *_HistoryData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyData HistoryData, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,11 +239,11 @@ func (m *_HistoryData) parse(ctx context.Context, readBuffer utils.ReadBuffer, p currentPos := positionAware.GetPos() _ = currentPos - noOfDataValues, err := ReadSimpleField(ctx, "noOfDataValues", ReadSignedInt(readBuffer, uint8(32))) + noOfDataValues, err := ReadImplicitField[int32](ctx, "noOfDataValues", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataValues' field")) } - m.NoOfDataValues = noOfDataValues + _ = noOfDataValues dataValues, err := ReadCountArrayField[DataValue](ctx, "dataValues", ReadComplex[DataValue](DataValueParseWithBuffer, readBuffer), uint64(noOfDataValues)) if err != nil { @@ -290,8 +275,8 @@ func (m *_HistoryData) SerializeWithWriteBuffer(ctx context.Context, writeBuffer if pushErr := writeBuffer.PushContext("HistoryData"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for HistoryData") } - - if err := WriteSimpleField[int32](ctx, "noOfDataValues", m.GetNoOfDataValues(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDataValues := int32(utils.InlineIf(bool((m.GetDataValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataValues", noOfDataValues, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDataValues' field") } @@ -319,7 +304,6 @@ func (m *_HistoryData) deepCopy() *_HistoryData { } _HistoryDataCopy := &_HistoryData{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfDataValues, utils.DeepCopySlice[DataValue, DataValue](m.DataValues), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryEvent.go b/plc4go/protocols/opcua/readwrite/model/HistoryEvent.go index 2380eb2652f..f050d7a3068 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryEvent.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryEvent.go @@ -40,10 +40,8 @@ type HistoryEvent interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfEvents returns NoOfEvents (property field) - GetNoOfEvents() int32 // GetEvents returns Events (property field) - GetEvents() []ExtensionObjectDefinition + GetEvents() []HistoryEventFieldList // IsHistoryEvent is a marker method to prevent unintentional type checks (interfaces of same signature) IsHistoryEvent() // CreateBuilder creates a HistoryEventBuilder @@ -53,18 +51,16 @@ type HistoryEvent interface { // _HistoryEvent is the data-structure of this message type _HistoryEvent struct { ExtensionObjectDefinitionContract - NoOfEvents int32 - Events []ExtensionObjectDefinition + Events []HistoryEventFieldList } var _ HistoryEvent = (*_HistoryEvent)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryEvent)(nil) // NewHistoryEvent factory function for _HistoryEvent -func NewHistoryEvent(noOfEvents int32, events []ExtensionObjectDefinition) *_HistoryEvent { +func NewHistoryEvent(events []HistoryEventFieldList) *_HistoryEvent { _result := &_HistoryEvent{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfEvents: noOfEvents, Events: events, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,11 +76,9 @@ func NewHistoryEvent(noOfEvents int32, events []ExtensionObjectDefinition) *_His type HistoryEventBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfEvents int32, events []ExtensionObjectDefinition) HistoryEventBuilder - // WithNoOfEvents adds NoOfEvents (property field) - WithNoOfEvents(int32) HistoryEventBuilder + WithMandatoryFields(events []HistoryEventFieldList) HistoryEventBuilder // WithEvents adds Events (property field) - WithEvents(...ExtensionObjectDefinition) HistoryEventBuilder + WithEvents(...HistoryEventFieldList) HistoryEventBuilder // Build builds the HistoryEvent or returns an error if something is wrong Build() (HistoryEvent, error) // MustBuild does the same as Build but panics on error @@ -110,16 +104,11 @@ func (b *_HistoryEventBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryEventBuilder) WithMandatoryFields(noOfEvents int32, events []ExtensionObjectDefinition) HistoryEventBuilder { - return b.WithNoOfEvents(noOfEvents).WithEvents(events...) +func (b *_HistoryEventBuilder) WithMandatoryFields(events []HistoryEventFieldList) HistoryEventBuilder { + return b.WithEvents(events...) } -func (b *_HistoryEventBuilder) WithNoOfEvents(noOfEvents int32) HistoryEventBuilder { - b.NoOfEvents = noOfEvents - return b -} - -func (b *_HistoryEventBuilder) WithEvents(events ...ExtensionObjectDefinition) HistoryEventBuilder { +func (b *_HistoryEventBuilder) WithEvents(events ...HistoryEventFieldList) HistoryEventBuilder { b.Events = events return b } @@ -174,8 +163,8 @@ func (b *_HistoryEvent) CreateHistoryEventBuilder() HistoryEventBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryEvent) GetIdentifier() string { - return "661" +func (m *_HistoryEvent) GetExtensionId() int32 { + return int32(661) } /////////////////////// @@ -192,11 +181,7 @@ func (m *_HistoryEvent) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryEvent) GetNoOfEvents() int32 { - return m.NoOfEvents -} - -func (m *_HistoryEvent) GetEvents() []ExtensionObjectDefinition { +func (m *_HistoryEvent) GetEvents() []HistoryEventFieldList { return m.Events } @@ -223,7 +208,7 @@ func (m *_HistoryEvent) GetTypeName() string { func (m *_HistoryEvent) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfEvents) + // Implicit Field (noOfEvents) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_HistoryEvent) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryEvent) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyEvent HistoryEvent, err error) { +func (m *_HistoryEvent) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyEvent HistoryEvent, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,13 +239,13 @@ func (m *_HistoryEvent) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - noOfEvents, err := ReadSimpleField(ctx, "noOfEvents", ReadSignedInt(readBuffer, uint8(32))) + noOfEvents, err := ReadImplicitField[int32](ctx, "noOfEvents", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEvents' field")) } - m.NoOfEvents = noOfEvents + _ = noOfEvents - events, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "events", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("922")), readBuffer), uint64(noOfEvents)) + events, err := ReadCountArrayField[HistoryEventFieldList](ctx, "events", ReadComplex[HistoryEventFieldList](ExtensionObjectDefinitionParseWithBufferProducer[HistoryEventFieldList]((int32)(int32(922))), readBuffer), uint64(noOfEvents)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'events' field")) } @@ -290,8 +275,8 @@ func (m *_HistoryEvent) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if pushErr := writeBuffer.PushContext("HistoryEvent"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for HistoryEvent") } - - if err := WriteSimpleField[int32](ctx, "noOfEvents", m.GetNoOfEvents(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEvents := int32(utils.InlineIf(bool((m.GetEvents()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEvents()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEvents", noOfEvents, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEvents' field") } @@ -319,8 +304,7 @@ func (m *_HistoryEvent) deepCopy() *_HistoryEvent { } _HistoryEventCopy := &_HistoryEvent{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfEvents, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Events), + utils.DeepCopySlice[HistoryEventFieldList, HistoryEventFieldList](m.Events), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _HistoryEventCopy diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryEventFieldList.go b/plc4go/protocols/opcua/readwrite/model/HistoryEventFieldList.go index 310e350ef16..2044559bb85 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryEventFieldList.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryEventFieldList.go @@ -40,8 +40,6 @@ type HistoryEventFieldList interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfEventFields returns NoOfEventFields (property field) - GetNoOfEventFields() int32 // GetEventFields returns EventFields (property field) GetEventFields() []Variant // IsHistoryEventFieldList is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -53,18 +51,16 @@ type HistoryEventFieldList interface { // _HistoryEventFieldList is the data-structure of this message type _HistoryEventFieldList struct { ExtensionObjectDefinitionContract - NoOfEventFields int32 - EventFields []Variant + EventFields []Variant } var _ HistoryEventFieldList = (*_HistoryEventFieldList)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryEventFieldList)(nil) // NewHistoryEventFieldList factory function for _HistoryEventFieldList -func NewHistoryEventFieldList(noOfEventFields int32, eventFields []Variant) *_HistoryEventFieldList { +func NewHistoryEventFieldList(eventFields []Variant) *_HistoryEventFieldList { _result := &_HistoryEventFieldList{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfEventFields: noOfEventFields, EventFields: eventFields, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,9 +76,7 @@ func NewHistoryEventFieldList(noOfEventFields int32, eventFields []Variant) *_Hi type HistoryEventFieldListBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfEventFields int32, eventFields []Variant) HistoryEventFieldListBuilder - // WithNoOfEventFields adds NoOfEventFields (property field) - WithNoOfEventFields(int32) HistoryEventFieldListBuilder + WithMandatoryFields(eventFields []Variant) HistoryEventFieldListBuilder // WithEventFields adds EventFields (property field) WithEventFields(...Variant) HistoryEventFieldListBuilder // Build builds the HistoryEventFieldList or returns an error if something is wrong @@ -110,13 +104,8 @@ func (b *_HistoryEventFieldListBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryEventFieldListBuilder) WithMandatoryFields(noOfEventFields int32, eventFields []Variant) HistoryEventFieldListBuilder { - return b.WithNoOfEventFields(noOfEventFields).WithEventFields(eventFields...) -} - -func (b *_HistoryEventFieldListBuilder) WithNoOfEventFields(noOfEventFields int32) HistoryEventFieldListBuilder { - b.NoOfEventFields = noOfEventFields - return b +func (b *_HistoryEventFieldListBuilder) WithMandatoryFields(eventFields []Variant) HistoryEventFieldListBuilder { + return b.WithEventFields(eventFields...) } func (b *_HistoryEventFieldListBuilder) WithEventFields(eventFields ...Variant) HistoryEventFieldListBuilder { @@ -174,8 +163,8 @@ func (b *_HistoryEventFieldList) CreateHistoryEventFieldListBuilder() HistoryEve /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryEventFieldList) GetIdentifier() string { - return "922" +func (m *_HistoryEventFieldList) GetExtensionId() int32 { + return int32(922) } /////////////////////// @@ -192,10 +181,6 @@ func (m *_HistoryEventFieldList) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryEventFieldList) GetNoOfEventFields() int32 { - return m.NoOfEventFields -} - func (m *_HistoryEventFieldList) GetEventFields() []Variant { return m.EventFields } @@ -223,7 +208,7 @@ func (m *_HistoryEventFieldList) GetTypeName() string { func (m *_HistoryEventFieldList) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfEventFields) + // Implicit Field (noOfEventFields) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_HistoryEventFieldList) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryEventFieldList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyEventFieldList HistoryEventFieldList, err error) { +func (m *_HistoryEventFieldList) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyEventFieldList HistoryEventFieldList, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,11 +239,11 @@ func (m *_HistoryEventFieldList) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - noOfEventFields, err := ReadSimpleField(ctx, "noOfEventFields", ReadSignedInt(readBuffer, uint8(32))) + noOfEventFields, err := ReadImplicitField[int32](ctx, "noOfEventFields", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEventFields' field")) } - m.NoOfEventFields = noOfEventFields + _ = noOfEventFields eventFields, err := ReadCountArrayField[Variant](ctx, "eventFields", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfEventFields)) if err != nil { @@ -290,8 +275,8 @@ func (m *_HistoryEventFieldList) SerializeWithWriteBuffer(ctx context.Context, w if pushErr := writeBuffer.PushContext("HistoryEventFieldList"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for HistoryEventFieldList") } - - if err := WriteSimpleField[int32](ctx, "noOfEventFields", m.GetNoOfEventFields(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfEventFields := int32(utils.InlineIf(bool((m.GetEventFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEventFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEventFields", noOfEventFields, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfEventFields' field") } @@ -319,7 +304,6 @@ func (m *_HistoryEventFieldList) deepCopy() *_HistoryEventFieldList { } _HistoryEventFieldListCopy := &_HistoryEventFieldList{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfEventFields, utils.DeepCopySlice[Variant, Variant](m.EventFields), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryModifiedData.go b/plc4go/protocols/opcua/readwrite/model/HistoryModifiedData.go new file mode 100644 index 00000000000..9af76d73095 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/HistoryModifiedData.go @@ -0,0 +1,375 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// HistoryModifiedData is the corresponding interface of HistoryModifiedData +type HistoryModifiedData interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataValues returns DataValues (property field) + GetDataValues() []DataValue + // GetModificationInfos returns ModificationInfos (property field) + GetModificationInfos() []ModificationInfo + // IsHistoryModifiedData is a marker method to prevent unintentional type checks (interfaces of same signature) + IsHistoryModifiedData() + // CreateBuilder creates a HistoryModifiedDataBuilder + CreateHistoryModifiedDataBuilder() HistoryModifiedDataBuilder +} + +// _HistoryModifiedData is the data-structure of this message +type _HistoryModifiedData struct { + ExtensionObjectDefinitionContract + DataValues []DataValue + ModificationInfos []ModificationInfo +} + +var _ HistoryModifiedData = (*_HistoryModifiedData)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_HistoryModifiedData)(nil) + +// NewHistoryModifiedData factory function for _HistoryModifiedData +func NewHistoryModifiedData(dataValues []DataValue, modificationInfos []ModificationInfo) *_HistoryModifiedData { + _result := &_HistoryModifiedData{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataValues: dataValues, + ModificationInfos: modificationInfos, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// HistoryModifiedDataBuilder is a builder for HistoryModifiedData +type HistoryModifiedDataBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataValues []DataValue, modificationInfos []ModificationInfo) HistoryModifiedDataBuilder + // WithDataValues adds DataValues (property field) + WithDataValues(...DataValue) HistoryModifiedDataBuilder + // WithModificationInfos adds ModificationInfos (property field) + WithModificationInfos(...ModificationInfo) HistoryModifiedDataBuilder + // Build builds the HistoryModifiedData or returns an error if something is wrong + Build() (HistoryModifiedData, error) + // MustBuild does the same as Build but panics on error + MustBuild() HistoryModifiedData +} + +// NewHistoryModifiedDataBuilder() creates a HistoryModifiedDataBuilder +func NewHistoryModifiedDataBuilder() HistoryModifiedDataBuilder { + return &_HistoryModifiedDataBuilder{_HistoryModifiedData: new(_HistoryModifiedData)} +} + +type _HistoryModifiedDataBuilder struct { + *_HistoryModifiedData + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (HistoryModifiedDataBuilder) = (*_HistoryModifiedDataBuilder)(nil) + +func (b *_HistoryModifiedDataBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_HistoryModifiedDataBuilder) WithMandatoryFields(dataValues []DataValue, modificationInfos []ModificationInfo) HistoryModifiedDataBuilder { + return b.WithDataValues(dataValues...).WithModificationInfos(modificationInfos...) +} + +func (b *_HistoryModifiedDataBuilder) WithDataValues(dataValues ...DataValue) HistoryModifiedDataBuilder { + b.DataValues = dataValues + return b +} + +func (b *_HistoryModifiedDataBuilder) WithModificationInfos(modificationInfos ...ModificationInfo) HistoryModifiedDataBuilder { + b.ModificationInfos = modificationInfos + return b +} + +func (b *_HistoryModifiedDataBuilder) Build() (HistoryModifiedData, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._HistoryModifiedData.deepCopy(), nil +} + +func (b *_HistoryModifiedDataBuilder) MustBuild() HistoryModifiedData { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_HistoryModifiedDataBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_HistoryModifiedDataBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_HistoryModifiedDataBuilder) DeepCopy() any { + _copy := b.CreateHistoryModifiedDataBuilder().(*_HistoryModifiedDataBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateHistoryModifiedDataBuilder creates a HistoryModifiedDataBuilder +func (b *_HistoryModifiedData) CreateHistoryModifiedDataBuilder() HistoryModifiedDataBuilder { + if b == nil { + return NewHistoryModifiedDataBuilder() + } + return &_HistoryModifiedDataBuilder{_HistoryModifiedData: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_HistoryModifiedData) GetExtensionId() int32 { + return int32(11219) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_HistoryModifiedData) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_HistoryModifiedData) GetDataValues() []DataValue { + return m.DataValues +} + +func (m *_HistoryModifiedData) GetModificationInfos() []ModificationInfo { + return m.ModificationInfos +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastHistoryModifiedData(structType any) HistoryModifiedData { + if casted, ok := structType.(HistoryModifiedData); ok { + return casted + } + if casted, ok := structType.(*HistoryModifiedData); ok { + return *casted + } + return nil +} + +func (m *_HistoryModifiedData) GetTypeName() string { + return "HistoryModifiedData" +} + +func (m *_HistoryModifiedData) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfDataValues) + lengthInBits += 32 + + // Array field + if len(m.DataValues) > 0 { + for _curItem, element := range m.DataValues { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataValues), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfModificationInfos) + lengthInBits += 32 + + // Array field + if len(m.ModificationInfos) > 0 { + for _curItem, element := range m.ModificationInfos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.ModificationInfos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_HistoryModifiedData) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_HistoryModifiedData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyModifiedData HistoryModifiedData, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("HistoryModifiedData"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for HistoryModifiedData") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfDataValues, err := ReadImplicitField[int32](ctx, "noOfDataValues", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataValues' field")) + } + _ = noOfDataValues + + dataValues, err := ReadCountArrayField[DataValue](ctx, "dataValues", ReadComplex[DataValue](DataValueParseWithBuffer, readBuffer), uint64(noOfDataValues)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataValues' field")) + } + m.DataValues = dataValues + + noOfModificationInfos, err := ReadImplicitField[int32](ctx, "noOfModificationInfos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfModificationInfos' field")) + } + _ = noOfModificationInfos + + modificationInfos, err := ReadCountArrayField[ModificationInfo](ctx, "modificationInfos", ReadComplex[ModificationInfo](ExtensionObjectDefinitionParseWithBufferProducer[ModificationInfo]((int32)(int32(11218))), readBuffer), uint64(noOfModificationInfos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'modificationInfos' field")) + } + m.ModificationInfos = modificationInfos + + if closeErr := readBuffer.CloseContext("HistoryModifiedData"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for HistoryModifiedData") + } + + return m, nil +} + +func (m *_HistoryModifiedData) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_HistoryModifiedData) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("HistoryModifiedData"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for HistoryModifiedData") + } + noOfDataValues := int32(utils.InlineIf(bool((m.GetDataValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataValues", noOfDataValues, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataValues' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataValues", m.GetDataValues(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataValues' field") + } + noOfModificationInfos := int32(utils.InlineIf(bool((m.GetModificationInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetModificationInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfModificationInfos", noOfModificationInfos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfModificationInfos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "modificationInfos", m.GetModificationInfos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'modificationInfos' field") + } + + if popErr := writeBuffer.PopContext("HistoryModifiedData"); popErr != nil { + return errors.Wrap(popErr, "Error popping for HistoryModifiedData") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_HistoryModifiedData) IsHistoryModifiedData() {} + +func (m *_HistoryModifiedData) DeepCopy() any { + return m.deepCopy() +} + +func (m *_HistoryModifiedData) deepCopy() *_HistoryModifiedData { + if m == nil { + return nil + } + _HistoryModifiedDataCopy := &_HistoryModifiedData{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[DataValue, DataValue](m.DataValues), + utils.DeepCopySlice[ModificationInfo, ModificationInfo](m.ModificationInfos), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _HistoryModifiedDataCopy +} + +func (m *_HistoryModifiedData) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryModifiedEvent.go b/plc4go/protocols/opcua/readwrite/model/HistoryModifiedEvent.go new file mode 100644 index 00000000000..ca2cbe42913 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/HistoryModifiedEvent.go @@ -0,0 +1,375 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// HistoryModifiedEvent is the corresponding interface of HistoryModifiedEvent +type HistoryModifiedEvent interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetEvents returns Events (property field) + GetEvents() []HistoryEventFieldList + // GetModificationInfos returns ModificationInfos (property field) + GetModificationInfos() []ModificationInfo + // IsHistoryModifiedEvent is a marker method to prevent unintentional type checks (interfaces of same signature) + IsHistoryModifiedEvent() + // CreateBuilder creates a HistoryModifiedEventBuilder + CreateHistoryModifiedEventBuilder() HistoryModifiedEventBuilder +} + +// _HistoryModifiedEvent is the data-structure of this message +type _HistoryModifiedEvent struct { + ExtensionObjectDefinitionContract + Events []HistoryEventFieldList + ModificationInfos []ModificationInfo +} + +var _ HistoryModifiedEvent = (*_HistoryModifiedEvent)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_HistoryModifiedEvent)(nil) + +// NewHistoryModifiedEvent factory function for _HistoryModifiedEvent +func NewHistoryModifiedEvent(events []HistoryEventFieldList, modificationInfos []ModificationInfo) *_HistoryModifiedEvent { + _result := &_HistoryModifiedEvent{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Events: events, + ModificationInfos: modificationInfos, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// HistoryModifiedEventBuilder is a builder for HistoryModifiedEvent +type HistoryModifiedEventBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(events []HistoryEventFieldList, modificationInfos []ModificationInfo) HistoryModifiedEventBuilder + // WithEvents adds Events (property field) + WithEvents(...HistoryEventFieldList) HistoryModifiedEventBuilder + // WithModificationInfos adds ModificationInfos (property field) + WithModificationInfos(...ModificationInfo) HistoryModifiedEventBuilder + // Build builds the HistoryModifiedEvent or returns an error if something is wrong + Build() (HistoryModifiedEvent, error) + // MustBuild does the same as Build but panics on error + MustBuild() HistoryModifiedEvent +} + +// NewHistoryModifiedEventBuilder() creates a HistoryModifiedEventBuilder +func NewHistoryModifiedEventBuilder() HistoryModifiedEventBuilder { + return &_HistoryModifiedEventBuilder{_HistoryModifiedEvent: new(_HistoryModifiedEvent)} +} + +type _HistoryModifiedEventBuilder struct { + *_HistoryModifiedEvent + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (HistoryModifiedEventBuilder) = (*_HistoryModifiedEventBuilder)(nil) + +func (b *_HistoryModifiedEventBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_HistoryModifiedEventBuilder) WithMandatoryFields(events []HistoryEventFieldList, modificationInfos []ModificationInfo) HistoryModifiedEventBuilder { + return b.WithEvents(events...).WithModificationInfos(modificationInfos...) +} + +func (b *_HistoryModifiedEventBuilder) WithEvents(events ...HistoryEventFieldList) HistoryModifiedEventBuilder { + b.Events = events + return b +} + +func (b *_HistoryModifiedEventBuilder) WithModificationInfos(modificationInfos ...ModificationInfo) HistoryModifiedEventBuilder { + b.ModificationInfos = modificationInfos + return b +} + +func (b *_HistoryModifiedEventBuilder) Build() (HistoryModifiedEvent, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._HistoryModifiedEvent.deepCopy(), nil +} + +func (b *_HistoryModifiedEventBuilder) MustBuild() HistoryModifiedEvent { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_HistoryModifiedEventBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_HistoryModifiedEventBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_HistoryModifiedEventBuilder) DeepCopy() any { + _copy := b.CreateHistoryModifiedEventBuilder().(*_HistoryModifiedEventBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateHistoryModifiedEventBuilder creates a HistoryModifiedEventBuilder +func (b *_HistoryModifiedEvent) CreateHistoryModifiedEventBuilder() HistoryModifiedEventBuilder { + if b == nil { + return NewHistoryModifiedEventBuilder() + } + return &_HistoryModifiedEventBuilder{_HistoryModifiedEvent: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_HistoryModifiedEvent) GetExtensionId() int32 { + return int32(32826) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_HistoryModifiedEvent) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_HistoryModifiedEvent) GetEvents() []HistoryEventFieldList { + return m.Events +} + +func (m *_HistoryModifiedEvent) GetModificationInfos() []ModificationInfo { + return m.ModificationInfos +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastHistoryModifiedEvent(structType any) HistoryModifiedEvent { + if casted, ok := structType.(HistoryModifiedEvent); ok { + return casted + } + if casted, ok := structType.(*HistoryModifiedEvent); ok { + return *casted + } + return nil +} + +func (m *_HistoryModifiedEvent) GetTypeName() string { + return "HistoryModifiedEvent" +} + +func (m *_HistoryModifiedEvent) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfEvents) + lengthInBits += 32 + + // Array field + if len(m.Events) > 0 { + for _curItem, element := range m.Events { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Events), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfModificationInfos) + lengthInBits += 32 + + // Array field + if len(m.ModificationInfos) > 0 { + for _curItem, element := range m.ModificationInfos { + arrayCtx := utils.CreateArrayContext(ctx, len(m.ModificationInfos), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_HistoryModifiedEvent) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_HistoryModifiedEvent) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyModifiedEvent HistoryModifiedEvent, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("HistoryModifiedEvent"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for HistoryModifiedEvent") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfEvents, err := ReadImplicitField[int32](ctx, "noOfEvents", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEvents' field")) + } + _ = noOfEvents + + events, err := ReadCountArrayField[HistoryEventFieldList](ctx, "events", ReadComplex[HistoryEventFieldList](ExtensionObjectDefinitionParseWithBufferProducer[HistoryEventFieldList]((int32)(int32(922))), readBuffer), uint64(noOfEvents)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'events' field")) + } + m.Events = events + + noOfModificationInfos, err := ReadImplicitField[int32](ctx, "noOfModificationInfos", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfModificationInfos' field")) + } + _ = noOfModificationInfos + + modificationInfos, err := ReadCountArrayField[ModificationInfo](ctx, "modificationInfos", ReadComplex[ModificationInfo](ExtensionObjectDefinitionParseWithBufferProducer[ModificationInfo]((int32)(int32(11218))), readBuffer), uint64(noOfModificationInfos)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'modificationInfos' field")) + } + m.ModificationInfos = modificationInfos + + if closeErr := readBuffer.CloseContext("HistoryModifiedEvent"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for HistoryModifiedEvent") + } + + return m, nil +} + +func (m *_HistoryModifiedEvent) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_HistoryModifiedEvent) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("HistoryModifiedEvent"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for HistoryModifiedEvent") + } + noOfEvents := int32(utils.InlineIf(bool((m.GetEvents()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEvents()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEvents", noOfEvents, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfEvents' field") + } + + if err := WriteComplexTypeArrayField(ctx, "events", m.GetEvents(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'events' field") + } + noOfModificationInfos := int32(utils.InlineIf(bool((m.GetModificationInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetModificationInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfModificationInfos", noOfModificationInfos, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfModificationInfos' field") + } + + if err := WriteComplexTypeArrayField(ctx, "modificationInfos", m.GetModificationInfos(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'modificationInfos' field") + } + + if popErr := writeBuffer.PopContext("HistoryModifiedEvent"); popErr != nil { + return errors.Wrap(popErr, "Error popping for HistoryModifiedEvent") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_HistoryModifiedEvent) IsHistoryModifiedEvent() {} + +func (m *_HistoryModifiedEvent) DeepCopy() any { + return m.deepCopy() +} + +func (m *_HistoryModifiedEvent) deepCopy() *_HistoryModifiedEvent { + if m == nil { + return nil + } + _HistoryModifiedEventCopy := &_HistoryModifiedEvent{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[HistoryEventFieldList, HistoryEventFieldList](m.Events), + utils.DeepCopySlice[ModificationInfo, ModificationInfo](m.ModificationInfos), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _HistoryModifiedEventCopy +} + +func (m *_HistoryModifiedEvent) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryReadDetails.go b/plc4go/protocols/opcua/readwrite/model/HistoryReadDetails.go index 91fa24ecbf4..a706a099571 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryReadDetails.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryReadDetails.go @@ -150,8 +150,8 @@ func (b *_HistoryReadDetails) CreateHistoryReadDetailsBuilder() HistoryReadDetai /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryReadDetails) GetIdentifier() string { - return "643" +func (m *_HistoryReadDetails) GetExtensionId() int32 { + return int32(643) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_HistoryReadDetails) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryReadDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyReadDetails HistoryReadDetails, err error) { +func (m *_HistoryReadDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyReadDetails HistoryReadDetails, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryReadRequest.go b/plc4go/protocols/opcua/readwrite/model/HistoryReadRequest.go index 542293a02d3..8b6f4b75212 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryReadRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryReadRequest.go @@ -41,17 +41,15 @@ type HistoryReadRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetHistoryReadDetails returns HistoryReadDetails (property field) GetHistoryReadDetails() ExtensionObject // GetTimestampsToReturn returns TimestampsToReturn (property field) GetTimestampsToReturn() TimestampsToReturn // GetReleaseContinuationPoints returns ReleaseContinuationPoints (property field) GetReleaseContinuationPoints() bool - // GetNoOfNodesToRead returns NoOfNodesToRead (property field) - GetNoOfNodesToRead() int32 // GetNodesToRead returns NodesToRead (property field) - GetNodesToRead() []ExtensionObjectDefinition + GetNodesToRead() []HistoryReadValueId // IsHistoryReadRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsHistoryReadRequest() // CreateBuilder creates a HistoryReadRequestBuilder @@ -61,12 +59,11 @@ type HistoryReadRequest interface { // _HistoryReadRequest is the data-structure of this message type _HistoryReadRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader HistoryReadDetails ExtensionObject TimestampsToReturn TimestampsToReturn ReleaseContinuationPoints bool - NoOfNodesToRead int32 - NodesToRead []ExtensionObjectDefinition + NodesToRead []HistoryReadValueId // Reserved Fields reservedField0 *uint8 } @@ -75,9 +72,9 @@ var _ HistoryReadRequest = (*_HistoryReadRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryReadRequest)(nil) // NewHistoryReadRequest factory function for _HistoryReadRequest -func NewHistoryReadRequest(requestHeader ExtensionObjectDefinition, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) *_HistoryReadRequest { +func NewHistoryReadRequest(requestHeader RequestHeader, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, nodesToRead []HistoryReadValueId) *_HistoryReadRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for HistoryReadRequest must not be nil") + panic("requestHeader of type RequestHeader for HistoryReadRequest must not be nil") } if historyReadDetails == nil { panic("historyReadDetails of type ExtensionObject for HistoryReadRequest must not be nil") @@ -88,7 +85,6 @@ func NewHistoryReadRequest(requestHeader ExtensionObjectDefinition, historyReadD HistoryReadDetails: historyReadDetails, TimestampsToReturn: timestampsToReturn, ReleaseContinuationPoints: releaseContinuationPoints, - NoOfNodesToRead: noOfNodesToRead, NodesToRead: nodesToRead, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -104,11 +100,11 @@ func NewHistoryReadRequest(requestHeader ExtensionObjectDefinition, historyReadD type HistoryReadRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) HistoryReadRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, nodesToRead []HistoryReadValueId) HistoryReadRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) HistoryReadRequestBuilder + WithRequestHeader(RequestHeader) HistoryReadRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryReadRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) HistoryReadRequestBuilder // WithHistoryReadDetails adds HistoryReadDetails (property field) WithHistoryReadDetails(ExtensionObject) HistoryReadRequestBuilder // WithHistoryReadDetailsBuilder adds HistoryReadDetails (property field) which is build by the builder @@ -117,10 +113,8 @@ type HistoryReadRequestBuilder interface { WithTimestampsToReturn(TimestampsToReturn) HistoryReadRequestBuilder // WithReleaseContinuationPoints adds ReleaseContinuationPoints (property field) WithReleaseContinuationPoints(bool) HistoryReadRequestBuilder - // WithNoOfNodesToRead adds NoOfNodesToRead (property field) - WithNoOfNodesToRead(int32) HistoryReadRequestBuilder // WithNodesToRead adds NodesToRead (property field) - WithNodesToRead(...ExtensionObjectDefinition) HistoryReadRequestBuilder + WithNodesToRead(...HistoryReadValueId) HistoryReadRequestBuilder // Build builds the HistoryReadRequest or returns an error if something is wrong Build() (HistoryReadRequest, error) // MustBuild does the same as Build but panics on error @@ -146,24 +140,24 @@ func (b *_HistoryReadRequestBuilder) setParent(contract ExtensionObjectDefinitio b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryReadRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) HistoryReadRequestBuilder { - return b.WithRequestHeader(requestHeader).WithHistoryReadDetails(historyReadDetails).WithTimestampsToReturn(timestampsToReturn).WithReleaseContinuationPoints(releaseContinuationPoints).WithNoOfNodesToRead(noOfNodesToRead).WithNodesToRead(nodesToRead...) +func (b *_HistoryReadRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, historyReadDetails ExtensionObject, timestampsToReturn TimestampsToReturn, releaseContinuationPoints bool, nodesToRead []HistoryReadValueId) HistoryReadRequestBuilder { + return b.WithRequestHeader(requestHeader).WithHistoryReadDetails(historyReadDetails).WithTimestampsToReturn(timestampsToReturn).WithReleaseContinuationPoints(releaseContinuationPoints).WithNodesToRead(nodesToRead...) } -func (b *_HistoryReadRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) HistoryReadRequestBuilder { +func (b *_HistoryReadRequestBuilder) WithRequestHeader(requestHeader RequestHeader) HistoryReadRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_HistoryReadRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryReadRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_HistoryReadRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) HistoryReadRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -196,12 +190,7 @@ func (b *_HistoryReadRequestBuilder) WithReleaseContinuationPoints(releaseContin return b } -func (b *_HistoryReadRequestBuilder) WithNoOfNodesToRead(noOfNodesToRead int32) HistoryReadRequestBuilder { - b.NoOfNodesToRead = noOfNodesToRead - return b -} - -func (b *_HistoryReadRequestBuilder) WithNodesToRead(nodesToRead ...ExtensionObjectDefinition) HistoryReadRequestBuilder { +func (b *_HistoryReadRequestBuilder) WithNodesToRead(nodesToRead ...HistoryReadValueId) HistoryReadRequestBuilder { b.NodesToRead = nodesToRead return b } @@ -268,8 +257,8 @@ func (b *_HistoryReadRequest) CreateHistoryReadRequestBuilder() HistoryReadReque /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryReadRequest) GetIdentifier() string { - return "664" +func (m *_HistoryReadRequest) GetExtensionId() int32 { + return int32(664) } /////////////////////// @@ -286,7 +275,7 @@ func (m *_HistoryReadRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryReadRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_HistoryReadRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -302,11 +291,7 @@ func (m *_HistoryReadRequest) GetReleaseContinuationPoints() bool { return m.ReleaseContinuationPoints } -func (m *_HistoryReadRequest) GetNoOfNodesToRead() int32 { - return m.NoOfNodesToRead -} - -func (m *_HistoryReadRequest) GetNodesToRead() []ExtensionObjectDefinition { +func (m *_HistoryReadRequest) GetNodesToRead() []HistoryReadValueId { return m.NodesToRead } @@ -348,7 +333,7 @@ func (m *_HistoryReadRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (releaseContinuationPoints) lengthInBits += 1 - // Simple field (noOfNodesToRead) + // Implicit Field (noOfNodesToRead) lengthInBits += 32 // Array field @@ -368,7 +353,7 @@ func (m *_HistoryReadRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyReadRequest HistoryReadRequest, err error) { +func (m *_HistoryReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyReadRequest HistoryReadRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -379,13 +364,13 @@ func (m *_HistoryReadRequest) parse(ctx context.Context, readBuffer utils.ReadBu currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - historyReadDetails, err := ReadSimpleField[ExtensionObject](ctx, "historyReadDetails", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + historyReadDetails, err := ReadSimpleField[ExtensionObject](ctx, "historyReadDetails", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historyReadDetails' field")) } @@ -409,13 +394,13 @@ func (m *_HistoryReadRequest) parse(ctx context.Context, readBuffer utils.ReadBu } m.ReleaseContinuationPoints = releaseContinuationPoints - noOfNodesToRead, err := ReadSimpleField(ctx, "noOfNodesToRead", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToRead, err := ReadImplicitField[int32](ctx, "noOfNodesToRead", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToRead' field")) } - m.NoOfNodesToRead = noOfNodesToRead + _ = noOfNodesToRead - nodesToRead, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToRead", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("637")), readBuffer), uint64(noOfNodesToRead)) + nodesToRead, err := ReadCountArrayField[HistoryReadValueId](ctx, "nodesToRead", ReadComplex[HistoryReadValueId](ExtensionObjectDefinitionParseWithBufferProducer[HistoryReadValueId]((int32)(int32(637))), readBuffer), uint64(noOfNodesToRead)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToRead' field")) } @@ -446,7 +431,7 @@ func (m *_HistoryReadRequest) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(pushErr, "Error pushing for HistoryReadRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -465,8 +450,8 @@ func (m *_HistoryReadRequest) SerializeWithWriteBuffer(ctx context.Context, writ if err := WriteSimpleField[bool](ctx, "releaseContinuationPoints", m.GetReleaseContinuationPoints(), WriteBoolean(writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'releaseContinuationPoints' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToRead", m.GetNoOfNodesToRead(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToRead := int32(utils.InlineIf(bool((m.GetNodesToRead()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToRead()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToRead", noOfNodesToRead, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToRead' field") } @@ -494,12 +479,11 @@ func (m *_HistoryReadRequest) deepCopy() *_HistoryReadRequest { } _HistoryReadRequestCopy := &_HistoryReadRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.HistoryReadDetails.DeepCopy().(ExtensionObject), m.TimestampsToReturn, m.ReleaseContinuationPoints, - m.NoOfNodesToRead, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToRead), + utils.DeepCopySlice[HistoryReadValueId, HistoryReadValueId](m.NodesToRead), m.reservedField0, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryReadResponse.go b/plc4go/protocols/opcua/readwrite/model/HistoryReadResponse.go index 25f6c6d1c08..b5cd701f813 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryReadResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryReadResponse.go @@ -41,13 +41,9 @@ type HistoryReadResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []HistoryReadResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsHistoryReadResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type HistoryReadResponse interface { // _HistoryReadResponse is the data-structure of this message type _HistoryReadResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []HistoryReadResult + DiagnosticInfos []DiagnosticInfo } var _ HistoryReadResponse = (*_HistoryReadResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryReadResponse)(nil) // NewHistoryReadResponse factory function for _HistoryReadResponse -func NewHistoryReadResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_HistoryReadResponse { +func NewHistoryReadResponse(responseHeader ResponseHeader, results []HistoryReadResult, diagnosticInfos []DiagnosticInfo) *_HistoryReadResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for HistoryReadResponse must not be nil") + panic("responseHeader of type ResponseHeader for HistoryReadResponse must not be nil") } _result := &_HistoryReadResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewHistoryReadResponse(responseHeader ExtensionObjectDefinition, noOfResult type HistoryReadResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryReadResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []HistoryReadResult, diagnosticInfos []DiagnosticInfo) HistoryReadResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) HistoryReadResponseBuilder + WithResponseHeader(ResponseHeader) HistoryReadResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryReadResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) HistoryReadResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) HistoryReadResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) HistoryReadResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) HistoryReadResponseBuilder + WithResults(...HistoryReadResult) HistoryReadResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) HistoryReadResponseBuilder // Build builds the HistoryReadResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_HistoryReadResponseBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryReadResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryReadResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_HistoryReadResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []HistoryReadResult, diagnosticInfos []DiagnosticInfo) HistoryReadResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_HistoryReadResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) HistoryReadResponseBuilder { +func (b *_HistoryReadResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) HistoryReadResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_HistoryReadResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryReadResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_HistoryReadResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) HistoryReadResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_HistoryReadResponseBuilder) WithNoOfResults(noOfResults int32) HistoryReadResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_HistoryReadResponseBuilder) WithResults(results ...ExtensionObjectDefinition) HistoryReadResponseBuilder { +func (b *_HistoryReadResponseBuilder) WithResults(results ...HistoryReadResult) HistoryReadResponseBuilder { b.Results = results return b } -func (b *_HistoryReadResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) HistoryReadResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_HistoryReadResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) HistoryReadResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_HistoryReadResponse) CreateHistoryReadResponseBuilder() HistoryReadRes /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryReadResponse) GetIdentifier() string { - return "667" +func (m *_HistoryReadResponse) GetExtensionId() int32 { + return int32(667) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_HistoryReadResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryReadResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_HistoryReadResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_HistoryReadResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_HistoryReadResponse) GetResults() []ExtensionObjectDefinition { +func (m *_HistoryReadResponse) GetResults() []HistoryReadResult { return m.Results } -func (m *_HistoryReadResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_HistoryReadResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_HistoryReadResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_HistoryReadResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_HistoryReadResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyReadResponse HistoryReadResponse, err error) { +func (m *_HistoryReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyReadResponse HistoryReadResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_HistoryReadResponse) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("640")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[HistoryReadResult](ctx, "results", ReadComplex[HistoryReadResult](ExtensionObjectDefinitionParseWithBufferProducer[HistoryReadResult]((int32)(int32(640))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_HistoryReadResponse) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for HistoryReadResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_HistoryReadResponse) deepCopy() *_HistoryReadResponse { } _HistoryReadResponseCopy := &_HistoryReadResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[HistoryReadResult, HistoryReadResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryReadResult.go b/plc4go/protocols/opcua/readwrite/model/HistoryReadResult.go index adb719905d9..47874fe55c0 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryReadResult.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryReadResult.go @@ -257,8 +257,8 @@ func (b *_HistoryReadResult) CreateHistoryReadResultBuilder() HistoryReadResultB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryReadResult) GetIdentifier() string { - return "640" +func (m *_HistoryReadResult) GetExtensionId() int32 { + return int32(640) } /////////////////////// @@ -326,7 +326,7 @@ func (m *_HistoryReadResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryReadResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyReadResult HistoryReadResult, err error) { +func (m *_HistoryReadResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyReadResult HistoryReadResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -349,7 +349,7 @@ func (m *_HistoryReadResult) parse(ctx context.Context, readBuffer utils.ReadBuf } m.ContinuationPoint = continuationPoint - historyData, err := ReadSimpleField[ExtensionObject](ctx, "historyData", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + historyData, err := ReadSimpleField[ExtensionObject](ctx, "historyData", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historyData' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryReadValueId.go b/plc4go/protocols/opcua/readwrite/model/HistoryReadValueId.go index 488dadb5feb..25ca70ea85b 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryReadValueId.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryReadValueId.go @@ -292,8 +292,8 @@ func (b *_HistoryReadValueId) CreateHistoryReadValueIdBuilder() HistoryReadValue /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryReadValueId) GetIdentifier() string { - return "637" +func (m *_HistoryReadValueId) GetExtensionId() int32 { + return int32(637) } /////////////////////// @@ -368,7 +368,7 @@ func (m *_HistoryReadValueId) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryReadValueId) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyReadValueId HistoryReadValueId, err error) { +func (m *_HistoryReadValueId) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyReadValueId HistoryReadValueId, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateDetails.go b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateDetails.go index 8a4ddaad3e5..0bf3e804840 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateDetails.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateDetails.go @@ -150,8 +150,8 @@ func (b *_HistoryUpdateDetails) CreateHistoryUpdateDetailsBuilder() HistoryUpdat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryUpdateDetails) GetIdentifier() string { - return "679" +func (m *_HistoryUpdateDetails) GetExtensionId() int32 { + return int32(679) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_HistoryUpdateDetails) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryUpdateDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyUpdateDetails HistoryUpdateDetails, err error) { +func (m *_HistoryUpdateDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyUpdateDetails HistoryUpdateDetails, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateRequest.go b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateRequest.go index 31c2523b0f5..91057466a98 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateRequest.go @@ -41,9 +41,7 @@ type HistoryUpdateRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfHistoryUpdateDetails returns NoOfHistoryUpdateDetails (property field) - GetNoOfHistoryUpdateDetails() int32 + GetRequestHeader() RequestHeader // GetHistoryUpdateDetails returns HistoryUpdateDetails (property field) GetHistoryUpdateDetails() []ExtensionObject // IsHistoryUpdateRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type HistoryUpdateRequest interface { // _HistoryUpdateRequest is the data-structure of this message type _HistoryUpdateRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfHistoryUpdateDetails int32 - HistoryUpdateDetails []ExtensionObject + RequestHeader RequestHeader + HistoryUpdateDetails []ExtensionObject } var _ HistoryUpdateRequest = (*_HistoryUpdateRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryUpdateRequest)(nil) // NewHistoryUpdateRequest factory function for _HistoryUpdateRequest -func NewHistoryUpdateRequest(requestHeader ExtensionObjectDefinition, noOfHistoryUpdateDetails int32, historyUpdateDetails []ExtensionObject) *_HistoryUpdateRequest { +func NewHistoryUpdateRequest(requestHeader RequestHeader, historyUpdateDetails []ExtensionObject) *_HistoryUpdateRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for HistoryUpdateRequest must not be nil") + panic("requestHeader of type RequestHeader for HistoryUpdateRequest must not be nil") } _result := &_HistoryUpdateRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfHistoryUpdateDetails: noOfHistoryUpdateDetails, HistoryUpdateDetails: historyUpdateDetails, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewHistoryUpdateRequest(requestHeader ExtensionObjectDefinition, noOfHistor type HistoryUpdateRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfHistoryUpdateDetails int32, historyUpdateDetails []ExtensionObject) HistoryUpdateRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, historyUpdateDetails []ExtensionObject) HistoryUpdateRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) HistoryUpdateRequestBuilder + WithRequestHeader(RequestHeader) HistoryUpdateRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryUpdateRequestBuilder - // WithNoOfHistoryUpdateDetails adds NoOfHistoryUpdateDetails (property field) - WithNoOfHistoryUpdateDetails(int32) HistoryUpdateRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) HistoryUpdateRequestBuilder // WithHistoryUpdateDetails adds HistoryUpdateDetails (property field) WithHistoryUpdateDetails(...ExtensionObject) HistoryUpdateRequestBuilder // Build builds the HistoryUpdateRequest or returns an error if something is wrong @@ -121,33 +115,28 @@ func (b *_HistoryUpdateRequestBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryUpdateRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfHistoryUpdateDetails int32, historyUpdateDetails []ExtensionObject) HistoryUpdateRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfHistoryUpdateDetails(noOfHistoryUpdateDetails).WithHistoryUpdateDetails(historyUpdateDetails...) +func (b *_HistoryUpdateRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, historyUpdateDetails []ExtensionObject) HistoryUpdateRequestBuilder { + return b.WithRequestHeader(requestHeader).WithHistoryUpdateDetails(historyUpdateDetails...) } -func (b *_HistoryUpdateRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) HistoryUpdateRequestBuilder { +func (b *_HistoryUpdateRequestBuilder) WithRequestHeader(requestHeader RequestHeader) HistoryUpdateRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_HistoryUpdateRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryUpdateRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_HistoryUpdateRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) HistoryUpdateRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_HistoryUpdateRequestBuilder) WithNoOfHistoryUpdateDetails(noOfHistoryUpdateDetails int32) HistoryUpdateRequestBuilder { - b.NoOfHistoryUpdateDetails = noOfHistoryUpdateDetails - return b -} - func (b *_HistoryUpdateRequestBuilder) WithHistoryUpdateDetails(historyUpdateDetails ...ExtensionObject) HistoryUpdateRequestBuilder { b.HistoryUpdateDetails = historyUpdateDetails return b @@ -209,8 +198,8 @@ func (b *_HistoryUpdateRequest) CreateHistoryUpdateRequestBuilder() HistoryUpdat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryUpdateRequest) GetIdentifier() string { - return "700" +func (m *_HistoryUpdateRequest) GetExtensionId() int32 { + return int32(700) } /////////////////////// @@ -227,14 +216,10 @@ func (m *_HistoryUpdateRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryUpdateRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_HistoryUpdateRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_HistoryUpdateRequest) GetNoOfHistoryUpdateDetails() int32 { - return m.NoOfHistoryUpdateDetails -} - func (m *_HistoryUpdateRequest) GetHistoryUpdateDetails() []ExtensionObject { return m.HistoryUpdateDetails } @@ -265,7 +250,7 @@ func (m *_HistoryUpdateRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfHistoryUpdateDetails) + // Implicit Field (noOfHistoryUpdateDetails) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_HistoryUpdateRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryUpdateRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyUpdateRequest HistoryUpdateRequest, err error) { +func (m *_HistoryUpdateRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyUpdateRequest HistoryUpdateRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_HistoryUpdateRequest) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfHistoryUpdateDetails, err := ReadSimpleField(ctx, "noOfHistoryUpdateDetails", ReadSignedInt(readBuffer, uint8(32))) + noOfHistoryUpdateDetails, err := ReadImplicitField[int32](ctx, "noOfHistoryUpdateDetails", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfHistoryUpdateDetails' field")) } - m.NoOfHistoryUpdateDetails = noOfHistoryUpdateDetails + _ = noOfHistoryUpdateDetails - historyUpdateDetails, err := ReadCountArrayField[ExtensionObject](ctx, "historyUpdateDetails", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer), uint64(noOfHistoryUpdateDetails)) + historyUpdateDetails, err := ReadCountArrayField[ExtensionObject](ctx, "historyUpdateDetails", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfHistoryUpdateDetails)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historyUpdateDetails' field")) } @@ -339,11 +324,11 @@ func (m *_HistoryUpdateRequest) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for HistoryUpdateRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfHistoryUpdateDetails", m.GetNoOfHistoryUpdateDetails(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfHistoryUpdateDetails := int32(utils.InlineIf(bool((m.GetHistoryUpdateDetails()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetHistoryUpdateDetails()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfHistoryUpdateDetails", noOfHistoryUpdateDetails, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfHistoryUpdateDetails' field") } @@ -371,8 +356,7 @@ func (m *_HistoryUpdateRequest) deepCopy() *_HistoryUpdateRequest { } _HistoryUpdateRequestCopy := &_HistoryUpdateRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfHistoryUpdateDetails, + m.RequestHeader.DeepCopy().(RequestHeader), utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.HistoryUpdateDetails), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResponse.go b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResponse.go index ba0c4d188a6..1fdaf9d563a 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResponse.go @@ -41,13 +41,9 @@ type HistoryUpdateResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []HistoryUpdateResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsHistoryUpdateResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type HistoryUpdateResponse interface { // _HistoryUpdateResponse is the data-structure of this message type _HistoryUpdateResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []HistoryUpdateResult + DiagnosticInfos []DiagnosticInfo } var _ HistoryUpdateResponse = (*_HistoryUpdateResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryUpdateResponse)(nil) // NewHistoryUpdateResponse factory function for _HistoryUpdateResponse -func NewHistoryUpdateResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_HistoryUpdateResponse { +func NewHistoryUpdateResponse(responseHeader ResponseHeader, results []HistoryUpdateResult, diagnosticInfos []DiagnosticInfo) *_HistoryUpdateResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for HistoryUpdateResponse must not be nil") + panic("responseHeader of type ResponseHeader for HistoryUpdateResponse must not be nil") } _result := &_HistoryUpdateResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewHistoryUpdateResponse(responseHeader ExtensionObjectDefinition, noOfResu type HistoryUpdateResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryUpdateResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []HistoryUpdateResult, diagnosticInfos []DiagnosticInfo) HistoryUpdateResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) HistoryUpdateResponseBuilder + WithResponseHeader(ResponseHeader) HistoryUpdateResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryUpdateResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) HistoryUpdateResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) HistoryUpdateResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) HistoryUpdateResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) HistoryUpdateResponseBuilder + WithResults(...HistoryUpdateResult) HistoryUpdateResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) HistoryUpdateResponseBuilder // Build builds the HistoryUpdateResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_HistoryUpdateResponseBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryUpdateResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryUpdateResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_HistoryUpdateResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []HistoryUpdateResult, diagnosticInfos []DiagnosticInfo) HistoryUpdateResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_HistoryUpdateResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) HistoryUpdateResponseBuilder { +func (b *_HistoryUpdateResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) HistoryUpdateResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_HistoryUpdateResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) HistoryUpdateResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_HistoryUpdateResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) HistoryUpdateResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_HistoryUpdateResponseBuilder) WithNoOfResults(noOfResults int32) HistoryUpdateResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_HistoryUpdateResponseBuilder) WithResults(results ...ExtensionObjectDefinition) HistoryUpdateResponseBuilder { +func (b *_HistoryUpdateResponseBuilder) WithResults(results ...HistoryUpdateResult) HistoryUpdateResponseBuilder { b.Results = results return b } -func (b *_HistoryUpdateResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) HistoryUpdateResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_HistoryUpdateResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) HistoryUpdateResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_HistoryUpdateResponse) CreateHistoryUpdateResponseBuilder() HistoryUpd /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryUpdateResponse) GetIdentifier() string { - return "703" +func (m *_HistoryUpdateResponse) GetExtensionId() int32 { + return int32(703) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_HistoryUpdateResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_HistoryUpdateResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_HistoryUpdateResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_HistoryUpdateResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_HistoryUpdateResponse) GetResults() []ExtensionObjectDefinition { +func (m *_HistoryUpdateResponse) GetResults() []HistoryUpdateResult { return m.Results } -func (m *_HistoryUpdateResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_HistoryUpdateResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_HistoryUpdateResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_HistoryUpdateResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_HistoryUpdateResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryUpdateResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyUpdateResponse HistoryUpdateResponse, err error) { +func (m *_HistoryUpdateResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyUpdateResponse HistoryUpdateResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_HistoryUpdateResponse) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("697")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[HistoryUpdateResult](ctx, "results", ReadComplex[HistoryUpdateResult](ExtensionObjectDefinitionParseWithBufferProducer[HistoryUpdateResult]((int32)(int32(697))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_HistoryUpdateResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for HistoryUpdateResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_HistoryUpdateResponse) deepCopy() *_HistoryUpdateResponse { } _HistoryUpdateResponseCopy := &_HistoryUpdateResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[HistoryUpdateResult, HistoryUpdateResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResult.go b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResult.go index 6ba3ceccb60..0019423cccc 100644 --- a/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResult.go +++ b/plc4go/protocols/opcua/readwrite/model/HistoryUpdateResult.go @@ -42,12 +42,8 @@ type HistoryUpdateResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfOperationResults returns NoOfOperationResults (property field) - GetNoOfOperationResults() int32 // GetOperationResults returns OperationResults (property field) GetOperationResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsHistoryUpdateResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type HistoryUpdateResult interface { // _HistoryUpdateResult is the data-structure of this message type _HistoryUpdateResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfOperationResults int32 - OperationResults []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + StatusCode StatusCode + OperationResults []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ HistoryUpdateResult = (*_HistoryUpdateResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_HistoryUpdateResult)(nil) // NewHistoryUpdateResult factory function for _HistoryUpdateResult -func NewHistoryUpdateResult(statusCode StatusCode, noOfOperationResults int32, operationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_HistoryUpdateResult { +func NewHistoryUpdateResult(statusCode StatusCode, operationResults []StatusCode, diagnosticInfos []DiagnosticInfo) *_HistoryUpdateResult { if statusCode == nil { panic("statusCode of type StatusCode for HistoryUpdateResult must not be nil") } _result := &_HistoryUpdateResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfOperationResults: noOfOperationResults, OperationResults: operationResults, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewHistoryUpdateResult(statusCode StatusCode, noOfOperationResults int32, o type HistoryUpdateResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfOperationResults int32, operationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryUpdateResultBuilder + WithMandatoryFields(statusCode StatusCode, operationResults []StatusCode, diagnosticInfos []DiagnosticInfo) HistoryUpdateResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) HistoryUpdateResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) HistoryUpdateResultBuilder - // WithNoOfOperationResults adds NoOfOperationResults (property field) - WithNoOfOperationResults(int32) HistoryUpdateResultBuilder // WithOperationResults adds OperationResults (property field) WithOperationResults(...StatusCode) HistoryUpdateResultBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) HistoryUpdateResultBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) HistoryUpdateResultBuilder // Build builds the HistoryUpdateResult or returns an error if something is wrong @@ -133,8 +121,8 @@ func (b *_HistoryUpdateResultBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_HistoryUpdateResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfOperationResults int32, operationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) HistoryUpdateResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfOperationResults(noOfOperationResults).WithOperationResults(operationResults...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_HistoryUpdateResultBuilder) WithMandatoryFields(statusCode StatusCode, operationResults []StatusCode, diagnosticInfos []DiagnosticInfo) HistoryUpdateResultBuilder { + return b.WithStatusCode(statusCode).WithOperationResults(operationResults...).WithDiagnosticInfos(diagnosticInfos...) } func (b *_HistoryUpdateResultBuilder) WithStatusCode(statusCode StatusCode) HistoryUpdateResultBuilder { @@ -155,21 +143,11 @@ func (b *_HistoryUpdateResultBuilder) WithStatusCodeBuilder(builderSupplier func return b } -func (b *_HistoryUpdateResultBuilder) WithNoOfOperationResults(noOfOperationResults int32) HistoryUpdateResultBuilder { - b.NoOfOperationResults = noOfOperationResults - return b -} - func (b *_HistoryUpdateResultBuilder) WithOperationResults(operationResults ...StatusCode) HistoryUpdateResultBuilder { b.OperationResults = operationResults return b } -func (b *_HistoryUpdateResultBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) HistoryUpdateResultBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_HistoryUpdateResultBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) HistoryUpdateResultBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_HistoryUpdateResult) CreateHistoryUpdateResultBuilder() HistoryUpdateR /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_HistoryUpdateResult) GetIdentifier() string { - return "697" +func (m *_HistoryUpdateResult) GetExtensionId() int32 { + return int32(697) } /////////////////////// @@ -253,18 +231,10 @@ func (m *_HistoryUpdateResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_HistoryUpdateResult) GetNoOfOperationResults() int32 { - return m.NoOfOperationResults -} - func (m *_HistoryUpdateResult) GetOperationResults() []StatusCode { return m.OperationResults } -func (m *_HistoryUpdateResult) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_HistoryUpdateResult) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_HistoryUpdateResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfOperationResults) + // Implicit Field (noOfOperationResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_HistoryUpdateResult) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_HistoryUpdateResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_HistoryUpdateResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__historyUpdateResult HistoryUpdateResult, err error) { +func (m *_HistoryUpdateResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__historyUpdateResult HistoryUpdateResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -345,11 +315,11 @@ func (m *_HistoryUpdateResult) parse(ctx context.Context, readBuffer utils.ReadB } m.StatusCode = statusCode - noOfOperationResults, err := ReadSimpleField(ctx, "noOfOperationResults", ReadSignedInt(readBuffer, uint8(32))) + noOfOperationResults, err := ReadImplicitField[int32](ctx, "noOfOperationResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfOperationResults' field")) } - m.NoOfOperationResults = noOfOperationResults + _ = noOfOperationResults operationResults, err := ReadCountArrayField[StatusCode](ctx, "operationResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfOperationResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_HistoryUpdateResult) parse(ctx context.Context, readBuffer utils.ReadB } m.OperationResults = operationResults - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -397,16 +367,16 @@ func (m *_HistoryUpdateResult) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfOperationResults", m.GetNoOfOperationResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfOperationResults := int32(utils.InlineIf(bool((m.GetOperationResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetOperationResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfOperationResults", noOfOperationResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfOperationResults' field") } if err := WriteComplexTypeArrayField(ctx, "operationResults", m.GetOperationResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'operationResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -435,9 +405,7 @@ func (m *_HistoryUpdateResult) deepCopy() *_HistoryUpdateResult { _HistoryUpdateResultCopy := &_HistoryUpdateResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfOperationResults, utils.DeepCopySlice[StatusCode, StatusCode](m.OperationResults), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/IdentityMappingRuleType.go b/plc4go/protocols/opcua/readwrite/model/IdentityMappingRuleType.go index 5b8cc01aff6..8dbaf493d2c 100644 --- a/plc4go/protocols/opcua/readwrite/model/IdentityMappingRuleType.go +++ b/plc4go/protocols/opcua/readwrite/model/IdentityMappingRuleType.go @@ -198,8 +198,8 @@ func (b *_IdentityMappingRuleType) CreateIdentityMappingRuleTypeBuilder() Identi /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_IdentityMappingRuleType) GetIdentifier() string { - return "15636" +func (m *_IdentityMappingRuleType) GetExtensionId() int32 { + return int32(15636) } /////////////////////// @@ -260,7 +260,7 @@ func (m *_IdentityMappingRuleType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_IdentityMappingRuleType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__identityMappingRuleType IdentityMappingRuleType, err error) { +func (m *_IdentityMappingRuleType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__identityMappingRuleType IdentityMappingRuleType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/IssuedIdentityToken.go b/plc4go/protocols/opcua/readwrite/model/IssuedIdentityToken.go index c7fd431a03f..be151479b16 100644 --- a/plc4go/protocols/opcua/readwrite/model/IssuedIdentityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/IssuedIdentityToken.go @@ -39,7 +39,9 @@ type IssuedIdentityToken interface { utils.LengthAware utils.Serializable utils.Copyable - UserIdentityTokenDefinition + ExtensionObjectDefinition + // GetPolicyId returns PolicyId (property field) + GetPolicyId() PascalString // GetTokenData returns TokenData (property field) GetTokenData() PascalByteString // GetEncryptionAlgorithm returns EncryptionAlgorithm (property field) @@ -52,16 +54,20 @@ type IssuedIdentityToken interface { // _IssuedIdentityToken is the data-structure of this message type _IssuedIdentityToken struct { - UserIdentityTokenDefinitionContract + ExtensionObjectDefinitionContract + PolicyId PascalString TokenData PascalByteString EncryptionAlgorithm PascalString } var _ IssuedIdentityToken = (*_IssuedIdentityToken)(nil) -var _ UserIdentityTokenDefinitionRequirements = (*_IssuedIdentityToken)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_IssuedIdentityToken)(nil) // NewIssuedIdentityToken factory function for _IssuedIdentityToken -func NewIssuedIdentityToken(tokenData PascalByteString, encryptionAlgorithm PascalString) *_IssuedIdentityToken { +func NewIssuedIdentityToken(policyId PascalString, tokenData PascalByteString, encryptionAlgorithm PascalString) *_IssuedIdentityToken { + if policyId == nil { + panic("policyId of type PascalString for IssuedIdentityToken must not be nil") + } if tokenData == nil { panic("tokenData of type PascalByteString for IssuedIdentityToken must not be nil") } @@ -69,11 +75,12 @@ func NewIssuedIdentityToken(tokenData PascalByteString, encryptionAlgorithm Pasc panic("encryptionAlgorithm of type PascalString for IssuedIdentityToken must not be nil") } _result := &_IssuedIdentityToken{ - UserIdentityTokenDefinitionContract: NewUserIdentityTokenDefinition(), - TokenData: tokenData, - EncryptionAlgorithm: encryptionAlgorithm, + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PolicyId: policyId, + TokenData: tokenData, + EncryptionAlgorithm: encryptionAlgorithm, } - _result.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = _result + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result return _result } @@ -86,7 +93,11 @@ func NewIssuedIdentityToken(tokenData PascalByteString, encryptionAlgorithm Pasc type IssuedIdentityTokenBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(tokenData PascalByteString, encryptionAlgorithm PascalString) IssuedIdentityTokenBuilder + WithMandatoryFields(policyId PascalString, tokenData PascalByteString, encryptionAlgorithm PascalString) IssuedIdentityTokenBuilder + // WithPolicyId adds PolicyId (property field) + WithPolicyId(PascalString) IssuedIdentityTokenBuilder + // WithPolicyIdBuilder adds PolicyId (property field) which is build by the builder + WithPolicyIdBuilder(func(PascalStringBuilder) PascalStringBuilder) IssuedIdentityTokenBuilder // WithTokenData adds TokenData (property field) WithTokenData(PascalByteString) IssuedIdentityTokenBuilder // WithTokenDataBuilder adds TokenData (property field) which is build by the builder @@ -109,19 +120,37 @@ func NewIssuedIdentityTokenBuilder() IssuedIdentityTokenBuilder { type _IssuedIdentityTokenBuilder struct { *_IssuedIdentityToken - parentBuilder *_UserIdentityTokenDefinitionBuilder + parentBuilder *_ExtensionObjectDefinitionBuilder err *utils.MultiError } var _ (IssuedIdentityTokenBuilder) = (*_IssuedIdentityTokenBuilder)(nil) -func (b *_IssuedIdentityTokenBuilder) setParent(contract UserIdentityTokenDefinitionContract) { - b.UserIdentityTokenDefinitionContract = contract +func (b *_IssuedIdentityTokenBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_IssuedIdentityTokenBuilder) WithMandatoryFields(policyId PascalString, tokenData PascalByteString, encryptionAlgorithm PascalString) IssuedIdentityTokenBuilder { + return b.WithPolicyId(policyId).WithTokenData(tokenData).WithEncryptionAlgorithm(encryptionAlgorithm) } -func (b *_IssuedIdentityTokenBuilder) WithMandatoryFields(tokenData PascalByteString, encryptionAlgorithm PascalString) IssuedIdentityTokenBuilder { - return b.WithTokenData(tokenData).WithEncryptionAlgorithm(encryptionAlgorithm) +func (b *_IssuedIdentityTokenBuilder) WithPolicyId(policyId PascalString) IssuedIdentityTokenBuilder { + b.PolicyId = policyId + return b +} + +func (b *_IssuedIdentityTokenBuilder) WithPolicyIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) IssuedIdentityTokenBuilder { + builder := builderSupplier(b.PolicyId.CreatePascalStringBuilder()) + var err error + b.PolicyId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b } func (b *_IssuedIdentityTokenBuilder) WithTokenData(tokenData PascalByteString) IssuedIdentityTokenBuilder { @@ -161,6 +190,12 @@ func (b *_IssuedIdentityTokenBuilder) WithEncryptionAlgorithmBuilder(builderSupp } func (b *_IssuedIdentityTokenBuilder) Build() (IssuedIdentityToken, error) { + if b.PolicyId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'policyId' not set")) + } if b.TokenData == nil { if b.err == nil { b.err = new(utils.MultiError) @@ -188,11 +223,11 @@ func (b *_IssuedIdentityTokenBuilder) MustBuild() IssuedIdentityToken { } // Done is used to finish work on this child and return to the parent builder -func (b *_IssuedIdentityTokenBuilder) Done() UserIdentityTokenDefinitionBuilder { +func (b *_IssuedIdentityTokenBuilder) Done() ExtensionObjectDefinitionBuilder { return b.parentBuilder } -func (b *_IssuedIdentityTokenBuilder) buildForUserIdentityTokenDefinition() (UserIdentityTokenDefinition, error) { +func (b *_IssuedIdentityTokenBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { return b.Build() } @@ -222,8 +257,8 @@ func (b *_IssuedIdentityToken) CreateIssuedIdentityTokenBuilder() IssuedIdentity /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_IssuedIdentityToken) GetIdentifier() string { - return "identity" +func (m *_IssuedIdentityToken) GetExtensionId() int32 { + return int32(940) } /////////////////////// @@ -231,8 +266,8 @@ func (m *_IssuedIdentityToken) GetIdentifier() string { /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// -func (m *_IssuedIdentityToken) GetParent() UserIdentityTokenDefinitionContract { - return m.UserIdentityTokenDefinitionContract +func (m *_IssuedIdentityToken) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract } /////////////////////////////////////////////////////////// @@ -240,6 +275,10 @@ func (m *_IssuedIdentityToken) GetParent() UserIdentityTokenDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// +func (m *_IssuedIdentityToken) GetPolicyId() PascalString { + return m.PolicyId +} + func (m *_IssuedIdentityToken) GetTokenData() PascalByteString { return m.TokenData } @@ -269,7 +308,10 @@ func (m *_IssuedIdentityToken) GetTypeName() string { } func (m *_IssuedIdentityToken) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).getLengthInBits(ctx)) + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (policyId) + lengthInBits += m.PolicyId.GetLengthInBits(ctx) // Simple field (tokenData) lengthInBits += m.TokenData.GetLengthInBits(ctx) @@ -284,8 +326,8 @@ func (m *_IssuedIdentityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_IssuedIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_UserIdentityTokenDefinition, identifier string) (__issuedIdentityToken IssuedIdentityToken, err error) { - m.UserIdentityTokenDefinitionContract = parent +func (m *_IssuedIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__issuedIdentityToken IssuedIdentityToken, err error) { + m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer _ = positionAware @@ -295,6 +337,12 @@ func (m *_IssuedIdentityToken) parse(ctx context.Context, readBuffer utils.ReadB currentPos := positionAware.GetPos() _ = currentPos + policyId, err := ReadSimpleField[PascalString](ctx, "policyId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyId' field")) + } + m.PolicyId = policyId + tokenData, err := ReadSimpleField[PascalByteString](ctx, "tokenData", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'tokenData' field")) @@ -332,6 +380,10 @@ func (m *_IssuedIdentityToken) SerializeWithWriteBuffer(ctx context.Context, wri return errors.Wrap(pushErr, "Error pushing for IssuedIdentityToken") } + if err := WriteSimpleField[PascalString](ctx, "policyId", m.GetPolicyId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'policyId' field") + } + if err := WriteSimpleField[PascalByteString](ctx, "tokenData", m.GetTokenData(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'tokenData' field") } @@ -345,7 +397,7 @@ func (m *_IssuedIdentityToken) SerializeWithWriteBuffer(ctx context.Context, wri } return nil } - return m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).serializeParent(ctx, writeBuffer, m, ser) + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) } func (m *_IssuedIdentityToken) IsIssuedIdentityToken() {} @@ -359,11 +411,12 @@ func (m *_IssuedIdentityToken) deepCopy() *_IssuedIdentityToken { return nil } _IssuedIdentityTokenCopy := &_IssuedIdentityToken{ - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).deepCopy(), + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PolicyId.DeepCopy().(PascalString), m.TokenData.DeepCopy().(PascalByteString), m.EncryptionAlgorithm.DeepCopy().(PascalString), } - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = m + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _IssuedIdentityTokenCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/JsonDataSetReaderMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/JsonDataSetReaderMessageDataType.go new file mode 100644 index 00000000000..c29c939c703 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/JsonDataSetReaderMessageDataType.go @@ -0,0 +1,335 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// JsonDataSetReaderMessageDataType is the corresponding interface of JsonDataSetReaderMessageDataType +type JsonDataSetReaderMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNetworkMessageContentMask returns NetworkMessageContentMask (property field) + GetNetworkMessageContentMask() JsonNetworkMessageContentMask + // GetDataSetMessageContentMask returns DataSetMessageContentMask (property field) + GetDataSetMessageContentMask() JsonDataSetMessageContentMask + // IsJsonDataSetReaderMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsJsonDataSetReaderMessageDataType() + // CreateBuilder creates a JsonDataSetReaderMessageDataTypeBuilder + CreateJsonDataSetReaderMessageDataTypeBuilder() JsonDataSetReaderMessageDataTypeBuilder +} + +// _JsonDataSetReaderMessageDataType is the data-structure of this message +type _JsonDataSetReaderMessageDataType struct { + ExtensionObjectDefinitionContract + NetworkMessageContentMask JsonNetworkMessageContentMask + DataSetMessageContentMask JsonDataSetMessageContentMask +} + +var _ JsonDataSetReaderMessageDataType = (*_JsonDataSetReaderMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_JsonDataSetReaderMessageDataType)(nil) + +// NewJsonDataSetReaderMessageDataType factory function for _JsonDataSetReaderMessageDataType +func NewJsonDataSetReaderMessageDataType(networkMessageContentMask JsonNetworkMessageContentMask, dataSetMessageContentMask JsonDataSetMessageContentMask) *_JsonDataSetReaderMessageDataType { + _result := &_JsonDataSetReaderMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NetworkMessageContentMask: networkMessageContentMask, + DataSetMessageContentMask: dataSetMessageContentMask, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// JsonDataSetReaderMessageDataTypeBuilder is a builder for JsonDataSetReaderMessageDataType +type JsonDataSetReaderMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(networkMessageContentMask JsonNetworkMessageContentMask, dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder + // WithNetworkMessageContentMask adds NetworkMessageContentMask (property field) + WithNetworkMessageContentMask(JsonNetworkMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder + // WithDataSetMessageContentMask adds DataSetMessageContentMask (property field) + WithDataSetMessageContentMask(JsonDataSetMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder + // Build builds the JsonDataSetReaderMessageDataType or returns an error if something is wrong + Build() (JsonDataSetReaderMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() JsonDataSetReaderMessageDataType +} + +// NewJsonDataSetReaderMessageDataTypeBuilder() creates a JsonDataSetReaderMessageDataTypeBuilder +func NewJsonDataSetReaderMessageDataTypeBuilder() JsonDataSetReaderMessageDataTypeBuilder { + return &_JsonDataSetReaderMessageDataTypeBuilder{_JsonDataSetReaderMessageDataType: new(_JsonDataSetReaderMessageDataType)} +} + +type _JsonDataSetReaderMessageDataTypeBuilder struct { + *_JsonDataSetReaderMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (JsonDataSetReaderMessageDataTypeBuilder) = (*_JsonDataSetReaderMessageDataTypeBuilder)(nil) + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) WithMandatoryFields(networkMessageContentMask JsonNetworkMessageContentMask, dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder { + return b.WithNetworkMessageContentMask(networkMessageContentMask).WithDataSetMessageContentMask(dataSetMessageContentMask) +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) WithNetworkMessageContentMask(networkMessageContentMask JsonNetworkMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder { + b.NetworkMessageContentMask = networkMessageContentMask + return b +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) WithDataSetMessageContentMask(dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetReaderMessageDataTypeBuilder { + b.DataSetMessageContentMask = dataSetMessageContentMask + return b +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) Build() (JsonDataSetReaderMessageDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._JsonDataSetReaderMessageDataType.deepCopy(), nil +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) MustBuild() JsonDataSetReaderMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_JsonDataSetReaderMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_JsonDataSetReaderMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateJsonDataSetReaderMessageDataTypeBuilder().(*_JsonDataSetReaderMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateJsonDataSetReaderMessageDataTypeBuilder creates a JsonDataSetReaderMessageDataTypeBuilder +func (b *_JsonDataSetReaderMessageDataType) CreateJsonDataSetReaderMessageDataTypeBuilder() JsonDataSetReaderMessageDataTypeBuilder { + if b == nil { + return NewJsonDataSetReaderMessageDataTypeBuilder() + } + return &_JsonDataSetReaderMessageDataTypeBuilder{_JsonDataSetReaderMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_JsonDataSetReaderMessageDataType) GetExtensionId() int32 { + return int32(15667) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_JsonDataSetReaderMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_JsonDataSetReaderMessageDataType) GetNetworkMessageContentMask() JsonNetworkMessageContentMask { + return m.NetworkMessageContentMask +} + +func (m *_JsonDataSetReaderMessageDataType) GetDataSetMessageContentMask() JsonDataSetMessageContentMask { + return m.DataSetMessageContentMask +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastJsonDataSetReaderMessageDataType(structType any) JsonDataSetReaderMessageDataType { + if casted, ok := structType.(JsonDataSetReaderMessageDataType); ok { + return casted + } + if casted, ok := structType.(*JsonDataSetReaderMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_JsonDataSetReaderMessageDataType) GetTypeName() string { + return "JsonDataSetReaderMessageDataType" +} + +func (m *_JsonDataSetReaderMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (networkMessageContentMask) + lengthInBits += 32 + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32 + + return lengthInBits +} + +func (m *_JsonDataSetReaderMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_JsonDataSetReaderMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__jsonDataSetReaderMessageDataType JsonDataSetReaderMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("JsonDataSetReaderMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for JsonDataSetReaderMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + networkMessageContentMask, err := ReadEnumField[JsonNetworkMessageContentMask](ctx, "networkMessageContentMask", "JsonNetworkMessageContentMask", ReadEnum(JsonNetworkMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageContentMask' field")) + } + m.NetworkMessageContentMask = networkMessageContentMask + + dataSetMessageContentMask, err := ReadEnumField[JsonDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "JsonDataSetMessageContentMask", ReadEnum(JsonDataSetMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMessageContentMask' field")) + } + m.DataSetMessageContentMask = dataSetMessageContentMask + + if closeErr := readBuffer.CloseContext("JsonDataSetReaderMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for JsonDataSetReaderMessageDataType") + } + + return m, nil +} + +func (m *_JsonDataSetReaderMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_JsonDataSetReaderMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("JsonDataSetReaderMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for JsonDataSetReaderMessageDataType") + } + + if err := WriteSimpleEnumField[JsonNetworkMessageContentMask](ctx, "networkMessageContentMask", "JsonNetworkMessageContentMask", m.GetNetworkMessageContentMask(), WriteEnum[JsonNetworkMessageContentMask, uint32](JsonNetworkMessageContentMask.GetValue, JsonNetworkMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageContentMask' field") + } + + if err := WriteSimpleEnumField[JsonDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "JsonDataSetMessageContentMask", m.GetDataSetMessageContentMask(), WriteEnum[JsonDataSetMessageContentMask, uint32](JsonDataSetMessageContentMask.GetValue, JsonDataSetMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMessageContentMask' field") + } + + if popErr := writeBuffer.PopContext("JsonDataSetReaderMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for JsonDataSetReaderMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_JsonDataSetReaderMessageDataType) IsJsonDataSetReaderMessageDataType() {} + +func (m *_JsonDataSetReaderMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_JsonDataSetReaderMessageDataType) deepCopy() *_JsonDataSetReaderMessageDataType { + if m == nil { + return nil + } + _JsonDataSetReaderMessageDataTypeCopy := &_JsonDataSetReaderMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NetworkMessageContentMask, + m.DataSetMessageContentMask, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _JsonDataSetReaderMessageDataTypeCopy +} + +func (m *_JsonDataSetReaderMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/JsonDataSetWriterMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/JsonDataSetWriterMessageDataType.go new file mode 100644 index 00000000000..ebe334d1cc3 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/JsonDataSetWriterMessageDataType.go @@ -0,0 +1,306 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// JsonDataSetWriterMessageDataType is the corresponding interface of JsonDataSetWriterMessageDataType +type JsonDataSetWriterMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataSetMessageContentMask returns DataSetMessageContentMask (property field) + GetDataSetMessageContentMask() JsonDataSetMessageContentMask + // IsJsonDataSetWriterMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsJsonDataSetWriterMessageDataType() + // CreateBuilder creates a JsonDataSetWriterMessageDataTypeBuilder + CreateJsonDataSetWriterMessageDataTypeBuilder() JsonDataSetWriterMessageDataTypeBuilder +} + +// _JsonDataSetWriterMessageDataType is the data-structure of this message +type _JsonDataSetWriterMessageDataType struct { + ExtensionObjectDefinitionContract + DataSetMessageContentMask JsonDataSetMessageContentMask +} + +var _ JsonDataSetWriterMessageDataType = (*_JsonDataSetWriterMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_JsonDataSetWriterMessageDataType)(nil) + +// NewJsonDataSetWriterMessageDataType factory function for _JsonDataSetWriterMessageDataType +func NewJsonDataSetWriterMessageDataType(dataSetMessageContentMask JsonDataSetMessageContentMask) *_JsonDataSetWriterMessageDataType { + _result := &_JsonDataSetWriterMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataSetMessageContentMask: dataSetMessageContentMask, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// JsonDataSetWriterMessageDataTypeBuilder is a builder for JsonDataSetWriterMessageDataType +type JsonDataSetWriterMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetWriterMessageDataTypeBuilder + // WithDataSetMessageContentMask adds DataSetMessageContentMask (property field) + WithDataSetMessageContentMask(JsonDataSetMessageContentMask) JsonDataSetWriterMessageDataTypeBuilder + // Build builds the JsonDataSetWriterMessageDataType or returns an error if something is wrong + Build() (JsonDataSetWriterMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() JsonDataSetWriterMessageDataType +} + +// NewJsonDataSetWriterMessageDataTypeBuilder() creates a JsonDataSetWriterMessageDataTypeBuilder +func NewJsonDataSetWriterMessageDataTypeBuilder() JsonDataSetWriterMessageDataTypeBuilder { + return &_JsonDataSetWriterMessageDataTypeBuilder{_JsonDataSetWriterMessageDataType: new(_JsonDataSetWriterMessageDataType)} +} + +type _JsonDataSetWriterMessageDataTypeBuilder struct { + *_JsonDataSetWriterMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (JsonDataSetWriterMessageDataTypeBuilder) = (*_JsonDataSetWriterMessageDataTypeBuilder)(nil) + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) WithMandatoryFields(dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetWriterMessageDataTypeBuilder { + return b.WithDataSetMessageContentMask(dataSetMessageContentMask) +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) WithDataSetMessageContentMask(dataSetMessageContentMask JsonDataSetMessageContentMask) JsonDataSetWriterMessageDataTypeBuilder { + b.DataSetMessageContentMask = dataSetMessageContentMask + return b +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) Build() (JsonDataSetWriterMessageDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._JsonDataSetWriterMessageDataType.deepCopy(), nil +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) MustBuild() JsonDataSetWriterMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_JsonDataSetWriterMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_JsonDataSetWriterMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateJsonDataSetWriterMessageDataTypeBuilder().(*_JsonDataSetWriterMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateJsonDataSetWriterMessageDataTypeBuilder creates a JsonDataSetWriterMessageDataTypeBuilder +func (b *_JsonDataSetWriterMessageDataType) CreateJsonDataSetWriterMessageDataTypeBuilder() JsonDataSetWriterMessageDataTypeBuilder { + if b == nil { + return NewJsonDataSetWriterMessageDataTypeBuilder() + } + return &_JsonDataSetWriterMessageDataTypeBuilder{_JsonDataSetWriterMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_JsonDataSetWriterMessageDataType) GetExtensionId() int32 { + return int32(15666) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_JsonDataSetWriterMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_JsonDataSetWriterMessageDataType) GetDataSetMessageContentMask() JsonDataSetMessageContentMask { + return m.DataSetMessageContentMask +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastJsonDataSetWriterMessageDataType(structType any) JsonDataSetWriterMessageDataType { + if casted, ok := structType.(JsonDataSetWriterMessageDataType); ok { + return casted + } + if casted, ok := structType.(*JsonDataSetWriterMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_JsonDataSetWriterMessageDataType) GetTypeName() string { + return "JsonDataSetWriterMessageDataType" +} + +func (m *_JsonDataSetWriterMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32 + + return lengthInBits +} + +func (m *_JsonDataSetWriterMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_JsonDataSetWriterMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__jsonDataSetWriterMessageDataType JsonDataSetWriterMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("JsonDataSetWriterMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for JsonDataSetWriterMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataSetMessageContentMask, err := ReadEnumField[JsonDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "JsonDataSetMessageContentMask", ReadEnum(JsonDataSetMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMessageContentMask' field")) + } + m.DataSetMessageContentMask = dataSetMessageContentMask + + if closeErr := readBuffer.CloseContext("JsonDataSetWriterMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for JsonDataSetWriterMessageDataType") + } + + return m, nil +} + +func (m *_JsonDataSetWriterMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_JsonDataSetWriterMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("JsonDataSetWriterMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for JsonDataSetWriterMessageDataType") + } + + if err := WriteSimpleEnumField[JsonDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "JsonDataSetMessageContentMask", m.GetDataSetMessageContentMask(), WriteEnum[JsonDataSetMessageContentMask, uint32](JsonDataSetMessageContentMask.GetValue, JsonDataSetMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMessageContentMask' field") + } + + if popErr := writeBuffer.PopContext("JsonDataSetWriterMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for JsonDataSetWriterMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_JsonDataSetWriterMessageDataType) IsJsonDataSetWriterMessageDataType() {} + +func (m *_JsonDataSetWriterMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_JsonDataSetWriterMessageDataType) deepCopy() *_JsonDataSetWriterMessageDataType { + if m == nil { + return nil + } + _JsonDataSetWriterMessageDataTypeCopy := &_JsonDataSetWriterMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataSetMessageContentMask, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _JsonDataSetWriterMessageDataTypeCopy +} + +func (m *_JsonDataSetWriterMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/JsonWriterGroupMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/JsonWriterGroupMessageDataType.go new file mode 100644 index 00000000000..1f8ef34d9f9 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/JsonWriterGroupMessageDataType.go @@ -0,0 +1,306 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// JsonWriterGroupMessageDataType is the corresponding interface of JsonWriterGroupMessageDataType +type JsonWriterGroupMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNetworkMessageContentMask returns NetworkMessageContentMask (property field) + GetNetworkMessageContentMask() JsonNetworkMessageContentMask + // IsJsonWriterGroupMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsJsonWriterGroupMessageDataType() + // CreateBuilder creates a JsonWriterGroupMessageDataTypeBuilder + CreateJsonWriterGroupMessageDataTypeBuilder() JsonWriterGroupMessageDataTypeBuilder +} + +// _JsonWriterGroupMessageDataType is the data-structure of this message +type _JsonWriterGroupMessageDataType struct { + ExtensionObjectDefinitionContract + NetworkMessageContentMask JsonNetworkMessageContentMask +} + +var _ JsonWriterGroupMessageDataType = (*_JsonWriterGroupMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_JsonWriterGroupMessageDataType)(nil) + +// NewJsonWriterGroupMessageDataType factory function for _JsonWriterGroupMessageDataType +func NewJsonWriterGroupMessageDataType(networkMessageContentMask JsonNetworkMessageContentMask) *_JsonWriterGroupMessageDataType { + _result := &_JsonWriterGroupMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NetworkMessageContentMask: networkMessageContentMask, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// JsonWriterGroupMessageDataTypeBuilder is a builder for JsonWriterGroupMessageDataType +type JsonWriterGroupMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(networkMessageContentMask JsonNetworkMessageContentMask) JsonWriterGroupMessageDataTypeBuilder + // WithNetworkMessageContentMask adds NetworkMessageContentMask (property field) + WithNetworkMessageContentMask(JsonNetworkMessageContentMask) JsonWriterGroupMessageDataTypeBuilder + // Build builds the JsonWriterGroupMessageDataType or returns an error if something is wrong + Build() (JsonWriterGroupMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() JsonWriterGroupMessageDataType +} + +// NewJsonWriterGroupMessageDataTypeBuilder() creates a JsonWriterGroupMessageDataTypeBuilder +func NewJsonWriterGroupMessageDataTypeBuilder() JsonWriterGroupMessageDataTypeBuilder { + return &_JsonWriterGroupMessageDataTypeBuilder{_JsonWriterGroupMessageDataType: new(_JsonWriterGroupMessageDataType)} +} + +type _JsonWriterGroupMessageDataTypeBuilder struct { + *_JsonWriterGroupMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (JsonWriterGroupMessageDataTypeBuilder) = (*_JsonWriterGroupMessageDataTypeBuilder)(nil) + +func (b *_JsonWriterGroupMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) WithMandatoryFields(networkMessageContentMask JsonNetworkMessageContentMask) JsonWriterGroupMessageDataTypeBuilder { + return b.WithNetworkMessageContentMask(networkMessageContentMask) +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) WithNetworkMessageContentMask(networkMessageContentMask JsonNetworkMessageContentMask) JsonWriterGroupMessageDataTypeBuilder { + b.NetworkMessageContentMask = networkMessageContentMask + return b +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) Build() (JsonWriterGroupMessageDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._JsonWriterGroupMessageDataType.deepCopy(), nil +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) MustBuild() JsonWriterGroupMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_JsonWriterGroupMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_JsonWriterGroupMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateJsonWriterGroupMessageDataTypeBuilder().(*_JsonWriterGroupMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateJsonWriterGroupMessageDataTypeBuilder creates a JsonWriterGroupMessageDataTypeBuilder +func (b *_JsonWriterGroupMessageDataType) CreateJsonWriterGroupMessageDataTypeBuilder() JsonWriterGroupMessageDataTypeBuilder { + if b == nil { + return NewJsonWriterGroupMessageDataTypeBuilder() + } + return &_JsonWriterGroupMessageDataTypeBuilder{_JsonWriterGroupMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_JsonWriterGroupMessageDataType) GetExtensionId() int32 { + return int32(15659) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_JsonWriterGroupMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_JsonWriterGroupMessageDataType) GetNetworkMessageContentMask() JsonNetworkMessageContentMask { + return m.NetworkMessageContentMask +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastJsonWriterGroupMessageDataType(structType any) JsonWriterGroupMessageDataType { + if casted, ok := structType.(JsonWriterGroupMessageDataType); ok { + return casted + } + if casted, ok := structType.(*JsonWriterGroupMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_JsonWriterGroupMessageDataType) GetTypeName() string { + return "JsonWriterGroupMessageDataType" +} + +func (m *_JsonWriterGroupMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (networkMessageContentMask) + lengthInBits += 32 + + return lengthInBits +} + +func (m *_JsonWriterGroupMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_JsonWriterGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__jsonWriterGroupMessageDataType JsonWriterGroupMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("JsonWriterGroupMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for JsonWriterGroupMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + networkMessageContentMask, err := ReadEnumField[JsonNetworkMessageContentMask](ctx, "networkMessageContentMask", "JsonNetworkMessageContentMask", ReadEnum(JsonNetworkMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageContentMask' field")) + } + m.NetworkMessageContentMask = networkMessageContentMask + + if closeErr := readBuffer.CloseContext("JsonWriterGroupMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for JsonWriterGroupMessageDataType") + } + + return m, nil +} + +func (m *_JsonWriterGroupMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_JsonWriterGroupMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("JsonWriterGroupMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for JsonWriterGroupMessageDataType") + } + + if err := WriteSimpleEnumField[JsonNetworkMessageContentMask](ctx, "networkMessageContentMask", "JsonNetworkMessageContentMask", m.GetNetworkMessageContentMask(), WriteEnum[JsonNetworkMessageContentMask, uint32](JsonNetworkMessageContentMask.GetValue, JsonNetworkMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageContentMask' field") + } + + if popErr := writeBuffer.PopContext("JsonWriterGroupMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for JsonWriterGroupMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_JsonWriterGroupMessageDataType) IsJsonWriterGroupMessageDataType() {} + +func (m *_JsonWriterGroupMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_JsonWriterGroupMessageDataType) deepCopy() *_JsonWriterGroupMessageDataType { + if m == nil { + return nil + } + _JsonWriterGroupMessageDataTypeCopy := &_JsonWriterGroupMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NetworkMessageContentMask, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _JsonWriterGroupMessageDataTypeCopy +} + +func (m *_JsonWriterGroupMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/KeyValuePair.go b/plc4go/protocols/opcua/readwrite/model/KeyValuePair.go index a52f1ad6c4a..3cd1561bda7 100644 --- a/plc4go/protocols/opcua/readwrite/model/KeyValuePair.go +++ b/plc4go/protocols/opcua/readwrite/model/KeyValuePair.go @@ -222,8 +222,8 @@ func (b *_KeyValuePair) CreateKeyValuePairBuilder() KeyValuePairBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_KeyValuePair) GetIdentifier() string { - return "14535" +func (m *_KeyValuePair) GetExtensionId() int32 { + return int32(14535) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_KeyValuePair) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_KeyValuePair) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__keyValuePair KeyValuePair, err error) { +func (m *_KeyValuePair) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__keyValuePair KeyValuePair, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/LinearConversionDataType.go b/plc4go/protocols/opcua/readwrite/model/LinearConversionDataType.go index 041dd2a300e..552f27f7a17 100644 --- a/plc4go/protocols/opcua/readwrite/model/LinearConversionDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/LinearConversionDataType.go @@ -196,8 +196,8 @@ func (b *_LinearConversionDataType) CreateLinearConversionDataTypeBuilder() Line /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_LinearConversionDataType) GetIdentifier() string { - return "32437" +func (m *_LinearConversionDataType) GetExtensionId() int32 { + return int32(32437) } /////////////////////// @@ -272,7 +272,7 @@ func (m *_LinearConversionDataType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_LinearConversionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__linearConversionDataType LinearConversionDataType, err error) { +func (m *_LinearConversionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__linearConversionDataType LinearConversionDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/LiteralOperand.go b/plc4go/protocols/opcua/readwrite/model/LiteralOperand.go new file mode 100644 index 00000000000..9a69f3a560a --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/LiteralOperand.go @@ -0,0 +1,330 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// LiteralOperand is the corresponding interface of LiteralOperand +type LiteralOperand interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetValue returns Value (property field) + GetValue() Variant + // IsLiteralOperand is a marker method to prevent unintentional type checks (interfaces of same signature) + IsLiteralOperand() + // CreateBuilder creates a LiteralOperandBuilder + CreateLiteralOperandBuilder() LiteralOperandBuilder +} + +// _LiteralOperand is the data-structure of this message +type _LiteralOperand struct { + ExtensionObjectDefinitionContract + Value Variant +} + +var _ LiteralOperand = (*_LiteralOperand)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_LiteralOperand)(nil) + +// NewLiteralOperand factory function for _LiteralOperand +func NewLiteralOperand(value Variant) *_LiteralOperand { + if value == nil { + panic("value of type Variant for LiteralOperand must not be nil") + } + _result := &_LiteralOperand{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Value: value, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// LiteralOperandBuilder is a builder for LiteralOperand +type LiteralOperandBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(value Variant) LiteralOperandBuilder + // WithValue adds Value (property field) + WithValue(Variant) LiteralOperandBuilder + // WithValueBuilder adds Value (property field) which is build by the builder + WithValueBuilder(func(VariantBuilder) VariantBuilder) LiteralOperandBuilder + // Build builds the LiteralOperand or returns an error if something is wrong + Build() (LiteralOperand, error) + // MustBuild does the same as Build but panics on error + MustBuild() LiteralOperand +} + +// NewLiteralOperandBuilder() creates a LiteralOperandBuilder +func NewLiteralOperandBuilder() LiteralOperandBuilder { + return &_LiteralOperandBuilder{_LiteralOperand: new(_LiteralOperand)} +} + +type _LiteralOperandBuilder struct { + *_LiteralOperand + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (LiteralOperandBuilder) = (*_LiteralOperandBuilder)(nil) + +func (b *_LiteralOperandBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_LiteralOperandBuilder) WithMandatoryFields(value Variant) LiteralOperandBuilder { + return b.WithValue(value) +} + +func (b *_LiteralOperandBuilder) WithValue(value Variant) LiteralOperandBuilder { + b.Value = value + return b +} + +func (b *_LiteralOperandBuilder) WithValueBuilder(builderSupplier func(VariantBuilder) VariantBuilder) LiteralOperandBuilder { + builder := builderSupplier(b.Value.CreateVariantBuilder()) + var err error + b.Value, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_LiteralOperandBuilder) Build() (LiteralOperand, error) { + if b.Value == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'value' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._LiteralOperand.deepCopy(), nil +} + +func (b *_LiteralOperandBuilder) MustBuild() LiteralOperand { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_LiteralOperandBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_LiteralOperandBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_LiteralOperandBuilder) DeepCopy() any { + _copy := b.CreateLiteralOperandBuilder().(*_LiteralOperandBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateLiteralOperandBuilder creates a LiteralOperandBuilder +func (b *_LiteralOperand) CreateLiteralOperandBuilder() LiteralOperandBuilder { + if b == nil { + return NewLiteralOperandBuilder() + } + return &_LiteralOperandBuilder{_LiteralOperand: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_LiteralOperand) GetExtensionId() int32 { + return int32(597) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_LiteralOperand) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_LiteralOperand) GetValue() Variant { + return m.Value +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastLiteralOperand(structType any) LiteralOperand { + if casted, ok := structType.(LiteralOperand); ok { + return casted + } + if casted, ok := structType.(*LiteralOperand); ok { + return *casted + } + return nil +} + +func (m *_LiteralOperand) GetTypeName() string { + return "LiteralOperand" +} + +func (m *_LiteralOperand) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (value) + lengthInBits += m.Value.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_LiteralOperand) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_LiteralOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__literalOperand LiteralOperand, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("LiteralOperand"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for LiteralOperand") + } + currentPos := positionAware.GetPos() + _ = currentPos + + value, err := ReadSimpleField[Variant](ctx, "value", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'value' field")) + } + m.Value = value + + if closeErr := readBuffer.CloseContext("LiteralOperand"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for LiteralOperand") + } + + return m, nil +} + +func (m *_LiteralOperand) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_LiteralOperand) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("LiteralOperand"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for LiteralOperand") + } + + if err := WriteSimpleField[Variant](ctx, "value", m.GetValue(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("LiteralOperand"); popErr != nil { + return errors.Wrap(popErr, "Error popping for LiteralOperand") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_LiteralOperand) IsLiteralOperand() {} + +func (m *_LiteralOperand) DeepCopy() any { + return m.deepCopy() +} + +func (m *_LiteralOperand) deepCopy() *_LiteralOperand { + if m == nil { + return nil + } + _LiteralOperandCopy := &_LiteralOperand{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Value.DeepCopy().(Variant), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _LiteralOperandCopy +} + +func (m *_LiteralOperand) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/MdnsDiscoveryConfiguration.go b/plc4go/protocols/opcua/readwrite/model/MdnsDiscoveryConfiguration.go new file mode 100644 index 00000000000..c321826a4bb --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/MdnsDiscoveryConfiguration.go @@ -0,0 +1,379 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// MdnsDiscoveryConfiguration is the corresponding interface of MdnsDiscoveryConfiguration +type MdnsDiscoveryConfiguration interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetMdnsServerName returns MdnsServerName (property field) + GetMdnsServerName() PascalString + // GetServerCapabilities returns ServerCapabilities (property field) + GetServerCapabilities() []PascalString + // IsMdnsDiscoveryConfiguration is a marker method to prevent unintentional type checks (interfaces of same signature) + IsMdnsDiscoveryConfiguration() + // CreateBuilder creates a MdnsDiscoveryConfigurationBuilder + CreateMdnsDiscoveryConfigurationBuilder() MdnsDiscoveryConfigurationBuilder +} + +// _MdnsDiscoveryConfiguration is the data-structure of this message +type _MdnsDiscoveryConfiguration struct { + ExtensionObjectDefinitionContract + MdnsServerName PascalString + ServerCapabilities []PascalString +} + +var _ MdnsDiscoveryConfiguration = (*_MdnsDiscoveryConfiguration)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_MdnsDiscoveryConfiguration)(nil) + +// NewMdnsDiscoveryConfiguration factory function for _MdnsDiscoveryConfiguration +func NewMdnsDiscoveryConfiguration(mdnsServerName PascalString, serverCapabilities []PascalString) *_MdnsDiscoveryConfiguration { + if mdnsServerName == nil { + panic("mdnsServerName of type PascalString for MdnsDiscoveryConfiguration must not be nil") + } + _result := &_MdnsDiscoveryConfiguration{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + MdnsServerName: mdnsServerName, + ServerCapabilities: serverCapabilities, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// MdnsDiscoveryConfigurationBuilder is a builder for MdnsDiscoveryConfiguration +type MdnsDiscoveryConfigurationBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(mdnsServerName PascalString, serverCapabilities []PascalString) MdnsDiscoveryConfigurationBuilder + // WithMdnsServerName adds MdnsServerName (property field) + WithMdnsServerName(PascalString) MdnsDiscoveryConfigurationBuilder + // WithMdnsServerNameBuilder adds MdnsServerName (property field) which is build by the builder + WithMdnsServerNameBuilder(func(PascalStringBuilder) PascalStringBuilder) MdnsDiscoveryConfigurationBuilder + // WithServerCapabilities adds ServerCapabilities (property field) + WithServerCapabilities(...PascalString) MdnsDiscoveryConfigurationBuilder + // Build builds the MdnsDiscoveryConfiguration or returns an error if something is wrong + Build() (MdnsDiscoveryConfiguration, error) + // MustBuild does the same as Build but panics on error + MustBuild() MdnsDiscoveryConfiguration +} + +// NewMdnsDiscoveryConfigurationBuilder() creates a MdnsDiscoveryConfigurationBuilder +func NewMdnsDiscoveryConfigurationBuilder() MdnsDiscoveryConfigurationBuilder { + return &_MdnsDiscoveryConfigurationBuilder{_MdnsDiscoveryConfiguration: new(_MdnsDiscoveryConfiguration)} +} + +type _MdnsDiscoveryConfigurationBuilder struct { + *_MdnsDiscoveryConfiguration + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (MdnsDiscoveryConfigurationBuilder) = (*_MdnsDiscoveryConfigurationBuilder)(nil) + +func (b *_MdnsDiscoveryConfigurationBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_MdnsDiscoveryConfigurationBuilder) WithMandatoryFields(mdnsServerName PascalString, serverCapabilities []PascalString) MdnsDiscoveryConfigurationBuilder { + return b.WithMdnsServerName(mdnsServerName).WithServerCapabilities(serverCapabilities...) +} + +func (b *_MdnsDiscoveryConfigurationBuilder) WithMdnsServerName(mdnsServerName PascalString) MdnsDiscoveryConfigurationBuilder { + b.MdnsServerName = mdnsServerName + return b +} + +func (b *_MdnsDiscoveryConfigurationBuilder) WithMdnsServerNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) MdnsDiscoveryConfigurationBuilder { + builder := builderSupplier(b.MdnsServerName.CreatePascalStringBuilder()) + var err error + b.MdnsServerName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_MdnsDiscoveryConfigurationBuilder) WithServerCapabilities(serverCapabilities ...PascalString) MdnsDiscoveryConfigurationBuilder { + b.ServerCapabilities = serverCapabilities + return b +} + +func (b *_MdnsDiscoveryConfigurationBuilder) Build() (MdnsDiscoveryConfiguration, error) { + if b.MdnsServerName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'mdnsServerName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._MdnsDiscoveryConfiguration.deepCopy(), nil +} + +func (b *_MdnsDiscoveryConfigurationBuilder) MustBuild() MdnsDiscoveryConfiguration { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_MdnsDiscoveryConfigurationBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_MdnsDiscoveryConfigurationBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_MdnsDiscoveryConfigurationBuilder) DeepCopy() any { + _copy := b.CreateMdnsDiscoveryConfigurationBuilder().(*_MdnsDiscoveryConfigurationBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateMdnsDiscoveryConfigurationBuilder creates a MdnsDiscoveryConfigurationBuilder +func (b *_MdnsDiscoveryConfiguration) CreateMdnsDiscoveryConfigurationBuilder() MdnsDiscoveryConfigurationBuilder { + if b == nil { + return NewMdnsDiscoveryConfigurationBuilder() + } + return &_MdnsDiscoveryConfigurationBuilder{_MdnsDiscoveryConfiguration: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_MdnsDiscoveryConfiguration) GetExtensionId() int32 { + return int32(12893) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_MdnsDiscoveryConfiguration) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_MdnsDiscoveryConfiguration) GetMdnsServerName() PascalString { + return m.MdnsServerName +} + +func (m *_MdnsDiscoveryConfiguration) GetServerCapabilities() []PascalString { + return m.ServerCapabilities +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastMdnsDiscoveryConfiguration(structType any) MdnsDiscoveryConfiguration { + if casted, ok := structType.(MdnsDiscoveryConfiguration); ok { + return casted + } + if casted, ok := structType.(*MdnsDiscoveryConfiguration); ok { + return *casted + } + return nil +} + +func (m *_MdnsDiscoveryConfiguration) GetTypeName() string { + return "MdnsDiscoveryConfiguration" +} + +func (m *_MdnsDiscoveryConfiguration) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (mdnsServerName) + lengthInBits += m.MdnsServerName.GetLengthInBits(ctx) + + // Implicit Field (noOfServerCapabilities) + lengthInBits += 32 + + // Array field + if len(m.ServerCapabilities) > 0 { + for _curItem, element := range m.ServerCapabilities { + arrayCtx := utils.CreateArrayContext(ctx, len(m.ServerCapabilities), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_MdnsDiscoveryConfiguration) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_MdnsDiscoveryConfiguration) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__mdnsDiscoveryConfiguration MdnsDiscoveryConfiguration, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("MdnsDiscoveryConfiguration"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for MdnsDiscoveryConfiguration") + } + currentPos := positionAware.GetPos() + _ = currentPos + + mdnsServerName, err := ReadSimpleField[PascalString](ctx, "mdnsServerName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'mdnsServerName' field")) + } + m.MdnsServerName = mdnsServerName + + noOfServerCapabilities, err := ReadImplicitField[int32](ctx, "noOfServerCapabilities", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerCapabilities' field")) + } + _ = noOfServerCapabilities + + serverCapabilities, err := ReadCountArrayField[PascalString](ctx, "serverCapabilities", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerCapabilities)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'serverCapabilities' field")) + } + m.ServerCapabilities = serverCapabilities + + if closeErr := readBuffer.CloseContext("MdnsDiscoveryConfiguration"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for MdnsDiscoveryConfiguration") + } + + return m, nil +} + +func (m *_MdnsDiscoveryConfiguration) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_MdnsDiscoveryConfiguration) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("MdnsDiscoveryConfiguration"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for MdnsDiscoveryConfiguration") + } + + if err := WriteSimpleField[PascalString](ctx, "mdnsServerName", m.GetMdnsServerName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'mdnsServerName' field") + } + noOfServerCapabilities := int32(utils.InlineIf(bool((m.GetServerCapabilities()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerCapabilities()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerCapabilities", noOfServerCapabilities, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfServerCapabilities' field") + } + + if err := WriteComplexTypeArrayField(ctx, "serverCapabilities", m.GetServerCapabilities(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'serverCapabilities' field") + } + + if popErr := writeBuffer.PopContext("MdnsDiscoveryConfiguration"); popErr != nil { + return errors.Wrap(popErr, "Error popping for MdnsDiscoveryConfiguration") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_MdnsDiscoveryConfiguration) IsMdnsDiscoveryConfiguration() {} + +func (m *_MdnsDiscoveryConfiguration) DeepCopy() any { + return m.deepCopy() +} + +func (m *_MdnsDiscoveryConfiguration) deepCopy() *_MdnsDiscoveryConfiguration { + if m == nil { + return nil + } + _MdnsDiscoveryConfigurationCopy := &_MdnsDiscoveryConfiguration{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.MdnsServerName.DeepCopy().(PascalString), + utils.DeepCopySlice[PascalString, PascalString](m.ServerCapabilities), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _MdnsDiscoveryConfigurationCopy +} + +func (m *_MdnsDiscoveryConfiguration) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/MessagePDU.go b/plc4go/protocols/opcua/readwrite/model/MessagePDU.go index 4d146550bfc..53bf485d107 100644 --- a/plc4go/protocols/opcua/readwrite/model/MessagePDU.go +++ b/plc4go/protocols/opcua/readwrite/model/MessagePDU.go @@ -51,6 +51,8 @@ type MessagePDU interface { type MessagePDUContract interface { // GetChunk returns Chunk (property field) GetChunk() ChunkType + // GetBinary() returns a parser argument + GetBinary() bool // IsMessagePDU is a marker method to prevent unintentional type checks (interfaces of same signature) IsMessagePDU() // CreateBuilder creates a MessagePDUBuilder @@ -74,13 +76,16 @@ type _MessagePDU struct { MessagePDURequirements } Chunk ChunkType + + // Arguments. + Binary bool } var _ MessagePDUContract = (*_MessagePDU)(nil) // NewMessagePDU factory function for _MessagePDU -func NewMessagePDU(chunk ChunkType) *_MessagePDU { - return &_MessagePDU{Chunk: chunk} +func NewMessagePDU(chunk ChunkType, binary bool) *_MessagePDU { + return &_MessagePDU{Chunk: chunk, Binary: binary} } /////////////////////////////////////////////////////////// @@ -412,13 +417,13 @@ func (m *_MessagePDU) GetLengthInBytes(ctx context.Context) uint16 { return m._SubType.GetLengthInBits(ctx) / 8 } -func MessagePDUParse[T MessagePDU](ctx context.Context, theBytes []byte, response bool) (T, error) { - return MessagePDUParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), response) +func MessagePDUParse[T MessagePDU](ctx context.Context, theBytes []byte, response bool, binary bool) (T, error) { + return MessagePDUParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), response, binary) } -func MessagePDUParseWithBufferProducer[T MessagePDU](response bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { +func MessagePDUParseWithBufferProducer[T MessagePDU](response bool, binary bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { return func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { - v, err := MessagePDUParseWithBuffer[T](ctx, readBuffer, response) + v, err := MessagePDUParseWithBuffer[T](ctx, readBuffer, response, binary) if err != nil { var zero T return zero, err @@ -427,8 +432,8 @@ func MessagePDUParseWithBufferProducer[T MessagePDU](response bool) func(ctx con } } -func MessagePDUParseWithBuffer[T MessagePDU](ctx context.Context, readBuffer utils.ReadBuffer, response bool) (T, error) { - v, err := (&_MessagePDU{}).parse(ctx, readBuffer, response) +func MessagePDUParseWithBuffer[T MessagePDU](ctx context.Context, readBuffer utils.ReadBuffer, response bool, binary bool) (T, error) { + v, err := (&_MessagePDU{Binary: binary}).parse(ctx, readBuffer, response, binary) if err != nil { var zero T return zero, err @@ -441,7 +446,7 @@ func MessagePDUParseWithBuffer[T MessagePDU](ctx context.Context, readBuffer uti return vc, nil } -func (m *_MessagePDU) parse(ctx context.Context, readBuffer utils.ReadBuffer, response bool) (__messagePDU MessagePDU, err error) { +func (m *_MessagePDU) parse(ctx context.Context, readBuffer utils.ReadBuffer, response bool, binary bool) (__messagePDU MessagePDU, err error) { positionAware := readBuffer _ = positionAware if pullErr := readBuffer.PullContext("MessagePDU"); pullErr != nil { @@ -471,35 +476,35 @@ func (m *_MessagePDU) parse(ctx context.Context, readBuffer utils.ReadBuffer, re var _child MessagePDU switch { case messageType == "HEL" && response == bool(false): // OpcuaHelloRequest - if _child, err = new(_OpcuaHelloRequest).parse(ctx, readBuffer, m, response); err != nil { + if _child, err = new(_OpcuaHelloRequest).parse(ctx, readBuffer, m, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaHelloRequest for type-switch of MessagePDU") } case messageType == "ACK" && response == bool(true): // OpcuaAcknowledgeResponse - if _child, err = new(_OpcuaAcknowledgeResponse).parse(ctx, readBuffer, m, response); err != nil { + if _child, err = new(_OpcuaAcknowledgeResponse).parse(ctx, readBuffer, m, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaAcknowledgeResponse for type-switch of MessagePDU") } case messageType == "OPN" && response == bool(false): // OpcuaOpenRequest - if _child, err = new(_OpcuaOpenRequest).parse(ctx, readBuffer, m, totalLength, response); err != nil { + if _child, err = new(_OpcuaOpenRequest).parse(ctx, readBuffer, m, totalLength, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaOpenRequest for type-switch of MessagePDU") } case messageType == "OPN" && response == bool(true): // OpcuaOpenResponse - if _child, err = new(_OpcuaOpenResponse).parse(ctx, readBuffer, m, totalLength, response); err != nil { + if _child, err = new(_OpcuaOpenResponse).parse(ctx, readBuffer, m, totalLength, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaOpenResponse for type-switch of MessagePDU") } case messageType == "CLO" && response == bool(false): // OpcuaCloseRequest - if _child, err = new(_OpcuaCloseRequest).parse(ctx, readBuffer, m, response); err != nil { + if _child, err = new(_OpcuaCloseRequest).parse(ctx, readBuffer, m, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaCloseRequest for type-switch of MessagePDU") } case messageType == "MSG" && response == bool(false): // OpcuaMessageRequest - if _child, err = new(_OpcuaMessageRequest).parse(ctx, readBuffer, m, totalLength, response); err != nil { + if _child, err = new(_OpcuaMessageRequest).parse(ctx, readBuffer, m, totalLength, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaMessageRequest for type-switch of MessagePDU") } case messageType == "MSG" && response == bool(true): // OpcuaMessageResponse - if _child, err = new(_OpcuaMessageResponse).parse(ctx, readBuffer, m, totalLength, response); err != nil { + if _child, err = new(_OpcuaMessageResponse).parse(ctx, readBuffer, m, totalLength, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaMessageResponse for type-switch of MessagePDU") } case messageType == "ERR" && response == bool(true): // OpcuaMessageError - if _child, err = new(_OpcuaMessageError).parse(ctx, readBuffer, m, response); err != nil { + if _child, err = new(_OpcuaMessageError).parse(ctx, readBuffer, m, response, binary); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type OpcuaMessageError for type-switch of MessagePDU") } default: @@ -548,6 +553,16 @@ func (pm *_MessagePDU) serializeParent(ctx context.Context, writeBuffer utils.Wr return nil } +//// +// Arguments Getter + +func (m *_MessagePDU) GetBinary() bool { + return m.Binary +} + +// +//// + func (m *_MessagePDU) IsMessagePDU() {} func (m *_MessagePDU) DeepCopy() any { @@ -561,6 +576,7 @@ func (m *_MessagePDU) deepCopy() *_MessagePDU { _MessagePDUCopy := &_MessagePDU{ nil, // will be set by child m.Chunk, + m.Binary, } return _MessagePDUCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/MethodAttributes.go b/plc4go/protocols/opcua/readwrite/model/MethodAttributes.go new file mode 100644 index 00000000000..c063cc87ad5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/MethodAttributes.go @@ -0,0 +1,544 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// MethodAttributes is the corresponding interface of MethodAttributes +type MethodAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetUserExecutable returns UserExecutable (property field) + GetUserExecutable() bool + // GetExecutable returns Executable (property field) + GetExecutable() bool + // IsMethodAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsMethodAttributes() + // CreateBuilder creates a MethodAttributesBuilder + CreateMethodAttributesBuilder() MethodAttributesBuilder +} + +// _MethodAttributes is the data-structure of this message +type _MethodAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + UserExecutable bool + Executable bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ MethodAttributes = (*_MethodAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_MethodAttributes)(nil) + +// NewMethodAttributes factory function for _MethodAttributes +func NewMethodAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, userExecutable bool, executable bool) *_MethodAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for MethodAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for MethodAttributes must not be nil") + } + _result := &_MethodAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + UserExecutable: userExecutable, + Executable: executable, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// MethodAttributesBuilder is a builder for MethodAttributes +type MethodAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, userExecutable bool, executable bool) MethodAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) MethodAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) MethodAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) MethodAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) MethodAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) MethodAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) MethodAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) MethodAttributesBuilder + // WithUserExecutable adds UserExecutable (property field) + WithUserExecutable(bool) MethodAttributesBuilder + // WithExecutable adds Executable (property field) + WithExecutable(bool) MethodAttributesBuilder + // Build builds the MethodAttributes or returns an error if something is wrong + Build() (MethodAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() MethodAttributes +} + +// NewMethodAttributesBuilder() creates a MethodAttributesBuilder +func NewMethodAttributesBuilder() MethodAttributesBuilder { + return &_MethodAttributesBuilder{_MethodAttributes: new(_MethodAttributes)} +} + +type _MethodAttributesBuilder struct { + *_MethodAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (MethodAttributesBuilder) = (*_MethodAttributesBuilder)(nil) + +func (b *_MethodAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_MethodAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, userExecutable bool, executable bool) MethodAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithUserExecutable(userExecutable).WithExecutable(executable) +} + +func (b *_MethodAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) MethodAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_MethodAttributesBuilder) WithDisplayName(displayName LocalizedText) MethodAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_MethodAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) MethodAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_MethodAttributesBuilder) WithDescription(description LocalizedText) MethodAttributesBuilder { + b.Description = description + return b +} + +func (b *_MethodAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) MethodAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_MethodAttributesBuilder) WithWriteMask(writeMask uint32) MethodAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_MethodAttributesBuilder) WithUserWriteMask(userWriteMask uint32) MethodAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_MethodAttributesBuilder) WithUserExecutable(userExecutable bool) MethodAttributesBuilder { + b.UserExecutable = userExecutable + return b +} + +func (b *_MethodAttributesBuilder) WithExecutable(executable bool) MethodAttributesBuilder { + b.Executable = executable + return b +} + +func (b *_MethodAttributesBuilder) Build() (MethodAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._MethodAttributes.deepCopy(), nil +} + +func (b *_MethodAttributesBuilder) MustBuild() MethodAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_MethodAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_MethodAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_MethodAttributesBuilder) DeepCopy() any { + _copy := b.CreateMethodAttributesBuilder().(*_MethodAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateMethodAttributesBuilder creates a MethodAttributesBuilder +func (b *_MethodAttributes) CreateMethodAttributesBuilder() MethodAttributesBuilder { + if b == nil { + return NewMethodAttributesBuilder() + } + return &_MethodAttributesBuilder{_MethodAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_MethodAttributes) GetExtensionId() int32 { + return int32(360) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_MethodAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_MethodAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_MethodAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_MethodAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_MethodAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_MethodAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_MethodAttributes) GetUserExecutable() bool { + return m.UserExecutable +} + +func (m *_MethodAttributes) GetExecutable() bool { + return m.Executable +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastMethodAttributes(structType any) MethodAttributes { + if casted, ok := structType.(MethodAttributes); ok { + return casted + } + if casted, ok := structType.(*MethodAttributes); ok { + return *casted + } + return nil +} + +func (m *_MethodAttributes) GetTypeName() string { + return "MethodAttributes" +} + +func (m *_MethodAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 6 + + // Simple field (userExecutable) + lengthInBits += 1 + + // Simple field (executable) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_MethodAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_MethodAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__methodAttributes MethodAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("MethodAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for MethodAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(6)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + userExecutable, err := ReadSimpleField(ctx, "userExecutable", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userExecutable' field")) + } + m.UserExecutable = userExecutable + + executable, err := ReadSimpleField(ctx, "executable", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'executable' field")) + } + m.Executable = executable + + if closeErr := readBuffer.CloseContext("MethodAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for MethodAttributes") + } + + return m, nil +} + +func (m *_MethodAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_MethodAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("MethodAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for MethodAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 6)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "userExecutable", m.GetUserExecutable(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'userExecutable' field") + } + + if err := WriteSimpleField[bool](ctx, "executable", m.GetExecutable(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'executable' field") + } + + if popErr := writeBuffer.PopContext("MethodAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for MethodAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_MethodAttributes) IsMethodAttributes() {} + +func (m *_MethodAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_MethodAttributes) deepCopy() *_MethodAttributes { + if m == nil { + return nil + } + _MethodAttributesCopy := &_MethodAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.UserExecutable, + m.Executable, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _MethodAttributesCopy +} + +func (m *_MethodAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ModelChangeStructureDataType.go b/plc4go/protocols/opcua/readwrite/model/ModelChangeStructureDataType.go index b75e37ee6dd..cc796d25a7e 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModelChangeStructureDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ModelChangeStructureDataType.go @@ -233,8 +233,8 @@ func (b *_ModelChangeStructureDataType) CreateModelChangeStructureDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModelChangeStructureDataType) GetIdentifier() string { - return "879" +func (m *_ModelChangeStructureDataType) GetExtensionId() int32 { + return int32(879) } /////////////////////// @@ -302,7 +302,7 @@ func (m *_ModelChangeStructureDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_ModelChangeStructureDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modelChangeStructureDataType ModelChangeStructureDataType, err error) { +func (m *_ModelChangeStructureDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modelChangeStructureDataType ModelChangeStructureDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ModificationInfo.go b/plc4go/protocols/opcua/readwrite/model/ModificationInfo.go index 7cb5abd8912..67572b9cabd 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModificationInfo.go +++ b/plc4go/protocols/opcua/readwrite/model/ModificationInfo.go @@ -209,8 +209,8 @@ func (b *_ModificationInfo) CreateModificationInfoBuilder() ModificationInfoBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModificationInfo) GetIdentifier() string { - return "11218" +func (m *_ModificationInfo) GetExtensionId() int32 { + return int32(11218) } /////////////////////// @@ -278,7 +278,7 @@ func (m *_ModificationInfo) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ModificationInfo) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modificationInfo ModificationInfo, err error) { +func (m *_ModificationInfo) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modificationInfo ModificationInfo, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsRequest.go b/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsRequest.go index 611696a0641..3e832034095 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsRequest.go @@ -41,15 +41,13 @@ type ModifyMonitoredItemsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetTimestampsToReturn returns TimestampsToReturn (property field) GetTimestampsToReturn() TimestampsToReturn - // GetNoOfItemsToModify returns NoOfItemsToModify (property field) - GetNoOfItemsToModify() int32 // GetItemsToModify returns ItemsToModify (property field) - GetItemsToModify() []ExtensionObjectDefinition + GetItemsToModify() []MonitoredItemModifyRequest // IsModifyMonitoredItemsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsModifyMonitoredItemsRequest() // CreateBuilder creates a ModifyMonitoredItemsRequestBuilder @@ -59,27 +57,25 @@ type ModifyMonitoredItemsRequest interface { // _ModifyMonitoredItemsRequest is the data-structure of this message type _ModifyMonitoredItemsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader SubscriptionId uint32 TimestampsToReturn TimestampsToReturn - NoOfItemsToModify int32 - ItemsToModify []ExtensionObjectDefinition + ItemsToModify []MonitoredItemModifyRequest } var _ ModifyMonitoredItemsRequest = (*_ModifyMonitoredItemsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ModifyMonitoredItemsRequest)(nil) // NewModifyMonitoredItemsRequest factory function for _ModifyMonitoredItemsRequest -func NewModifyMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToModify int32, itemsToModify []ExtensionObjectDefinition) *_ModifyMonitoredItemsRequest { +func NewModifyMonitoredItemsRequest(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToModify []MonitoredItemModifyRequest) *_ModifyMonitoredItemsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for ModifyMonitoredItemsRequest must not be nil") + panic("requestHeader of type RequestHeader for ModifyMonitoredItemsRequest must not be nil") } _result := &_ModifyMonitoredItemsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, SubscriptionId: subscriptionId, TimestampsToReturn: timestampsToReturn, - NoOfItemsToModify: noOfItemsToModify, ItemsToModify: itemsToModify, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,19 +91,17 @@ func NewModifyMonitoredItemsRequest(requestHeader ExtensionObjectDefinition, sub type ModifyMonitoredItemsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToModify int32, itemsToModify []ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToModify []MonitoredItemModifyRequest) ModifyMonitoredItemsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder + WithRequestHeader(RequestHeader) ModifyMonitoredItemsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifyMonitoredItemsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) ModifyMonitoredItemsRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) ModifyMonitoredItemsRequestBuilder // WithTimestampsToReturn adds TimestampsToReturn (property field) WithTimestampsToReturn(TimestampsToReturn) ModifyMonitoredItemsRequestBuilder - // WithNoOfItemsToModify adds NoOfItemsToModify (property field) - WithNoOfItemsToModify(int32) ModifyMonitoredItemsRequestBuilder // WithItemsToModify adds ItemsToModify (property field) - WithItemsToModify(...ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder + WithItemsToModify(...MonitoredItemModifyRequest) ModifyMonitoredItemsRequestBuilder // Build builds the ModifyMonitoredItemsRequest or returns an error if something is wrong Build() (ModifyMonitoredItemsRequest, error) // MustBuild does the same as Build but panics on error @@ -133,24 +127,24 @@ func (b *_ModifyMonitoredItemsRequestBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_ModifyMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, timestampsToReturn TimestampsToReturn, noOfItemsToModify int32, itemsToModify []ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTimestampsToReturn(timestampsToReturn).WithNoOfItemsToModify(noOfItemsToModify).WithItemsToModify(itemsToModify...) +func (b *_ModifyMonitoredItemsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, timestampsToReturn TimestampsToReturn, itemsToModify []MonitoredItemModifyRequest) ModifyMonitoredItemsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTimestampsToReturn(timestampsToReturn).WithItemsToModify(itemsToModify...) } -func (b *_ModifyMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder { +func (b *_ModifyMonitoredItemsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) ModifyMonitoredItemsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_ModifyMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifyMonitoredItemsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ModifyMonitoredItemsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) ModifyMonitoredItemsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -165,12 +159,7 @@ func (b *_ModifyMonitoredItemsRequestBuilder) WithTimestampsToReturn(timestampsT return b } -func (b *_ModifyMonitoredItemsRequestBuilder) WithNoOfItemsToModify(noOfItemsToModify int32) ModifyMonitoredItemsRequestBuilder { - b.NoOfItemsToModify = noOfItemsToModify - return b -} - -func (b *_ModifyMonitoredItemsRequestBuilder) WithItemsToModify(itemsToModify ...ExtensionObjectDefinition) ModifyMonitoredItemsRequestBuilder { +func (b *_ModifyMonitoredItemsRequestBuilder) WithItemsToModify(itemsToModify ...MonitoredItemModifyRequest) ModifyMonitoredItemsRequestBuilder { b.ItemsToModify = itemsToModify return b } @@ -231,8 +220,8 @@ func (b *_ModifyMonitoredItemsRequest) CreateModifyMonitoredItemsRequestBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModifyMonitoredItemsRequest) GetIdentifier() string { - return "763" +func (m *_ModifyMonitoredItemsRequest) GetExtensionId() int32 { + return int32(763) } /////////////////////// @@ -249,7 +238,7 @@ func (m *_ModifyMonitoredItemsRequest) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ModifyMonitoredItemsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_ModifyMonitoredItemsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -261,11 +250,7 @@ func (m *_ModifyMonitoredItemsRequest) GetTimestampsToReturn() TimestampsToRetur return m.TimestampsToReturn } -func (m *_ModifyMonitoredItemsRequest) GetNoOfItemsToModify() int32 { - return m.NoOfItemsToModify -} - -func (m *_ModifyMonitoredItemsRequest) GetItemsToModify() []ExtensionObjectDefinition { +func (m *_ModifyMonitoredItemsRequest) GetItemsToModify() []MonitoredItemModifyRequest { return m.ItemsToModify } @@ -301,7 +286,7 @@ func (m *_ModifyMonitoredItemsRequest) GetLengthInBits(ctx context.Context) uint // Simple field (timestampsToReturn) lengthInBits += 32 - // Simple field (noOfItemsToModify) + // Implicit Field (noOfItemsToModify) lengthInBits += 32 // Array field @@ -321,7 +306,7 @@ func (m *_ModifyMonitoredItemsRequest) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_ModifyMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modifyMonitoredItemsRequest ModifyMonitoredItemsRequest, err error) { +func (m *_ModifyMonitoredItemsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modifyMonitoredItemsRequest ModifyMonitoredItemsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -332,7 +317,7 @@ func (m *_ModifyMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -350,13 +335,13 @@ func (m *_ModifyMonitoredItemsRequest) parse(ctx context.Context, readBuffer uti } m.TimestampsToReturn = timestampsToReturn - noOfItemsToModify, err := ReadSimpleField(ctx, "noOfItemsToModify", ReadSignedInt(readBuffer, uint8(32))) + noOfItemsToModify, err := ReadImplicitField[int32](ctx, "noOfItemsToModify", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfItemsToModify' field")) } - m.NoOfItemsToModify = noOfItemsToModify + _ = noOfItemsToModify - itemsToModify, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "itemsToModify", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("757")), readBuffer), uint64(noOfItemsToModify)) + itemsToModify, err := ReadCountArrayField[MonitoredItemModifyRequest](ctx, "itemsToModify", ReadComplex[MonitoredItemModifyRequest](ExtensionObjectDefinitionParseWithBufferProducer[MonitoredItemModifyRequest]((int32)(int32(757))), readBuffer), uint64(noOfItemsToModify)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'itemsToModify' field")) } @@ -387,7 +372,7 @@ func (m *_ModifyMonitoredItemsRequest) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(pushErr, "Error pushing for ModifyMonitoredItemsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -398,8 +383,8 @@ func (m *_ModifyMonitoredItemsRequest) SerializeWithWriteBuffer(ctx context.Cont if err := WriteSimpleEnumField[TimestampsToReturn](ctx, "timestampsToReturn", "TimestampsToReturn", m.GetTimestampsToReturn(), WriteEnum[TimestampsToReturn, uint32](TimestampsToReturn.GetValue, TimestampsToReturn.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'timestampsToReturn' field") } - - if err := WriteSimpleField[int32](ctx, "noOfItemsToModify", m.GetNoOfItemsToModify(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfItemsToModify := int32(utils.InlineIf(bool((m.GetItemsToModify()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetItemsToModify()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfItemsToModify", noOfItemsToModify, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfItemsToModify' field") } @@ -427,11 +412,10 @@ func (m *_ModifyMonitoredItemsRequest) deepCopy() *_ModifyMonitoredItemsRequest } _ModifyMonitoredItemsRequestCopy := &_ModifyMonitoredItemsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.TimestampsToReturn, - m.NoOfItemsToModify, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ItemsToModify), + utils.DeepCopySlice[MonitoredItemModifyRequest, MonitoredItemModifyRequest](m.ItemsToModify), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ModifyMonitoredItemsRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsResponse.go b/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsResponse.go index f37a134d880..d36acf1bd83 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/ModifyMonitoredItemsResponse.go @@ -41,13 +41,9 @@ type ModifyMonitoredItemsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []MonitoredItemModifyResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsModifyMonitoredItemsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type ModifyMonitoredItemsResponse interface { // _ModifyMonitoredItemsResponse is the data-structure of this message type _ModifyMonitoredItemsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []MonitoredItemModifyResult + DiagnosticInfos []DiagnosticInfo } var _ ModifyMonitoredItemsResponse = (*_ModifyMonitoredItemsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ModifyMonitoredItemsResponse)(nil) // NewModifyMonitoredItemsResponse factory function for _ModifyMonitoredItemsResponse -func NewModifyMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_ModifyMonitoredItemsResponse { +func NewModifyMonitoredItemsResponse(responseHeader ResponseHeader, results []MonitoredItemModifyResult, diagnosticInfos []DiagnosticInfo) *_ModifyMonitoredItemsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for ModifyMonitoredItemsResponse must not be nil") + panic("responseHeader of type ResponseHeader for ModifyMonitoredItemsResponse must not be nil") } _result := &_ModifyMonitoredItemsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewModifyMonitoredItemsResponse(responseHeader ExtensionObjectDefinition, n type ModifyMonitoredItemsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ModifyMonitoredItemsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []MonitoredItemModifyResult, diagnosticInfos []DiagnosticInfo) ModifyMonitoredItemsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) ModifyMonitoredItemsResponseBuilder + WithResponseHeader(ResponseHeader) ModifyMonitoredItemsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifyMonitoredItemsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) ModifyMonitoredItemsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) ModifyMonitoredItemsResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) ModifyMonitoredItemsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) ModifyMonitoredItemsResponseBuilder + WithResults(...MonitoredItemModifyResult) ModifyMonitoredItemsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) ModifyMonitoredItemsResponseBuilder // Build builds the ModifyMonitoredItemsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_ModifyMonitoredItemsResponseBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_ModifyMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ModifyMonitoredItemsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_ModifyMonitoredItemsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []MonitoredItemModifyResult, diagnosticInfos []DiagnosticInfo) ModifyMonitoredItemsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_ModifyMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) ModifyMonitoredItemsResponseBuilder { +func (b *_ModifyMonitoredItemsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) ModifyMonitoredItemsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_ModifyMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifyMonitoredItemsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ModifyMonitoredItemsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) ModifyMonitoredItemsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_ModifyMonitoredItemsResponseBuilder) WithNoOfResults(noOfResults int32) ModifyMonitoredItemsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_ModifyMonitoredItemsResponseBuilder) WithResults(results ...ExtensionObjectDefinition) ModifyMonitoredItemsResponseBuilder { +func (b *_ModifyMonitoredItemsResponseBuilder) WithResults(results ...MonitoredItemModifyResult) ModifyMonitoredItemsResponseBuilder { b.Results = results return b } -func (b *_ModifyMonitoredItemsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) ModifyMonitoredItemsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_ModifyMonitoredItemsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) ModifyMonitoredItemsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_ModifyMonitoredItemsResponse) CreateModifyMonitoredItemsResponseBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModifyMonitoredItemsResponse) GetIdentifier() string { - return "766" +func (m *_ModifyMonitoredItemsResponse) GetExtensionId() int32 { + return int32(766) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_ModifyMonitoredItemsResponse) GetParent() ExtensionObjectDefinitionCon /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ModifyMonitoredItemsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_ModifyMonitoredItemsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_ModifyMonitoredItemsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_ModifyMonitoredItemsResponse) GetResults() []ExtensionObjectDefinition { +func (m *_ModifyMonitoredItemsResponse) GetResults() []MonitoredItemModifyResult { return m.Results } -func (m *_ModifyMonitoredItemsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_ModifyMonitoredItemsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_ModifyMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_ModifyMonitoredItemsResponse) GetLengthInBits(ctx context.Context) uin } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_ModifyMonitoredItemsResponse) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_ModifyMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modifyMonitoredItemsResponse ModifyMonitoredItemsResponse, err error) { +func (m *_ModifyMonitoredItemsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modifyMonitoredItemsResponse ModifyMonitoredItemsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_ModifyMonitoredItemsResponse) parse(ctx context.Context, readBuffer ut currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("760")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[MonitoredItemModifyResult](ctx, "results", ReadComplex[MonitoredItemModifyResult](ExtensionObjectDefinitionParseWithBufferProducer[MonitoredItemModifyResult]((int32)(int32(760))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_ModifyMonitoredItemsResponse) SerializeWithWriteBuffer(ctx context.Con return errors.Wrap(pushErr, "Error pushing for ModifyMonitoredItemsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_ModifyMonitoredItemsResponse) deepCopy() *_ModifyMonitoredItemsRespons } _ModifyMonitoredItemsResponseCopy := &_ModifyMonitoredItemsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[MonitoredItemModifyResult, MonitoredItemModifyResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionRequest.go b/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionRequest.go index 856c5cfb6d7..45de943e029 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionRequest.go @@ -41,7 +41,7 @@ type ModifySubscriptionRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetRequestedPublishingInterval returns RequestedPublishingInterval (property field) @@ -63,7 +63,7 @@ type ModifySubscriptionRequest interface { // _ModifySubscriptionRequest is the data-structure of this message type _ModifySubscriptionRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader SubscriptionId uint32 RequestedPublishingInterval float64 RequestedLifetimeCount uint32 @@ -76,9 +76,9 @@ var _ ModifySubscriptionRequest = (*_ModifySubscriptionRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ModifySubscriptionRequest)(nil) // NewModifySubscriptionRequest factory function for _ModifySubscriptionRequest -func NewModifySubscriptionRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) *_ModifySubscriptionRequest { +func NewModifySubscriptionRequest(requestHeader RequestHeader, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) *_ModifySubscriptionRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for ModifySubscriptionRequest must not be nil") + panic("requestHeader of type RequestHeader for ModifySubscriptionRequest must not be nil") } _result := &_ModifySubscriptionRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -103,11 +103,11 @@ func NewModifySubscriptionRequest(requestHeader ExtensionObjectDefinition, subsc type ModifySubscriptionRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) ModifySubscriptionRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) ModifySubscriptionRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) ModifySubscriptionRequestBuilder + WithRequestHeader(RequestHeader) ModifySubscriptionRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifySubscriptionRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) ModifySubscriptionRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) ModifySubscriptionRequestBuilder // WithRequestedPublishingInterval adds RequestedPublishingInterval (property field) @@ -145,24 +145,24 @@ func (b *_ModifySubscriptionRequestBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_ModifySubscriptionRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) ModifySubscriptionRequestBuilder { +func (b *_ModifySubscriptionRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, requestedPublishingInterval float64, requestedLifetimeCount uint32, requestedMaxKeepAliveCount uint32, maxNotificationsPerPublish uint32, priority uint8) ModifySubscriptionRequestBuilder { return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithRequestedPublishingInterval(requestedPublishingInterval).WithRequestedLifetimeCount(requestedLifetimeCount).WithRequestedMaxKeepAliveCount(requestedMaxKeepAliveCount).WithMaxNotificationsPerPublish(maxNotificationsPerPublish).WithPriority(priority) } -func (b *_ModifySubscriptionRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) ModifySubscriptionRequestBuilder { +func (b *_ModifySubscriptionRequestBuilder) WithRequestHeader(requestHeader RequestHeader) ModifySubscriptionRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_ModifySubscriptionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifySubscriptionRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ModifySubscriptionRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) ModifySubscriptionRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -253,8 +253,8 @@ func (b *_ModifySubscriptionRequest) CreateModifySubscriptionRequestBuilder() Mo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModifySubscriptionRequest) GetIdentifier() string { - return "793" +func (m *_ModifySubscriptionRequest) GetExtensionId() int32 { + return int32(793) } /////////////////////// @@ -271,7 +271,7 @@ func (m *_ModifySubscriptionRequest) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ModifySubscriptionRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_ModifySubscriptionRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -350,7 +350,7 @@ func (m *_ModifySubscriptionRequest) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_ModifySubscriptionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modifySubscriptionRequest ModifySubscriptionRequest, err error) { +func (m *_ModifySubscriptionRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modifySubscriptionRequest ModifySubscriptionRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -361,7 +361,7 @@ func (m *_ModifySubscriptionRequest) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -428,7 +428,7 @@ func (m *_ModifySubscriptionRequest) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for ModifySubscriptionRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -476,7 +476,7 @@ func (m *_ModifySubscriptionRequest) deepCopy() *_ModifySubscriptionRequest { } _ModifySubscriptionRequestCopy := &_ModifySubscriptionRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.RequestedPublishingInterval, m.RequestedLifetimeCount, diff --git a/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionResponse.go b/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionResponse.go index 68ba3caa3fc..6faf97db0d5 100644 --- a/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/ModifySubscriptionResponse.go @@ -41,7 +41,7 @@ type ModifySubscriptionResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetRevisedPublishingInterval returns RevisedPublishingInterval (property field) GetRevisedPublishingInterval() float64 // GetRevisedLifetimeCount returns RevisedLifetimeCount (property field) @@ -57,7 +57,7 @@ type ModifySubscriptionResponse interface { // _ModifySubscriptionResponse is the data-structure of this message type _ModifySubscriptionResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader RevisedPublishingInterval float64 RevisedLifetimeCount uint32 RevisedMaxKeepAliveCount uint32 @@ -67,9 +67,9 @@ var _ ModifySubscriptionResponse = (*_ModifySubscriptionResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ModifySubscriptionResponse)(nil) // NewModifySubscriptionResponse factory function for _ModifySubscriptionResponse -func NewModifySubscriptionResponse(responseHeader ExtensionObjectDefinition, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) *_ModifySubscriptionResponse { +func NewModifySubscriptionResponse(responseHeader ResponseHeader, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) *_ModifySubscriptionResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for ModifySubscriptionResponse must not be nil") + panic("responseHeader of type ResponseHeader for ModifySubscriptionResponse must not be nil") } _result := &_ModifySubscriptionResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -91,11 +91,11 @@ func NewModifySubscriptionResponse(responseHeader ExtensionObjectDefinition, rev type ModifySubscriptionResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) ModifySubscriptionResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) ModifySubscriptionResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) ModifySubscriptionResponseBuilder + WithResponseHeader(ResponseHeader) ModifySubscriptionResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifySubscriptionResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) ModifySubscriptionResponseBuilder // WithRevisedPublishingInterval adds RevisedPublishingInterval (property field) WithRevisedPublishingInterval(float64) ModifySubscriptionResponseBuilder // WithRevisedLifetimeCount adds RevisedLifetimeCount (property field) @@ -127,24 +127,24 @@ func (b *_ModifySubscriptionResponseBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_ModifySubscriptionResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) ModifySubscriptionResponseBuilder { +func (b *_ModifySubscriptionResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, revisedPublishingInterval float64, revisedLifetimeCount uint32, revisedMaxKeepAliveCount uint32) ModifySubscriptionResponseBuilder { return b.WithResponseHeader(responseHeader).WithRevisedPublishingInterval(revisedPublishingInterval).WithRevisedLifetimeCount(revisedLifetimeCount).WithRevisedMaxKeepAliveCount(revisedMaxKeepAliveCount) } -func (b *_ModifySubscriptionResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) ModifySubscriptionResponseBuilder { +func (b *_ModifySubscriptionResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) ModifySubscriptionResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_ModifySubscriptionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ModifySubscriptionResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ModifySubscriptionResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) ModifySubscriptionResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -220,8 +220,8 @@ func (b *_ModifySubscriptionResponse) CreateModifySubscriptionResponseBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ModifySubscriptionResponse) GetIdentifier() string { - return "796" +func (m *_ModifySubscriptionResponse) GetExtensionId() int32 { + return int32(796) } /////////////////////// @@ -238,7 +238,7 @@ func (m *_ModifySubscriptionResponse) GetParent() ExtensionObjectDefinitionContr /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ModifySubscriptionResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_ModifySubscriptionResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -296,7 +296,7 @@ func (m *_ModifySubscriptionResponse) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_ModifySubscriptionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__modifySubscriptionResponse ModifySubscriptionResponse, err error) { +func (m *_ModifySubscriptionResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__modifySubscriptionResponse ModifySubscriptionResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -307,7 +307,7 @@ func (m *_ModifySubscriptionResponse) parse(ctx context.Context, readBuffer util currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -356,7 +356,7 @@ func (m *_ModifySubscriptionResponse) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(pushErr, "Error pushing for ModifySubscriptionResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -392,7 +392,7 @@ func (m *_ModifySubscriptionResponse) deepCopy() *_ModifySubscriptionResponse { } _ModifySubscriptionResponseCopy := &_ModifySubscriptionResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.RevisedPublishingInterval, m.RevisedLifetimeCount, m.RevisedMaxKeepAliveCount, diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateRequest.go b/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateRequest.go index 472439f16f3..85280d12327 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateRequest.go @@ -41,11 +41,11 @@ type MonitoredItemCreateRequest interface { utils.Copyable ExtensionObjectDefinition // GetItemToMonitor returns ItemToMonitor (property field) - GetItemToMonitor() ExtensionObjectDefinition + GetItemToMonitor() ReadValueId // GetMonitoringMode returns MonitoringMode (property field) GetMonitoringMode() MonitoringMode // GetRequestedParameters returns RequestedParameters (property field) - GetRequestedParameters() ExtensionObjectDefinition + GetRequestedParameters() MonitoringParameters // IsMonitoredItemCreateRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsMonitoredItemCreateRequest() // CreateBuilder creates a MonitoredItemCreateRequestBuilder @@ -55,21 +55,21 @@ type MonitoredItemCreateRequest interface { // _MonitoredItemCreateRequest is the data-structure of this message type _MonitoredItemCreateRequest struct { ExtensionObjectDefinitionContract - ItemToMonitor ExtensionObjectDefinition + ItemToMonitor ReadValueId MonitoringMode MonitoringMode - RequestedParameters ExtensionObjectDefinition + RequestedParameters MonitoringParameters } var _ MonitoredItemCreateRequest = (*_MonitoredItemCreateRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_MonitoredItemCreateRequest)(nil) // NewMonitoredItemCreateRequest factory function for _MonitoredItemCreateRequest -func NewMonitoredItemCreateRequest(itemToMonitor ExtensionObjectDefinition, monitoringMode MonitoringMode, requestedParameters ExtensionObjectDefinition) *_MonitoredItemCreateRequest { +func NewMonitoredItemCreateRequest(itemToMonitor ReadValueId, monitoringMode MonitoringMode, requestedParameters MonitoringParameters) *_MonitoredItemCreateRequest { if itemToMonitor == nil { - panic("itemToMonitor of type ExtensionObjectDefinition for MonitoredItemCreateRequest must not be nil") + panic("itemToMonitor of type ReadValueId for MonitoredItemCreateRequest must not be nil") } if requestedParameters == nil { - panic("requestedParameters of type ExtensionObjectDefinition for MonitoredItemCreateRequest must not be nil") + panic("requestedParameters of type MonitoringParameters for MonitoredItemCreateRequest must not be nil") } _result := &_MonitoredItemCreateRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -90,17 +90,17 @@ func NewMonitoredItemCreateRequest(itemToMonitor ExtensionObjectDefinition, moni type MonitoredItemCreateRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(itemToMonitor ExtensionObjectDefinition, monitoringMode MonitoringMode, requestedParameters ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder + WithMandatoryFields(itemToMonitor ReadValueId, monitoringMode MonitoringMode, requestedParameters MonitoringParameters) MonitoredItemCreateRequestBuilder // WithItemToMonitor adds ItemToMonitor (property field) - WithItemToMonitor(ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder + WithItemToMonitor(ReadValueId) MonitoredItemCreateRequestBuilder // WithItemToMonitorBuilder adds ItemToMonitor (property field) which is build by the builder - WithItemToMonitorBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemCreateRequestBuilder + WithItemToMonitorBuilder(func(ReadValueIdBuilder) ReadValueIdBuilder) MonitoredItemCreateRequestBuilder // WithMonitoringMode adds MonitoringMode (property field) WithMonitoringMode(MonitoringMode) MonitoredItemCreateRequestBuilder // WithRequestedParameters adds RequestedParameters (property field) - WithRequestedParameters(ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder + WithRequestedParameters(MonitoringParameters) MonitoredItemCreateRequestBuilder // WithRequestedParametersBuilder adds RequestedParameters (property field) which is build by the builder - WithRequestedParametersBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemCreateRequestBuilder + WithRequestedParametersBuilder(func(MonitoringParametersBuilder) MonitoringParametersBuilder) MonitoredItemCreateRequestBuilder // Build builds the MonitoredItemCreateRequest or returns an error if something is wrong Build() (MonitoredItemCreateRequest, error) // MustBuild does the same as Build but panics on error @@ -126,24 +126,24 @@ func (b *_MonitoredItemCreateRequestBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_MonitoredItemCreateRequestBuilder) WithMandatoryFields(itemToMonitor ExtensionObjectDefinition, monitoringMode MonitoringMode, requestedParameters ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder { +func (b *_MonitoredItemCreateRequestBuilder) WithMandatoryFields(itemToMonitor ReadValueId, monitoringMode MonitoringMode, requestedParameters MonitoringParameters) MonitoredItemCreateRequestBuilder { return b.WithItemToMonitor(itemToMonitor).WithMonitoringMode(monitoringMode).WithRequestedParameters(requestedParameters) } -func (b *_MonitoredItemCreateRequestBuilder) WithItemToMonitor(itemToMonitor ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder { +func (b *_MonitoredItemCreateRequestBuilder) WithItemToMonitor(itemToMonitor ReadValueId) MonitoredItemCreateRequestBuilder { b.ItemToMonitor = itemToMonitor return b } -func (b *_MonitoredItemCreateRequestBuilder) WithItemToMonitorBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemCreateRequestBuilder { - builder := builderSupplier(b.ItemToMonitor.CreateExtensionObjectDefinitionBuilder()) +func (b *_MonitoredItemCreateRequestBuilder) WithItemToMonitorBuilder(builderSupplier func(ReadValueIdBuilder) ReadValueIdBuilder) MonitoredItemCreateRequestBuilder { + builder := builderSupplier(b.ItemToMonitor.CreateReadValueIdBuilder()) var err error b.ItemToMonitor, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ReadValueIdBuilder failed")) } return b } @@ -153,20 +153,20 @@ func (b *_MonitoredItemCreateRequestBuilder) WithMonitoringMode(monitoringMode M return b } -func (b *_MonitoredItemCreateRequestBuilder) WithRequestedParameters(requestedParameters ExtensionObjectDefinition) MonitoredItemCreateRequestBuilder { +func (b *_MonitoredItemCreateRequestBuilder) WithRequestedParameters(requestedParameters MonitoringParameters) MonitoredItemCreateRequestBuilder { b.RequestedParameters = requestedParameters return b } -func (b *_MonitoredItemCreateRequestBuilder) WithRequestedParametersBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemCreateRequestBuilder { - builder := builderSupplier(b.RequestedParameters.CreateExtensionObjectDefinitionBuilder()) +func (b *_MonitoredItemCreateRequestBuilder) WithRequestedParametersBuilder(builderSupplier func(MonitoringParametersBuilder) MonitoringParametersBuilder) MonitoredItemCreateRequestBuilder { + builder := builderSupplier(b.RequestedParameters.CreateMonitoringParametersBuilder()) var err error b.RequestedParameters, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "MonitoringParametersBuilder failed")) } return b } @@ -233,8 +233,8 @@ func (b *_MonitoredItemCreateRequest) CreateMonitoredItemCreateRequestBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoredItemCreateRequest) GetIdentifier() string { - return "745" +func (m *_MonitoredItemCreateRequest) GetExtensionId() int32 { + return int32(745) } /////////////////////// @@ -251,7 +251,7 @@ func (m *_MonitoredItemCreateRequest) GetParent() ExtensionObjectDefinitionContr /////////////////////// Accessors for property fields. /////////////////////// -func (m *_MonitoredItemCreateRequest) GetItemToMonitor() ExtensionObjectDefinition { +func (m *_MonitoredItemCreateRequest) GetItemToMonitor() ReadValueId { return m.ItemToMonitor } @@ -259,7 +259,7 @@ func (m *_MonitoredItemCreateRequest) GetMonitoringMode() MonitoringMode { return m.MonitoringMode } -func (m *_MonitoredItemCreateRequest) GetRequestedParameters() ExtensionObjectDefinition { +func (m *_MonitoredItemCreateRequest) GetRequestedParameters() MonitoringParameters { return m.RequestedParameters } @@ -302,7 +302,7 @@ func (m *_MonitoredItemCreateRequest) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoredItemCreateRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoredItemCreateRequest MonitoredItemCreateRequest, err error) { +func (m *_MonitoredItemCreateRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoredItemCreateRequest MonitoredItemCreateRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -313,7 +313,7 @@ func (m *_MonitoredItemCreateRequest) parse(ctx context.Context, readBuffer util currentPos := positionAware.GetPos() _ = currentPos - itemToMonitor, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "itemToMonitor", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("628")), readBuffer)) + itemToMonitor, err := ReadSimpleField[ReadValueId](ctx, "itemToMonitor", ReadComplex[ReadValueId](ExtensionObjectDefinitionParseWithBufferProducer[ReadValueId]((int32)(int32(628))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'itemToMonitor' field")) } @@ -325,7 +325,7 @@ func (m *_MonitoredItemCreateRequest) parse(ctx context.Context, readBuffer util } m.MonitoringMode = monitoringMode - requestedParameters, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestedParameters", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("742")), readBuffer)) + requestedParameters, err := ReadSimpleField[MonitoringParameters](ctx, "requestedParameters", ReadComplex[MonitoringParameters](ExtensionObjectDefinitionParseWithBufferProducer[MonitoringParameters]((int32)(int32(742))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestedParameters' field")) } @@ -356,7 +356,7 @@ func (m *_MonitoredItemCreateRequest) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(pushErr, "Error pushing for MonitoredItemCreateRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "itemToMonitor", m.GetItemToMonitor(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ReadValueId](ctx, "itemToMonitor", m.GetItemToMonitor(), WriteComplex[ReadValueId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'itemToMonitor' field") } @@ -364,7 +364,7 @@ func (m *_MonitoredItemCreateRequest) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(err, "Error serializing 'monitoringMode' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestedParameters", m.GetRequestedParameters(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[MonitoringParameters](ctx, "requestedParameters", m.GetRequestedParameters(), WriteComplex[MonitoringParameters](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestedParameters' field") } @@ -388,9 +388,9 @@ func (m *_MonitoredItemCreateRequest) deepCopy() *_MonitoredItemCreateRequest { } _MonitoredItemCreateRequestCopy := &_MonitoredItemCreateRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ItemToMonitor.DeepCopy().(ExtensionObjectDefinition), + m.ItemToMonitor.DeepCopy().(ReadValueId), m.MonitoringMode, - m.RequestedParameters.DeepCopy().(ExtensionObjectDefinition), + m.RequestedParameters.DeepCopy().(MonitoringParameters), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _MonitoredItemCreateRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateResult.go b/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateResult.go index 7d40ec17070..cd8084e766b 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateResult.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoredItemCreateResult.go @@ -255,8 +255,8 @@ func (b *_MonitoredItemCreateResult) CreateMonitoredItemCreateResultBuilder() Mo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoredItemCreateResult) GetIdentifier() string { - return "748" +func (m *_MonitoredItemCreateResult) GetExtensionId() int32 { + return int32(748) } /////////////////////// @@ -338,7 +338,7 @@ func (m *_MonitoredItemCreateResult) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoredItemCreateResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoredItemCreateResult MonitoredItemCreateResult, err error) { +func (m *_MonitoredItemCreateResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoredItemCreateResult MonitoredItemCreateResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -373,7 +373,7 @@ func (m *_MonitoredItemCreateResult) parse(ctx context.Context, readBuffer utils } m.RevisedQueueSize = revisedQueueSize - filterResult, err := ReadSimpleField[ExtensionObject](ctx, "filterResult", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + filterResult, err := ReadSimpleField[ExtensionObject](ctx, "filterResult", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filterResult' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyRequest.go b/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyRequest.go index 63fb7d89e17..8615151b440 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyRequest.go @@ -43,7 +43,7 @@ type MonitoredItemModifyRequest interface { // GetMonitoredItemId returns MonitoredItemId (property field) GetMonitoredItemId() uint32 // GetRequestedParameters returns RequestedParameters (property field) - GetRequestedParameters() ExtensionObjectDefinition + GetRequestedParameters() MonitoringParameters // IsMonitoredItemModifyRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsMonitoredItemModifyRequest() // CreateBuilder creates a MonitoredItemModifyRequestBuilder @@ -54,16 +54,16 @@ type MonitoredItemModifyRequest interface { type _MonitoredItemModifyRequest struct { ExtensionObjectDefinitionContract MonitoredItemId uint32 - RequestedParameters ExtensionObjectDefinition + RequestedParameters MonitoringParameters } var _ MonitoredItemModifyRequest = (*_MonitoredItemModifyRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_MonitoredItemModifyRequest)(nil) // NewMonitoredItemModifyRequest factory function for _MonitoredItemModifyRequest -func NewMonitoredItemModifyRequest(monitoredItemId uint32, requestedParameters ExtensionObjectDefinition) *_MonitoredItemModifyRequest { +func NewMonitoredItemModifyRequest(monitoredItemId uint32, requestedParameters MonitoringParameters) *_MonitoredItemModifyRequest { if requestedParameters == nil { - panic("requestedParameters of type ExtensionObjectDefinition for MonitoredItemModifyRequest must not be nil") + panic("requestedParameters of type MonitoringParameters for MonitoredItemModifyRequest must not be nil") } _result := &_MonitoredItemModifyRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -83,13 +83,13 @@ func NewMonitoredItemModifyRequest(monitoredItemId uint32, requestedParameters E type MonitoredItemModifyRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(monitoredItemId uint32, requestedParameters ExtensionObjectDefinition) MonitoredItemModifyRequestBuilder + WithMandatoryFields(monitoredItemId uint32, requestedParameters MonitoringParameters) MonitoredItemModifyRequestBuilder // WithMonitoredItemId adds MonitoredItemId (property field) WithMonitoredItemId(uint32) MonitoredItemModifyRequestBuilder // WithRequestedParameters adds RequestedParameters (property field) - WithRequestedParameters(ExtensionObjectDefinition) MonitoredItemModifyRequestBuilder + WithRequestedParameters(MonitoringParameters) MonitoredItemModifyRequestBuilder // WithRequestedParametersBuilder adds RequestedParameters (property field) which is build by the builder - WithRequestedParametersBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemModifyRequestBuilder + WithRequestedParametersBuilder(func(MonitoringParametersBuilder) MonitoringParametersBuilder) MonitoredItemModifyRequestBuilder // Build builds the MonitoredItemModifyRequest or returns an error if something is wrong Build() (MonitoredItemModifyRequest, error) // MustBuild does the same as Build but panics on error @@ -115,7 +115,7 @@ func (b *_MonitoredItemModifyRequestBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_MonitoredItemModifyRequestBuilder) WithMandatoryFields(monitoredItemId uint32, requestedParameters ExtensionObjectDefinition) MonitoredItemModifyRequestBuilder { +func (b *_MonitoredItemModifyRequestBuilder) WithMandatoryFields(monitoredItemId uint32, requestedParameters MonitoringParameters) MonitoredItemModifyRequestBuilder { return b.WithMonitoredItemId(monitoredItemId).WithRequestedParameters(requestedParameters) } @@ -124,20 +124,20 @@ func (b *_MonitoredItemModifyRequestBuilder) WithMonitoredItemId(monitoredItemId return b } -func (b *_MonitoredItemModifyRequestBuilder) WithRequestedParameters(requestedParameters ExtensionObjectDefinition) MonitoredItemModifyRequestBuilder { +func (b *_MonitoredItemModifyRequestBuilder) WithRequestedParameters(requestedParameters MonitoringParameters) MonitoredItemModifyRequestBuilder { b.RequestedParameters = requestedParameters return b } -func (b *_MonitoredItemModifyRequestBuilder) WithRequestedParametersBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) MonitoredItemModifyRequestBuilder { - builder := builderSupplier(b.RequestedParameters.CreateExtensionObjectDefinitionBuilder()) +func (b *_MonitoredItemModifyRequestBuilder) WithRequestedParametersBuilder(builderSupplier func(MonitoringParametersBuilder) MonitoringParametersBuilder) MonitoredItemModifyRequestBuilder { + builder := builderSupplier(b.RequestedParameters.CreateMonitoringParametersBuilder()) var err error b.RequestedParameters, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "MonitoringParametersBuilder failed")) } return b } @@ -198,8 +198,8 @@ func (b *_MonitoredItemModifyRequest) CreateMonitoredItemModifyRequestBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoredItemModifyRequest) GetIdentifier() string { - return "757" +func (m *_MonitoredItemModifyRequest) GetExtensionId() int32 { + return int32(757) } /////////////////////// @@ -220,7 +220,7 @@ func (m *_MonitoredItemModifyRequest) GetMonitoredItemId() uint32 { return m.MonitoredItemId } -func (m *_MonitoredItemModifyRequest) GetRequestedParameters() ExtensionObjectDefinition { +func (m *_MonitoredItemModifyRequest) GetRequestedParameters() MonitoringParameters { return m.RequestedParameters } @@ -260,7 +260,7 @@ func (m *_MonitoredItemModifyRequest) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoredItemModifyRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoredItemModifyRequest MonitoredItemModifyRequest, err error) { +func (m *_MonitoredItemModifyRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoredItemModifyRequest MonitoredItemModifyRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -277,7 +277,7 @@ func (m *_MonitoredItemModifyRequest) parse(ctx context.Context, readBuffer util } m.MonitoredItemId = monitoredItemId - requestedParameters, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestedParameters", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("742")), readBuffer)) + requestedParameters, err := ReadSimpleField[MonitoringParameters](ctx, "requestedParameters", ReadComplex[MonitoringParameters](ExtensionObjectDefinitionParseWithBufferProducer[MonitoringParameters]((int32)(int32(742))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestedParameters' field")) } @@ -312,7 +312,7 @@ func (m *_MonitoredItemModifyRequest) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(err, "Error serializing 'monitoredItemId' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestedParameters", m.GetRequestedParameters(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[MonitoringParameters](ctx, "requestedParameters", m.GetRequestedParameters(), WriteComplex[MonitoringParameters](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestedParameters' field") } @@ -337,7 +337,7 @@ func (m *_MonitoredItemModifyRequest) deepCopy() *_MonitoredItemModifyRequest { _MonitoredItemModifyRequestCopy := &_MonitoredItemModifyRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.MonitoredItemId, - m.RequestedParameters.DeepCopy().(ExtensionObjectDefinition), + m.RequestedParameters.DeepCopy().(MonitoringParameters), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _MonitoredItemModifyRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyResult.go b/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyResult.go index 8412d021091..771867254e7 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyResult.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoredItemModifyResult.go @@ -244,8 +244,8 @@ func (b *_MonitoredItemModifyResult) CreateMonitoredItemModifyResultBuilder() Mo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoredItemModifyResult) GetIdentifier() string { - return "760" +func (m *_MonitoredItemModifyResult) GetExtensionId() int32 { + return int32(760) } /////////////////////// @@ -320,7 +320,7 @@ func (m *_MonitoredItemModifyResult) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoredItemModifyResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoredItemModifyResult MonitoredItemModifyResult, err error) { +func (m *_MonitoredItemModifyResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoredItemModifyResult MonitoredItemModifyResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -349,7 +349,7 @@ func (m *_MonitoredItemModifyResult) parse(ctx context.Context, readBuffer utils } m.RevisedQueueSize = revisedQueueSize - filterResult, err := ReadSimpleField[ExtensionObject](ctx, "filterResult", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + filterResult, err := ReadSimpleField[ExtensionObject](ctx, "filterResult", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filterResult' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoredItemNotification.go b/plc4go/protocols/opcua/readwrite/model/MonitoredItemNotification.go index a85a8a16e85..0a462a12896 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoredItemNotification.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoredItemNotification.go @@ -198,8 +198,8 @@ func (b *_MonitoredItemNotification) CreateMonitoredItemNotificationBuilder() Mo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoredItemNotification) GetIdentifier() string { - return "808" +func (m *_MonitoredItemNotification) GetExtensionId() int32 { + return int32(808) } /////////////////////// @@ -260,7 +260,7 @@ func (m *_MonitoredItemNotification) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoredItemNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoredItemNotification MonitoredItemNotification, err error) { +func (m *_MonitoredItemNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoredItemNotification MonitoredItemNotification, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoringFilter.go b/plc4go/protocols/opcua/readwrite/model/MonitoringFilter.go index 092e6bfcda2..abdccaf3560 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoringFilter.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoringFilter.go @@ -150,8 +150,8 @@ func (b *_MonitoringFilter) CreateMonitoringFilterBuilder() MonitoringFilterBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoringFilter) GetIdentifier() string { - return "721" +func (m *_MonitoringFilter) GetExtensionId() int32 { + return int32(721) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_MonitoringFilter) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoringFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoringFilter MonitoringFilter, err error) { +func (m *_MonitoringFilter) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoringFilter MonitoringFilter, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoringFilterResult.go b/plc4go/protocols/opcua/readwrite/model/MonitoringFilterResult.go index d7450d48e17..fa3a943fafd 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoringFilterResult.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoringFilterResult.go @@ -150,8 +150,8 @@ func (b *_MonitoringFilterResult) CreateMonitoringFilterResultBuilder() Monitori /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoringFilterResult) GetIdentifier() string { - return "733" +func (m *_MonitoringFilterResult) GetExtensionId() int32 { + return int32(733) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_MonitoringFilterResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoringFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoringFilterResult MonitoringFilterResult, err error) { +func (m *_MonitoringFilterResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoringFilterResult MonitoringFilterResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/MonitoringParameters.go b/plc4go/protocols/opcua/readwrite/model/MonitoringParameters.go index 53b0c0c6d10..2b4c48ee4a8 100644 --- a/plc4go/protocols/opcua/readwrite/model/MonitoringParameters.go +++ b/plc4go/protocols/opcua/readwrite/model/MonitoringParameters.go @@ -233,8 +233,8 @@ func (b *_MonitoringParameters) CreateMonitoringParametersBuilder() MonitoringPa /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_MonitoringParameters) GetIdentifier() string { - return "742" +func (m *_MonitoringParameters) GetExtensionId() int32 { + return int32(742) } /////////////////////// @@ -319,7 +319,7 @@ func (m *_MonitoringParameters) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_MonitoringParameters) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__monitoringParameters MonitoringParameters, err error) { +func (m *_MonitoringParameters) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__monitoringParameters MonitoringParameters, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -342,7 +342,7 @@ func (m *_MonitoringParameters) parse(ctx context.Context, readBuffer utils.Read } m.SamplingInterval = samplingInterval - filter, err := ReadSimpleField[ExtensionObject](ctx, "filter", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + filter, err := ReadSimpleField[ExtensionObject](ctx, "filter", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/NetworkAddressDataType.go b/plc4go/protocols/opcua/readwrite/model/NetworkAddressDataType.go index 1d9651cb273..ef4414614ff 100644 --- a/plc4go/protocols/opcua/readwrite/model/NetworkAddressDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/NetworkAddressDataType.go @@ -187,8 +187,8 @@ func (b *_NetworkAddressDataType) CreateNetworkAddressDataTypeBuilder() NetworkA /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NetworkAddressDataType) GetIdentifier() string { - return "15504" +func (m *_NetworkAddressDataType) GetExtensionId() int32 { + return int32(15504) } /////////////////////// @@ -242,7 +242,7 @@ func (m *_NetworkAddressDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NetworkAddressDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__networkAddressDataType NetworkAddressDataType, err error) { +func (m *_NetworkAddressDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__networkAddressDataType NetworkAddressDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/NetworkAddressUrlDataType.go b/plc4go/protocols/opcua/readwrite/model/NetworkAddressUrlDataType.go new file mode 100644 index 00000000000..65e36aceb57 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/NetworkAddressUrlDataType.go @@ -0,0 +1,383 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NetworkAddressUrlDataType is the corresponding interface of NetworkAddressUrlDataType +type NetworkAddressUrlDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNetworkInterface returns NetworkInterface (property field) + GetNetworkInterface() PascalString + // GetUrl returns Url (property field) + GetUrl() PascalString + // IsNetworkAddressUrlDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsNetworkAddressUrlDataType() + // CreateBuilder creates a NetworkAddressUrlDataTypeBuilder + CreateNetworkAddressUrlDataTypeBuilder() NetworkAddressUrlDataTypeBuilder +} + +// _NetworkAddressUrlDataType is the data-structure of this message +type _NetworkAddressUrlDataType struct { + ExtensionObjectDefinitionContract + NetworkInterface PascalString + Url PascalString +} + +var _ NetworkAddressUrlDataType = (*_NetworkAddressUrlDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_NetworkAddressUrlDataType)(nil) + +// NewNetworkAddressUrlDataType factory function for _NetworkAddressUrlDataType +func NewNetworkAddressUrlDataType(networkInterface PascalString, url PascalString) *_NetworkAddressUrlDataType { + if networkInterface == nil { + panic("networkInterface of type PascalString for NetworkAddressUrlDataType must not be nil") + } + if url == nil { + panic("url of type PascalString for NetworkAddressUrlDataType must not be nil") + } + _result := &_NetworkAddressUrlDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NetworkInterface: networkInterface, + Url: url, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// NetworkAddressUrlDataTypeBuilder is a builder for NetworkAddressUrlDataType +type NetworkAddressUrlDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(networkInterface PascalString, url PascalString) NetworkAddressUrlDataTypeBuilder + // WithNetworkInterface adds NetworkInterface (property field) + WithNetworkInterface(PascalString) NetworkAddressUrlDataTypeBuilder + // WithNetworkInterfaceBuilder adds NetworkInterface (property field) which is build by the builder + WithNetworkInterfaceBuilder(func(PascalStringBuilder) PascalStringBuilder) NetworkAddressUrlDataTypeBuilder + // WithUrl adds Url (property field) + WithUrl(PascalString) NetworkAddressUrlDataTypeBuilder + // WithUrlBuilder adds Url (property field) which is build by the builder + WithUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) NetworkAddressUrlDataTypeBuilder + // Build builds the NetworkAddressUrlDataType or returns an error if something is wrong + Build() (NetworkAddressUrlDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() NetworkAddressUrlDataType +} + +// NewNetworkAddressUrlDataTypeBuilder() creates a NetworkAddressUrlDataTypeBuilder +func NewNetworkAddressUrlDataTypeBuilder() NetworkAddressUrlDataTypeBuilder { + return &_NetworkAddressUrlDataTypeBuilder{_NetworkAddressUrlDataType: new(_NetworkAddressUrlDataType)} +} + +type _NetworkAddressUrlDataTypeBuilder struct { + *_NetworkAddressUrlDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (NetworkAddressUrlDataTypeBuilder) = (*_NetworkAddressUrlDataTypeBuilder)(nil) + +func (b *_NetworkAddressUrlDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_NetworkAddressUrlDataTypeBuilder) WithMandatoryFields(networkInterface PascalString, url PascalString) NetworkAddressUrlDataTypeBuilder { + return b.WithNetworkInterface(networkInterface).WithUrl(url) +} + +func (b *_NetworkAddressUrlDataTypeBuilder) WithNetworkInterface(networkInterface PascalString) NetworkAddressUrlDataTypeBuilder { + b.NetworkInterface = networkInterface + return b +} + +func (b *_NetworkAddressUrlDataTypeBuilder) WithNetworkInterfaceBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) NetworkAddressUrlDataTypeBuilder { + builder := builderSupplier(b.NetworkInterface.CreatePascalStringBuilder()) + var err error + b.NetworkInterface, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_NetworkAddressUrlDataTypeBuilder) WithUrl(url PascalString) NetworkAddressUrlDataTypeBuilder { + b.Url = url + return b +} + +func (b *_NetworkAddressUrlDataTypeBuilder) WithUrlBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) NetworkAddressUrlDataTypeBuilder { + builder := builderSupplier(b.Url.CreatePascalStringBuilder()) + var err error + b.Url, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_NetworkAddressUrlDataTypeBuilder) Build() (NetworkAddressUrlDataType, error) { + if b.NetworkInterface == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'networkInterface' not set")) + } + if b.Url == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'url' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._NetworkAddressUrlDataType.deepCopy(), nil +} + +func (b *_NetworkAddressUrlDataTypeBuilder) MustBuild() NetworkAddressUrlDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_NetworkAddressUrlDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_NetworkAddressUrlDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_NetworkAddressUrlDataTypeBuilder) DeepCopy() any { + _copy := b.CreateNetworkAddressUrlDataTypeBuilder().(*_NetworkAddressUrlDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateNetworkAddressUrlDataTypeBuilder creates a NetworkAddressUrlDataTypeBuilder +func (b *_NetworkAddressUrlDataType) CreateNetworkAddressUrlDataTypeBuilder() NetworkAddressUrlDataTypeBuilder { + if b == nil { + return NewNetworkAddressUrlDataTypeBuilder() + } + return &_NetworkAddressUrlDataTypeBuilder{_NetworkAddressUrlDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NetworkAddressUrlDataType) GetExtensionId() int32 { + return int32(15512) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NetworkAddressUrlDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_NetworkAddressUrlDataType) GetNetworkInterface() PascalString { + return m.NetworkInterface +} + +func (m *_NetworkAddressUrlDataType) GetUrl() PascalString { + return m.Url +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastNetworkAddressUrlDataType(structType any) NetworkAddressUrlDataType { + if casted, ok := structType.(NetworkAddressUrlDataType); ok { + return casted + } + if casted, ok := structType.(*NetworkAddressUrlDataType); ok { + return *casted + } + return nil +} + +func (m *_NetworkAddressUrlDataType) GetTypeName() string { + return "NetworkAddressUrlDataType" +} + +func (m *_NetworkAddressUrlDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (networkInterface) + lengthInBits += m.NetworkInterface.GetLengthInBits(ctx) + + // Simple field (url) + lengthInBits += m.Url.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_NetworkAddressUrlDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_NetworkAddressUrlDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__networkAddressUrlDataType NetworkAddressUrlDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NetworkAddressUrlDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NetworkAddressUrlDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + networkInterface, err := ReadSimpleField[PascalString](ctx, "networkInterface", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkInterface' field")) + } + m.NetworkInterface = networkInterface + + url, err := ReadSimpleField[PascalString](ctx, "url", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'url' field")) + } + m.Url = url + + if closeErr := readBuffer.CloseContext("NetworkAddressUrlDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NetworkAddressUrlDataType") + } + + return m, nil +} + +func (m *_NetworkAddressUrlDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_NetworkAddressUrlDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("NetworkAddressUrlDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NetworkAddressUrlDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "networkInterface", m.GetNetworkInterface(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'networkInterface' field") + } + + if err := WriteSimpleField[PascalString](ctx, "url", m.GetUrl(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'url' field") + } + + if popErr := writeBuffer.PopContext("NetworkAddressUrlDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NetworkAddressUrlDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_NetworkAddressUrlDataType) IsNetworkAddressUrlDataType() {} + +func (m *_NetworkAddressUrlDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_NetworkAddressUrlDataType) deepCopy() *_NetworkAddressUrlDataType { + if m == nil { + return nil + } + _NetworkAddressUrlDataTypeCopy := &_NetworkAddressUrlDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NetworkInterface.DeepCopy().(PascalString), + m.Url.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _NetworkAddressUrlDataTypeCopy +} + +func (m *_NetworkAddressUrlDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/NetworkGroupDataType.go b/plc4go/protocols/opcua/readwrite/model/NetworkGroupDataType.go index 7732b4e9d7d..61804e829af 100644 --- a/plc4go/protocols/opcua/readwrite/model/NetworkGroupDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/NetworkGroupDataType.go @@ -42,10 +42,8 @@ type NetworkGroupDataType interface { ExtensionObjectDefinition // GetServerUri returns ServerUri (property field) GetServerUri() PascalString - // GetNoOfNetworkPaths returns NoOfNetworkPaths (property field) - GetNoOfNetworkPaths() int32 // GetNetworkPaths returns NetworkPaths (property field) - GetNetworkPaths() []ExtensionObjectDefinition + GetNetworkPaths() []EndpointUrlListDataType // IsNetworkGroupDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsNetworkGroupDataType() // CreateBuilder creates a NetworkGroupDataTypeBuilder @@ -55,23 +53,21 @@ type NetworkGroupDataType interface { // _NetworkGroupDataType is the data-structure of this message type _NetworkGroupDataType struct { ExtensionObjectDefinitionContract - ServerUri PascalString - NoOfNetworkPaths int32 - NetworkPaths []ExtensionObjectDefinition + ServerUri PascalString + NetworkPaths []EndpointUrlListDataType } var _ NetworkGroupDataType = (*_NetworkGroupDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_NetworkGroupDataType)(nil) // NewNetworkGroupDataType factory function for _NetworkGroupDataType -func NewNetworkGroupDataType(serverUri PascalString, noOfNetworkPaths int32, networkPaths []ExtensionObjectDefinition) *_NetworkGroupDataType { +func NewNetworkGroupDataType(serverUri PascalString, networkPaths []EndpointUrlListDataType) *_NetworkGroupDataType { if serverUri == nil { panic("serverUri of type PascalString for NetworkGroupDataType must not be nil") } _result := &_NetworkGroupDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ServerUri: serverUri, - NoOfNetworkPaths: noOfNetworkPaths, NetworkPaths: networkPaths, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewNetworkGroupDataType(serverUri PascalString, noOfNetworkPaths int32, net type NetworkGroupDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(serverUri PascalString, noOfNetworkPaths int32, networkPaths []ExtensionObjectDefinition) NetworkGroupDataTypeBuilder + WithMandatoryFields(serverUri PascalString, networkPaths []EndpointUrlListDataType) NetworkGroupDataTypeBuilder // WithServerUri adds ServerUri (property field) WithServerUri(PascalString) NetworkGroupDataTypeBuilder // WithServerUriBuilder adds ServerUri (property field) which is build by the builder WithServerUriBuilder(func(PascalStringBuilder) PascalStringBuilder) NetworkGroupDataTypeBuilder - // WithNoOfNetworkPaths adds NoOfNetworkPaths (property field) - WithNoOfNetworkPaths(int32) NetworkGroupDataTypeBuilder // WithNetworkPaths adds NetworkPaths (property field) - WithNetworkPaths(...ExtensionObjectDefinition) NetworkGroupDataTypeBuilder + WithNetworkPaths(...EndpointUrlListDataType) NetworkGroupDataTypeBuilder // Build builds the NetworkGroupDataType or returns an error if something is wrong Build() (NetworkGroupDataType, error) // MustBuild does the same as Build but panics on error @@ -121,8 +115,8 @@ func (b *_NetworkGroupDataTypeBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_NetworkGroupDataTypeBuilder) WithMandatoryFields(serverUri PascalString, noOfNetworkPaths int32, networkPaths []ExtensionObjectDefinition) NetworkGroupDataTypeBuilder { - return b.WithServerUri(serverUri).WithNoOfNetworkPaths(noOfNetworkPaths).WithNetworkPaths(networkPaths...) +func (b *_NetworkGroupDataTypeBuilder) WithMandatoryFields(serverUri PascalString, networkPaths []EndpointUrlListDataType) NetworkGroupDataTypeBuilder { + return b.WithServerUri(serverUri).WithNetworkPaths(networkPaths...) } func (b *_NetworkGroupDataTypeBuilder) WithServerUri(serverUri PascalString) NetworkGroupDataTypeBuilder { @@ -143,12 +137,7 @@ func (b *_NetworkGroupDataTypeBuilder) WithServerUriBuilder(builderSupplier func return b } -func (b *_NetworkGroupDataTypeBuilder) WithNoOfNetworkPaths(noOfNetworkPaths int32) NetworkGroupDataTypeBuilder { - b.NoOfNetworkPaths = noOfNetworkPaths - return b -} - -func (b *_NetworkGroupDataTypeBuilder) WithNetworkPaths(networkPaths ...ExtensionObjectDefinition) NetworkGroupDataTypeBuilder { +func (b *_NetworkGroupDataTypeBuilder) WithNetworkPaths(networkPaths ...EndpointUrlListDataType) NetworkGroupDataTypeBuilder { b.NetworkPaths = networkPaths return b } @@ -209,8 +198,8 @@ func (b *_NetworkGroupDataType) CreateNetworkGroupDataTypeBuilder() NetworkGroup /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NetworkGroupDataType) GetIdentifier() string { - return "11946" +func (m *_NetworkGroupDataType) GetExtensionId() int32 { + return int32(11946) } /////////////////////// @@ -231,11 +220,7 @@ func (m *_NetworkGroupDataType) GetServerUri() PascalString { return m.ServerUri } -func (m *_NetworkGroupDataType) GetNoOfNetworkPaths() int32 { - return m.NoOfNetworkPaths -} - -func (m *_NetworkGroupDataType) GetNetworkPaths() []ExtensionObjectDefinition { +func (m *_NetworkGroupDataType) GetNetworkPaths() []EndpointUrlListDataType { return m.NetworkPaths } @@ -265,7 +250,7 @@ func (m *_NetworkGroupDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (serverUri) lengthInBits += m.ServerUri.GetLengthInBits(ctx) - // Simple field (noOfNetworkPaths) + // Implicit Field (noOfNetworkPaths) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_NetworkGroupDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NetworkGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__networkGroupDataType NetworkGroupDataType, err error) { +func (m *_NetworkGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__networkGroupDataType NetworkGroupDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -302,13 +287,13 @@ func (m *_NetworkGroupDataType) parse(ctx context.Context, readBuffer utils.Read } m.ServerUri = serverUri - noOfNetworkPaths, err := ReadSimpleField(ctx, "noOfNetworkPaths", ReadSignedInt(readBuffer, uint8(32))) + noOfNetworkPaths, err := ReadImplicitField[int32](ctx, "noOfNetworkPaths", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNetworkPaths' field")) } - m.NoOfNetworkPaths = noOfNetworkPaths + _ = noOfNetworkPaths - networkPaths, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "networkPaths", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("11945")), readBuffer), uint64(noOfNetworkPaths)) + networkPaths, err := ReadCountArrayField[EndpointUrlListDataType](ctx, "networkPaths", ReadComplex[EndpointUrlListDataType](ExtensionObjectDefinitionParseWithBufferProducer[EndpointUrlListDataType]((int32)(int32(11945))), readBuffer), uint64(noOfNetworkPaths)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkPaths' field")) } @@ -342,8 +327,8 @@ func (m *_NetworkGroupDataType) SerializeWithWriteBuffer(ctx context.Context, wr if err := WriteSimpleField[PascalString](ctx, "serverUri", m.GetServerUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'serverUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNetworkPaths", m.GetNoOfNetworkPaths(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNetworkPaths := int32(utils.InlineIf(bool((m.GetNetworkPaths()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNetworkPaths()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNetworkPaths", noOfNetworkPaths, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNetworkPaths' field") } @@ -372,8 +357,7 @@ func (m *_NetworkGroupDataType) deepCopy() *_NetworkGroupDataType { _NetworkGroupDataTypeCopy := &_NetworkGroupDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.ServerUri.DeepCopy().(PascalString), - m.NoOfNetworkPaths, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NetworkPaths), + utils.DeepCopySlice[EndpointUrlListDataType, EndpointUrlListDataType](m.NetworkPaths), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _NetworkGroupDataTypeCopy diff --git a/plc4go/protocols/opcua/readwrite/model/NodeAttributes.go b/plc4go/protocols/opcua/readwrite/model/NodeAttributes.go index 513a0dd30dd..a1ed52c8465 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeAttributes.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeAttributes.go @@ -255,8 +255,8 @@ func (b *_NodeAttributes) CreateNodeAttributesBuilder() NodeAttributesBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NodeAttributes) GetIdentifier() string { - return "351" +func (m *_NodeAttributes) GetExtensionId() int32 { + return int32(351) } /////////////////////// @@ -338,7 +338,7 @@ func (m *_NodeAttributes) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NodeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__nodeAttributes NodeAttributes, err error) { +func (m *_NodeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__nodeAttributes NodeAttributes, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/NodeId.go b/plc4go/protocols/opcua/readwrite/model/NodeId.go index 05c349a9b9d..8051cc2d4ee 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeId.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeId.go @@ -41,8 +41,6 @@ type NodeId interface { utils.Copyable // GetNodeId returns NodeId (property field) GetNodeId() NodeIdTypeDefinition - // GetId returns Id (virtual field) - GetId() string // IsNodeId is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeId() // CreateBuilder creates a NodeIdBuilder @@ -172,21 +170,6 @@ func (m *_NodeId) GetNodeId() NodeIdTypeDefinition { return m.NodeId } -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Accessors for virtual fields. -/////////////////////// - -func (m *_NodeId) GetId() string { - ctx := context.Background() - _ = ctx - return fmt.Sprintf("%v", m.GetNodeId().GetIdentifier()) -} - /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -216,8 +199,6 @@ func (m *_NodeId) GetLengthInBits(ctx context.Context) uint16 { // Simple field (nodeId) lengthInBits += m.NodeId.GetLengthInBits(ctx) - // A virtual field doesn't have any in- or output. - return lengthInBits } @@ -264,12 +245,6 @@ func (m *_NodeId) parse(ctx context.Context, readBuffer utils.ReadBuffer) (__nod } m.NodeId = nodeId - id, err := ReadVirtualField[string](ctx, "id", (*string)(nil), nodeId.GetIdentifier()) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'id' field")) - } - _ = id - if closeErr := readBuffer.CloseContext("NodeId"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeId") } @@ -301,12 +276,6 @@ func (m *_NodeId) SerializeWithWriteBuffer(ctx context.Context, writeBuffer util if err := WriteSimpleField[NodeIdTypeDefinition](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeIdTypeDefinition](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'nodeId' field") } - // Virtual field - id := m.GetId() - _ = id - if _idErr := writeBuffer.WriteVirtual(ctx, "id", m.GetId()); _idErr != nil { - return errors.Wrap(_idErr, "Error serializing 'id' field") - } if popErr := writeBuffer.PopContext("NodeId"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeId") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdByteString.go b/plc4go/protocols/opcua/readwrite/model/NodeIdByteString.go index be76da65fc5..9b357bd8ac8 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdByteString.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdByteString.go @@ -46,6 +46,8 @@ type NodeIdByteString interface { GetId() PascalByteString // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdByteString is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdByteString() // CreateBuilder creates a NodeIdByteStringBuilder @@ -241,6 +243,12 @@ func (m *_NodeIdByteString) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId().GetStringValue()) } +func (m *_NodeIdByteString) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(m.GetNamespaceIndex()) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -272,6 +280,8 @@ func (m *_NodeIdByteString) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -308,6 +318,12 @@ func (m *_NodeIdByteString) parse(ctx context.Context, readBuffer utils.ReadBuff } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), namespaceIndex) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdByteString"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdByteString") } @@ -346,6 +362,12 @@ func (m *_NodeIdByteString) SerializeWithWriteBuffer(ctx context.Context, writeB if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdByteString"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdByteString") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdFourByte.go b/plc4go/protocols/opcua/readwrite/model/NodeIdFourByte.go index e443294efd6..6eb0c5577ad 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdFourByte.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdFourByte.go @@ -46,6 +46,8 @@ type NodeIdFourByte interface { GetId() uint16 // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdFourByte is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdFourByte() // CreateBuilder creates a NodeIdFourByteBuilder @@ -217,6 +219,12 @@ func (m *_NodeIdFourByte) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId()) } +func (m *_NodeIdFourByte) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(m.GetNamespaceIndex()) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -248,6 +256,8 @@ func (m *_NodeIdFourByte) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -284,6 +294,12 @@ func (m *_NodeIdFourByte) parse(ctx context.Context, readBuffer utils.ReadBuffer } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), namespaceIndex) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdFourByte"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdFourByte") } @@ -322,6 +338,12 @@ func (m *_NodeIdFourByte) SerializeWithWriteBuffer(ctx context.Context, writeBuf if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdFourByte"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdFourByte") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdGuid.go b/plc4go/protocols/opcua/readwrite/model/NodeIdGuid.go index 205f92c2b78..a492350919a 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdGuid.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdGuid.go @@ -46,6 +46,8 @@ type NodeIdGuid interface { GetId() []byte // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdGuid is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdGuid() // CreateBuilder creates a NodeIdGuidBuilder @@ -217,6 +219,12 @@ func (m *_NodeIdGuid) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId()) } +func (m *_NodeIdGuid) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(m.GetNamespaceIndex()) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -250,6 +258,8 @@ func (m *_NodeIdGuid) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -286,6 +296,12 @@ func (m *_NodeIdGuid) parse(ctx context.Context, readBuffer utils.ReadBuffer, pa } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), namespaceIndex) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdGuid"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdGuid") } @@ -324,6 +340,12 @@ func (m *_NodeIdGuid) SerializeWithWriteBuffer(ctx context.Context, writeBuffer if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdGuid"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdGuid") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdNumeric.go b/plc4go/protocols/opcua/readwrite/model/NodeIdNumeric.go index 378c08f266c..c9131124cbd 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdNumeric.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdNumeric.go @@ -46,6 +46,8 @@ type NodeIdNumeric interface { GetId() uint32 // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdNumeric is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdNumeric() // CreateBuilder creates a NodeIdNumericBuilder @@ -217,6 +219,12 @@ func (m *_NodeIdNumeric) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId()) } +func (m *_NodeIdNumeric) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(m.GetNamespaceIndex()) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -248,6 +256,8 @@ func (m *_NodeIdNumeric) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -284,6 +294,12 @@ func (m *_NodeIdNumeric) parse(ctx context.Context, readBuffer utils.ReadBuffer, } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), namespaceIndex) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdNumeric"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdNumeric") } @@ -322,6 +338,12 @@ func (m *_NodeIdNumeric) SerializeWithWriteBuffer(ctx context.Context, writeBuff if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdNumeric"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdNumeric") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdString.go b/plc4go/protocols/opcua/readwrite/model/NodeIdString.go index 9ae59430cd5..611179a4b08 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdString.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdString.go @@ -46,6 +46,8 @@ type NodeIdString interface { GetId() PascalString // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdString is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdString() // CreateBuilder creates a NodeIdStringBuilder @@ -241,6 +243,12 @@ func (m *_NodeIdString) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId().GetStringValue()) } +func (m *_NodeIdString) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(m.GetNamespaceIndex()) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -272,6 +280,8 @@ func (m *_NodeIdString) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -308,6 +318,12 @@ func (m *_NodeIdString) parse(ctx context.Context, readBuffer utils.ReadBuffer, } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), namespaceIndex) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdString"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdString") } @@ -346,6 +362,12 @@ func (m *_NodeIdString) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdString"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdString") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdTwoByte.go b/plc4go/protocols/opcua/readwrite/model/NodeIdTwoByte.go index 1440acb1986..298a69a96d6 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdTwoByte.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdTwoByte.go @@ -44,6 +44,8 @@ type NodeIdTwoByte interface { GetId() uint8 // GetIdentifier returns Identifier (virtual field) GetIdentifier() string + // GetNamespace returns Namespace (virtual field) + GetNamespace() int16 // IsNodeIdTwoByte is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdTwoByte() // CreateBuilder creates a NodeIdTwoByteBuilder @@ -202,6 +204,12 @@ func (m *_NodeIdTwoByte) GetIdentifier() string { return fmt.Sprintf("%v", m.GetId()) } +func (m *_NodeIdTwoByte) GetNamespace() int16 { + ctx := context.Background() + _ = ctx + return int16(-(int16(1))) +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -230,6 +238,8 @@ func (m *_NodeIdTwoByte) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits } @@ -260,6 +270,12 @@ func (m *_NodeIdTwoByte) parse(ctx context.Context, readBuffer utils.ReadBuffer, } _ = identifier + namespace, err := ReadVirtualField[int16](ctx, "namespace", (*int16)(nil), -(int16(1))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespace' field")) + } + _ = namespace + if closeErr := readBuffer.CloseContext("NodeIdTwoByte"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for NodeIdTwoByte") } @@ -294,6 +310,12 @@ func (m *_NodeIdTwoByte) SerializeWithWriteBuffer(ctx context.Context, writeBuff if _identifierErr := writeBuffer.WriteVirtual(ctx, "identifier", m.GetIdentifier()); _identifierErr != nil { return errors.Wrap(_identifierErr, "Error serializing 'identifier' field") } + // Virtual field + namespace := m.GetNamespace() + _ = namespace + if _namespaceErr := writeBuffer.WriteVirtual(ctx, "namespace", m.GetNamespace()); _namespaceErr != nil { + return errors.Wrap(_namespaceErr, "Error serializing 'namespace' field") + } if popErr := writeBuffer.PopContext("NodeIdTwoByte"); popErr != nil { return errors.Wrap(popErr, "Error popping for NodeIdTwoByte") diff --git a/plc4go/protocols/opcua/readwrite/model/NodeIdTypeDefinition.go b/plc4go/protocols/opcua/readwrite/model/NodeIdTypeDefinition.go index 7984861244c..ebef1946a16 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeIdTypeDefinition.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeIdTypeDefinition.go @@ -51,6 +51,8 @@ type NodeIdTypeDefinition interface { type NodeIdTypeDefinitionContract interface { // GetIdentifier returns Identifier (abstract field) GetIdentifier() string + // GetNamespace returns Namespace (abstract field) + GetNamespace() int16 // IsNodeIdTypeDefinition is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeIdTypeDefinition() // CreateBuilder creates a NodeIdTypeDefinitionBuilder @@ -65,6 +67,8 @@ type NodeIdTypeDefinitionRequirements interface { GetNodeType() NodeIdType // GetIdentifier returns Identifier (abstract field) GetIdentifier() string + // GetNamespace returns Namespace (abstract field) + GetNamespace() int16 } // _NodeIdTypeDefinition is the data-structure of this message @@ -320,6 +324,10 @@ func (m *_NodeIdTypeDefinition) GetIdentifier() string { return m._SubType.GetIdentifier() } +func (m *_NodeIdTypeDefinition) GetNamespace() int16 { + return m._SubType.GetNamespace() +} + /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// diff --git a/plc4go/protocols/opcua/readwrite/model/NodeReference.go b/plc4go/protocols/opcua/readwrite/model/NodeReference.go index 3311f5e09bd..5e53b3556cc 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeReference.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeReference.go @@ -46,8 +46,6 @@ type NodeReference interface { GetReferenceTypeId() NodeId // GetIsForward returns IsForward (property field) GetIsForward() bool - // GetNoOfReferencedNodeIds returns NoOfReferencedNodeIds (property field) - GetNoOfReferencedNodeIds() int32 // GetReferencedNodeIds returns ReferencedNodeIds (property field) GetReferencedNodeIds() []NodeId // IsNodeReference is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,11 +57,10 @@ type NodeReference interface { // _NodeReference is the data-structure of this message type _NodeReference struct { ExtensionObjectDefinitionContract - NodeId NodeId - ReferenceTypeId NodeId - IsForward bool - NoOfReferencedNodeIds int32 - ReferencedNodeIds []NodeId + NodeId NodeId + ReferenceTypeId NodeId + IsForward bool + ReferencedNodeIds []NodeId // Reserved Fields reservedField0 *uint8 } @@ -72,7 +69,7 @@ var _ NodeReference = (*_NodeReference)(nil) var _ ExtensionObjectDefinitionRequirements = (*_NodeReference)(nil) // NewNodeReference factory function for _NodeReference -func NewNodeReference(nodeId NodeId, referenceTypeId NodeId, isForward bool, noOfReferencedNodeIds int32, referencedNodeIds []NodeId) *_NodeReference { +func NewNodeReference(nodeId NodeId, referenceTypeId NodeId, isForward bool, referencedNodeIds []NodeId) *_NodeReference { if nodeId == nil { panic("nodeId of type NodeId for NodeReference must not be nil") } @@ -84,7 +81,6 @@ func NewNodeReference(nodeId NodeId, referenceTypeId NodeId, isForward bool, noO NodeId: nodeId, ReferenceTypeId: referenceTypeId, IsForward: isForward, - NoOfReferencedNodeIds: noOfReferencedNodeIds, ReferencedNodeIds: referencedNodeIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -100,7 +96,7 @@ func NewNodeReference(nodeId NodeId, referenceTypeId NodeId, isForward bool, noO type NodeReferenceBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(nodeId NodeId, referenceTypeId NodeId, isForward bool, noOfReferencedNodeIds int32, referencedNodeIds []NodeId) NodeReferenceBuilder + WithMandatoryFields(nodeId NodeId, referenceTypeId NodeId, isForward bool, referencedNodeIds []NodeId) NodeReferenceBuilder // WithNodeId adds NodeId (property field) WithNodeId(NodeId) NodeReferenceBuilder // WithNodeIdBuilder adds NodeId (property field) which is build by the builder @@ -111,8 +107,6 @@ type NodeReferenceBuilder interface { WithReferenceTypeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) NodeReferenceBuilder // WithIsForward adds IsForward (property field) WithIsForward(bool) NodeReferenceBuilder - // WithNoOfReferencedNodeIds adds NoOfReferencedNodeIds (property field) - WithNoOfReferencedNodeIds(int32) NodeReferenceBuilder // WithReferencedNodeIds adds ReferencedNodeIds (property field) WithReferencedNodeIds(...NodeId) NodeReferenceBuilder // Build builds the NodeReference or returns an error if something is wrong @@ -140,8 +134,8 @@ func (b *_NodeReferenceBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_NodeReferenceBuilder) WithMandatoryFields(nodeId NodeId, referenceTypeId NodeId, isForward bool, noOfReferencedNodeIds int32, referencedNodeIds []NodeId) NodeReferenceBuilder { - return b.WithNodeId(nodeId).WithReferenceTypeId(referenceTypeId).WithIsForward(isForward).WithNoOfReferencedNodeIds(noOfReferencedNodeIds).WithReferencedNodeIds(referencedNodeIds...) +func (b *_NodeReferenceBuilder) WithMandatoryFields(nodeId NodeId, referenceTypeId NodeId, isForward bool, referencedNodeIds []NodeId) NodeReferenceBuilder { + return b.WithNodeId(nodeId).WithReferenceTypeId(referenceTypeId).WithIsForward(isForward).WithReferencedNodeIds(referencedNodeIds...) } func (b *_NodeReferenceBuilder) WithNodeId(nodeId NodeId) NodeReferenceBuilder { @@ -185,11 +179,6 @@ func (b *_NodeReferenceBuilder) WithIsForward(isForward bool) NodeReferenceBuild return b } -func (b *_NodeReferenceBuilder) WithNoOfReferencedNodeIds(noOfReferencedNodeIds int32) NodeReferenceBuilder { - b.NoOfReferencedNodeIds = noOfReferencedNodeIds - return b -} - func (b *_NodeReferenceBuilder) WithReferencedNodeIds(referencedNodeIds ...NodeId) NodeReferenceBuilder { b.ReferencedNodeIds = referencedNodeIds return b @@ -257,8 +246,8 @@ func (b *_NodeReference) CreateNodeReferenceBuilder() NodeReferenceBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NodeReference) GetIdentifier() string { - return "582" +func (m *_NodeReference) GetExtensionId() int32 { + return int32(582) } /////////////////////// @@ -287,10 +276,6 @@ func (m *_NodeReference) GetIsForward() bool { return m.IsForward } -func (m *_NodeReference) GetNoOfReferencedNodeIds() int32 { - return m.NoOfReferencedNodeIds -} - func (m *_NodeReference) GetReferencedNodeIds() []NodeId { return m.ReferencedNodeIds } @@ -330,7 +315,7 @@ func (m *_NodeReference) GetLengthInBits(ctx context.Context) uint16 { // Simple field (isForward) lengthInBits += 1 - // Simple field (noOfReferencedNodeIds) + // Implicit Field (noOfReferencedNodeIds) lengthInBits += 32 // Array field @@ -350,7 +335,7 @@ func (m *_NodeReference) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NodeReference) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__nodeReference NodeReference, err error) { +func (m *_NodeReference) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__nodeReference NodeReference, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -385,11 +370,11 @@ func (m *_NodeReference) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.IsForward = isForward - noOfReferencedNodeIds, err := ReadSimpleField(ctx, "noOfReferencedNodeIds", ReadSignedInt(readBuffer, uint8(32))) + noOfReferencedNodeIds, err := ReadImplicitField[int32](ctx, "noOfReferencedNodeIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReferencedNodeIds' field")) } - m.NoOfReferencedNodeIds = noOfReferencedNodeIds + _ = noOfReferencedNodeIds referencedNodeIds, err := ReadCountArrayField[NodeId](ctx, "referencedNodeIds", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer), uint64(noOfReferencedNodeIds)) if err != nil { @@ -437,8 +422,8 @@ func (m *_NodeReference) SerializeWithWriteBuffer(ctx context.Context, writeBuff if err := WriteSimpleField[bool](ctx, "isForward", m.GetIsForward(), WriteBoolean(writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'isForward' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReferencedNodeIds", m.GetNoOfReferencedNodeIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReferencedNodeIds := int32(utils.InlineIf(bool((m.GetReferencedNodeIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReferencedNodeIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReferencedNodeIds", noOfReferencedNodeIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReferencedNodeIds' field") } @@ -469,7 +454,6 @@ func (m *_NodeReference) deepCopy() *_NodeReference { m.NodeId.DeepCopy().(NodeId), m.ReferenceTypeId.DeepCopy().(NodeId), m.IsForward, - m.NoOfReferencedNodeIds, utils.DeepCopySlice[NodeId, NodeId](m.ReferencedNodeIds), m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/NodeTypeDescription.go b/plc4go/protocols/opcua/readwrite/model/NodeTypeDescription.go index de658d0fa18..ccac5d16d2c 100644 --- a/plc4go/protocols/opcua/readwrite/model/NodeTypeDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/NodeTypeDescription.go @@ -44,10 +44,8 @@ type NodeTypeDescription interface { GetTypeDefinitionNode() ExpandedNodeId // GetIncludeSubTypes returns IncludeSubTypes (property field) GetIncludeSubTypes() bool - // GetNoOfDataToReturn returns NoOfDataToReturn (property field) - GetNoOfDataToReturn() int32 // GetDataToReturn returns DataToReturn (property field) - GetDataToReturn() []ExtensionObjectDefinition + GetDataToReturn() []QueryDataDescription // IsNodeTypeDescription is a marker method to prevent unintentional type checks (interfaces of same signature) IsNodeTypeDescription() // CreateBuilder creates a NodeTypeDescriptionBuilder @@ -59,8 +57,7 @@ type _NodeTypeDescription struct { ExtensionObjectDefinitionContract TypeDefinitionNode ExpandedNodeId IncludeSubTypes bool - NoOfDataToReturn int32 - DataToReturn []ExtensionObjectDefinition + DataToReturn []QueryDataDescription // Reserved Fields reservedField0 *uint8 } @@ -69,7 +66,7 @@ var _ NodeTypeDescription = (*_NodeTypeDescription)(nil) var _ ExtensionObjectDefinitionRequirements = (*_NodeTypeDescription)(nil) // NewNodeTypeDescription factory function for _NodeTypeDescription -func NewNodeTypeDescription(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, noOfDataToReturn int32, dataToReturn []ExtensionObjectDefinition) *_NodeTypeDescription { +func NewNodeTypeDescription(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, dataToReturn []QueryDataDescription) *_NodeTypeDescription { if typeDefinitionNode == nil { panic("typeDefinitionNode of type ExpandedNodeId for NodeTypeDescription must not be nil") } @@ -77,7 +74,6 @@ func NewNodeTypeDescription(typeDefinitionNode ExpandedNodeId, includeSubTypes b ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), TypeDefinitionNode: typeDefinitionNode, IncludeSubTypes: includeSubTypes, - NoOfDataToReturn: noOfDataToReturn, DataToReturn: dataToReturn, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -93,17 +89,15 @@ func NewNodeTypeDescription(typeDefinitionNode ExpandedNodeId, includeSubTypes b type NodeTypeDescriptionBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, noOfDataToReturn int32, dataToReturn []ExtensionObjectDefinition) NodeTypeDescriptionBuilder + WithMandatoryFields(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, dataToReturn []QueryDataDescription) NodeTypeDescriptionBuilder // WithTypeDefinitionNode adds TypeDefinitionNode (property field) WithTypeDefinitionNode(ExpandedNodeId) NodeTypeDescriptionBuilder // WithTypeDefinitionNodeBuilder adds TypeDefinitionNode (property field) which is build by the builder WithTypeDefinitionNodeBuilder(func(ExpandedNodeIdBuilder) ExpandedNodeIdBuilder) NodeTypeDescriptionBuilder // WithIncludeSubTypes adds IncludeSubTypes (property field) WithIncludeSubTypes(bool) NodeTypeDescriptionBuilder - // WithNoOfDataToReturn adds NoOfDataToReturn (property field) - WithNoOfDataToReturn(int32) NodeTypeDescriptionBuilder // WithDataToReturn adds DataToReturn (property field) - WithDataToReturn(...ExtensionObjectDefinition) NodeTypeDescriptionBuilder + WithDataToReturn(...QueryDataDescription) NodeTypeDescriptionBuilder // Build builds the NodeTypeDescription or returns an error if something is wrong Build() (NodeTypeDescription, error) // MustBuild does the same as Build but panics on error @@ -129,8 +123,8 @@ func (b *_NodeTypeDescriptionBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_NodeTypeDescriptionBuilder) WithMandatoryFields(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, noOfDataToReturn int32, dataToReturn []ExtensionObjectDefinition) NodeTypeDescriptionBuilder { - return b.WithTypeDefinitionNode(typeDefinitionNode).WithIncludeSubTypes(includeSubTypes).WithNoOfDataToReturn(noOfDataToReturn).WithDataToReturn(dataToReturn...) +func (b *_NodeTypeDescriptionBuilder) WithMandatoryFields(typeDefinitionNode ExpandedNodeId, includeSubTypes bool, dataToReturn []QueryDataDescription) NodeTypeDescriptionBuilder { + return b.WithTypeDefinitionNode(typeDefinitionNode).WithIncludeSubTypes(includeSubTypes).WithDataToReturn(dataToReturn...) } func (b *_NodeTypeDescriptionBuilder) WithTypeDefinitionNode(typeDefinitionNode ExpandedNodeId) NodeTypeDescriptionBuilder { @@ -156,12 +150,7 @@ func (b *_NodeTypeDescriptionBuilder) WithIncludeSubTypes(includeSubTypes bool) return b } -func (b *_NodeTypeDescriptionBuilder) WithNoOfDataToReturn(noOfDataToReturn int32) NodeTypeDescriptionBuilder { - b.NoOfDataToReturn = noOfDataToReturn - return b -} - -func (b *_NodeTypeDescriptionBuilder) WithDataToReturn(dataToReturn ...ExtensionObjectDefinition) NodeTypeDescriptionBuilder { +func (b *_NodeTypeDescriptionBuilder) WithDataToReturn(dataToReturn ...QueryDataDescription) NodeTypeDescriptionBuilder { b.DataToReturn = dataToReturn return b } @@ -222,8 +211,8 @@ func (b *_NodeTypeDescription) CreateNodeTypeDescriptionBuilder() NodeTypeDescri /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NodeTypeDescription) GetIdentifier() string { - return "575" +func (m *_NodeTypeDescription) GetExtensionId() int32 { + return int32(575) } /////////////////////// @@ -248,11 +237,7 @@ func (m *_NodeTypeDescription) GetIncludeSubTypes() bool { return m.IncludeSubTypes } -func (m *_NodeTypeDescription) GetNoOfDataToReturn() int32 { - return m.NoOfDataToReturn -} - -func (m *_NodeTypeDescription) GetDataToReturn() []ExtensionObjectDefinition { +func (m *_NodeTypeDescription) GetDataToReturn() []QueryDataDescription { return m.DataToReturn } @@ -288,7 +273,7 @@ func (m *_NodeTypeDescription) GetLengthInBits(ctx context.Context) uint16 { // Simple field (includeSubTypes) lengthInBits += 1 - // Simple field (noOfDataToReturn) + // Implicit Field (noOfDataToReturn) lengthInBits += 32 // Array field @@ -308,7 +293,7 @@ func (m *_NodeTypeDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NodeTypeDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__nodeTypeDescription NodeTypeDescription, err error) { +func (m *_NodeTypeDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__nodeTypeDescription NodeTypeDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -337,13 +322,13 @@ func (m *_NodeTypeDescription) parse(ctx context.Context, readBuffer utils.ReadB } m.IncludeSubTypes = includeSubTypes - noOfDataToReturn, err := ReadSimpleField(ctx, "noOfDataToReturn", ReadSignedInt(readBuffer, uint8(32))) + noOfDataToReturn, err := ReadImplicitField[int32](ctx, "noOfDataToReturn", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataToReturn' field")) } - m.NoOfDataToReturn = noOfDataToReturn + _ = noOfDataToReturn - dataToReturn, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "dataToReturn", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("572")), readBuffer), uint64(noOfDataToReturn)) + dataToReturn, err := ReadCountArrayField[QueryDataDescription](ctx, "dataToReturn", ReadComplex[QueryDataDescription](ExtensionObjectDefinitionParseWithBufferProducer[QueryDataDescription]((int32)(int32(572))), readBuffer), uint64(noOfDataToReturn)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataToReturn' field")) } @@ -385,8 +370,8 @@ func (m *_NodeTypeDescription) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[bool](ctx, "includeSubTypes", m.GetIncludeSubTypes(), WriteBoolean(writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'includeSubTypes' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDataToReturn", m.GetNoOfDataToReturn(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDataToReturn := int32(utils.InlineIf(bool((m.GetDataToReturn()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataToReturn()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataToReturn", noOfDataToReturn, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDataToReturn' field") } @@ -416,8 +401,7 @@ func (m *_NodeTypeDescription) deepCopy() *_NodeTypeDescription { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.TypeDefinitionNode.DeepCopy().(ExpandedNodeId), m.IncludeSubTypes, - m.NoOfDataToReturn, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.DataToReturn), + utils.DeepCopySlice[QueryDataDescription, QueryDataDescription](m.DataToReturn), m.reservedField0, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/NotificationData.go b/plc4go/protocols/opcua/readwrite/model/NotificationData.go index f622ef5716e..950929bab4f 100644 --- a/plc4go/protocols/opcua/readwrite/model/NotificationData.go +++ b/plc4go/protocols/opcua/readwrite/model/NotificationData.go @@ -150,8 +150,8 @@ func (b *_NotificationData) CreateNotificationDataBuilder() NotificationDataBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NotificationData) GetIdentifier() string { - return "947" +func (m *_NotificationData) GetExtensionId() int32 { + return int32(947) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_NotificationData) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NotificationData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__notificationData NotificationData, err error) { +func (m *_NotificationData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__notificationData NotificationData, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/NotificationMessage.go b/plc4go/protocols/opcua/readwrite/model/NotificationMessage.go index fc5ce51afa7..e504e17cf5b 100644 --- a/plc4go/protocols/opcua/readwrite/model/NotificationMessage.go +++ b/plc4go/protocols/opcua/readwrite/model/NotificationMessage.go @@ -44,8 +44,6 @@ type NotificationMessage interface { GetSequenceNumber() uint32 // GetPublishTime returns PublishTime (property field) GetPublishTime() int64 - // GetNoOfNotificationData returns NoOfNotificationData (property field) - GetNoOfNotificationData() int32 // GetNotificationData returns NotificationData (property field) GetNotificationData() []ExtensionObject // IsNotificationMessage is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,22 +55,20 @@ type NotificationMessage interface { // _NotificationMessage is the data-structure of this message type _NotificationMessage struct { ExtensionObjectDefinitionContract - SequenceNumber uint32 - PublishTime int64 - NoOfNotificationData int32 - NotificationData []ExtensionObject + SequenceNumber uint32 + PublishTime int64 + NotificationData []ExtensionObject } var _ NotificationMessage = (*_NotificationMessage)(nil) var _ ExtensionObjectDefinitionRequirements = (*_NotificationMessage)(nil) // NewNotificationMessage factory function for _NotificationMessage -func NewNotificationMessage(sequenceNumber uint32, publishTime int64, noOfNotificationData int32, notificationData []ExtensionObject) *_NotificationMessage { +func NewNotificationMessage(sequenceNumber uint32, publishTime int64, notificationData []ExtensionObject) *_NotificationMessage { _result := &_NotificationMessage{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), SequenceNumber: sequenceNumber, PublishTime: publishTime, - NoOfNotificationData: noOfNotificationData, NotificationData: notificationData, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -88,13 +84,11 @@ func NewNotificationMessage(sequenceNumber uint32, publishTime int64, noOfNotifi type NotificationMessageBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(sequenceNumber uint32, publishTime int64, noOfNotificationData int32, notificationData []ExtensionObject) NotificationMessageBuilder + WithMandatoryFields(sequenceNumber uint32, publishTime int64, notificationData []ExtensionObject) NotificationMessageBuilder // WithSequenceNumber adds SequenceNumber (property field) WithSequenceNumber(uint32) NotificationMessageBuilder // WithPublishTime adds PublishTime (property field) WithPublishTime(int64) NotificationMessageBuilder - // WithNoOfNotificationData adds NoOfNotificationData (property field) - WithNoOfNotificationData(int32) NotificationMessageBuilder // WithNotificationData adds NotificationData (property field) WithNotificationData(...ExtensionObject) NotificationMessageBuilder // Build builds the NotificationMessage or returns an error if something is wrong @@ -122,8 +116,8 @@ func (b *_NotificationMessageBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_NotificationMessageBuilder) WithMandatoryFields(sequenceNumber uint32, publishTime int64, noOfNotificationData int32, notificationData []ExtensionObject) NotificationMessageBuilder { - return b.WithSequenceNumber(sequenceNumber).WithPublishTime(publishTime).WithNoOfNotificationData(noOfNotificationData).WithNotificationData(notificationData...) +func (b *_NotificationMessageBuilder) WithMandatoryFields(sequenceNumber uint32, publishTime int64, notificationData []ExtensionObject) NotificationMessageBuilder { + return b.WithSequenceNumber(sequenceNumber).WithPublishTime(publishTime).WithNotificationData(notificationData...) } func (b *_NotificationMessageBuilder) WithSequenceNumber(sequenceNumber uint32) NotificationMessageBuilder { @@ -136,11 +130,6 @@ func (b *_NotificationMessageBuilder) WithPublishTime(publishTime int64) Notific return b } -func (b *_NotificationMessageBuilder) WithNoOfNotificationData(noOfNotificationData int32) NotificationMessageBuilder { - b.NoOfNotificationData = noOfNotificationData - return b -} - func (b *_NotificationMessageBuilder) WithNotificationData(notificationData ...ExtensionObject) NotificationMessageBuilder { b.NotificationData = notificationData return b @@ -196,8 +185,8 @@ func (b *_NotificationMessage) CreateNotificationMessageBuilder() NotificationMe /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NotificationMessage) GetIdentifier() string { - return "805" +func (m *_NotificationMessage) GetExtensionId() int32 { + return int32(805) } /////////////////////// @@ -222,10 +211,6 @@ func (m *_NotificationMessage) GetPublishTime() int64 { return m.PublishTime } -func (m *_NotificationMessage) GetNoOfNotificationData() int32 { - return m.NoOfNotificationData -} - func (m *_NotificationMessage) GetNotificationData() []ExtensionObject { return m.NotificationData } @@ -259,7 +244,7 @@ func (m *_NotificationMessage) GetLengthInBits(ctx context.Context) uint16 { // Simple field (publishTime) lengthInBits += 64 - // Simple field (noOfNotificationData) + // Implicit Field (noOfNotificationData) lengthInBits += 32 // Array field @@ -279,7 +264,7 @@ func (m *_NotificationMessage) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NotificationMessage) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__notificationMessage NotificationMessage, err error) { +func (m *_NotificationMessage) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__notificationMessage NotificationMessage, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -302,13 +287,13 @@ func (m *_NotificationMessage) parse(ctx context.Context, readBuffer utils.ReadB } m.PublishTime = publishTime - noOfNotificationData, err := ReadSimpleField(ctx, "noOfNotificationData", ReadSignedInt(readBuffer, uint8(32))) + noOfNotificationData, err := ReadImplicitField[int32](ctx, "noOfNotificationData", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNotificationData' field")) } - m.NoOfNotificationData = noOfNotificationData + _ = noOfNotificationData - notificationData, err := ReadCountArrayField[ExtensionObject](ctx, "notificationData", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer), uint64(noOfNotificationData)) + notificationData, err := ReadCountArrayField[ExtensionObject](ctx, "notificationData", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfNotificationData)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationData' field")) } @@ -346,8 +331,8 @@ func (m *_NotificationMessage) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[int64](ctx, "publishTime", m.GetPublishTime(), WriteSignedLong(writeBuffer, 64)); err != nil { return errors.Wrap(err, "Error serializing 'publishTime' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNotificationData", m.GetNoOfNotificationData(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNotificationData := int32(utils.InlineIf(bool((m.GetNotificationData()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNotificationData()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNotificationData", noOfNotificationData, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNotificationData' field") } @@ -377,7 +362,6 @@ func (m *_NotificationMessage) deepCopy() *_NotificationMessage { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.SequenceNumber, m.PublishTime, - m.NoOfNotificationData, utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.NotificationData), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/NullExtension.go b/plc4go/protocols/opcua/readwrite/model/NullExtension.go index 311db1b3484..4f37b7557ba 100644 --- a/plc4go/protocols/opcua/readwrite/model/NullExtension.go +++ b/plc4go/protocols/opcua/readwrite/model/NullExtension.go @@ -150,8 +150,8 @@ func (b *_NullExtension) CreateNullExtensionBuilder() NullExtensionBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_NullExtension) GetIdentifier() string { - return "0" +func (m *_NullExtension) GetExtensionId() int32 { + return int32(0) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_NullExtension) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_NullExtension) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__nullExtension NullExtension, err error) { +func (m *_NullExtension) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__nullExtension NullExtension, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/NullExtensionObjectWithMask.go b/plc4go/protocols/opcua/readwrite/model/NullExtensionObjectWithMask.go new file mode 100644 index 00000000000..197f5baf6bf --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/NullExtensionObjectWithMask.go @@ -0,0 +1,302 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NullExtensionObjectWithMask is the corresponding interface of NullExtensionObjectWithMask +type NullExtensionObjectWithMask interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectWithMask + // GetBody returns Body (virtual field) + GetBody() ExtensionObjectDefinition + // IsNullExtensionObjectWithMask is a marker method to prevent unintentional type checks (interfaces of same signature) + IsNullExtensionObjectWithMask() + // CreateBuilder creates a NullExtensionObjectWithMaskBuilder + CreateNullExtensionObjectWithMaskBuilder() NullExtensionObjectWithMaskBuilder +} + +// _NullExtensionObjectWithMask is the data-structure of this message +type _NullExtensionObjectWithMask struct { + ExtensionObjectWithMaskContract +} + +var _ NullExtensionObjectWithMask = (*_NullExtensionObjectWithMask)(nil) +var _ ExtensionObjectWithMaskRequirements = (*_NullExtensionObjectWithMask)(nil) + +// NewNullExtensionObjectWithMask factory function for _NullExtensionObjectWithMask +func NewNullExtensionObjectWithMask(typeId ExpandedNodeId, encodingMask ExtensionObjectEncodingMask, extensionId int32, includeEncodingMask bool) *_NullExtensionObjectWithMask { + _result := &_NullExtensionObjectWithMask{ + ExtensionObjectWithMaskContract: NewExtensionObjectWithMask(typeId, encodingMask, extensionId), + } + _result.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// NullExtensionObjectWithMaskBuilder is a builder for NullExtensionObjectWithMask +type NullExtensionObjectWithMaskBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields() NullExtensionObjectWithMaskBuilder + // Build builds the NullExtensionObjectWithMask or returns an error if something is wrong + Build() (NullExtensionObjectWithMask, error) + // MustBuild does the same as Build but panics on error + MustBuild() NullExtensionObjectWithMask +} + +// NewNullExtensionObjectWithMaskBuilder() creates a NullExtensionObjectWithMaskBuilder +func NewNullExtensionObjectWithMaskBuilder() NullExtensionObjectWithMaskBuilder { + return &_NullExtensionObjectWithMaskBuilder{_NullExtensionObjectWithMask: new(_NullExtensionObjectWithMask)} +} + +type _NullExtensionObjectWithMaskBuilder struct { + *_NullExtensionObjectWithMask + + parentBuilder *_ExtensionObjectWithMaskBuilder + + err *utils.MultiError +} + +var _ (NullExtensionObjectWithMaskBuilder) = (*_NullExtensionObjectWithMaskBuilder)(nil) + +func (b *_NullExtensionObjectWithMaskBuilder) setParent(contract ExtensionObjectWithMaskContract) { + b.ExtensionObjectWithMaskContract = contract +} + +func (b *_NullExtensionObjectWithMaskBuilder) WithMandatoryFields() NullExtensionObjectWithMaskBuilder { + return b +} + +func (b *_NullExtensionObjectWithMaskBuilder) Build() (NullExtensionObjectWithMask, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._NullExtensionObjectWithMask.deepCopy(), nil +} + +func (b *_NullExtensionObjectWithMaskBuilder) MustBuild() NullExtensionObjectWithMask { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_NullExtensionObjectWithMaskBuilder) Done() ExtensionObjectWithMaskBuilder { + return b.parentBuilder +} + +func (b *_NullExtensionObjectWithMaskBuilder) buildForExtensionObjectWithMask() (ExtensionObjectWithMask, error) { + return b.Build() +} + +func (b *_NullExtensionObjectWithMaskBuilder) DeepCopy() any { + _copy := b.CreateNullExtensionObjectWithMaskBuilder().(*_NullExtensionObjectWithMaskBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateNullExtensionObjectWithMaskBuilder creates a NullExtensionObjectWithMaskBuilder +func (b *_NullExtensionObjectWithMask) CreateNullExtensionObjectWithMaskBuilder() NullExtensionObjectWithMaskBuilder { + if b == nil { + return NewNullExtensionObjectWithMaskBuilder() + } + return &_NullExtensionObjectWithMaskBuilder{_NullExtensionObjectWithMask: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NullExtensionObjectWithMask) GetEncodingMaskXmlBody() bool { + return bool(false) +} + +func (m *_NullExtensionObjectWithMask) GetEncodingMaskBinaryBody() bool { + return bool(false) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NullExtensionObjectWithMask) GetParent() ExtensionObjectWithMaskContract { + return m.ExtensionObjectWithMaskContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for virtual fields. +/////////////////////// + +func (m *_NullExtensionObjectWithMask) GetBody() ExtensionObjectDefinition { + ctx := context.Background() + _ = ctx + return CastExtensionObjectDefinition(nil) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastNullExtensionObjectWithMask(structType any) NullExtensionObjectWithMask { + if casted, ok := structType.(NullExtensionObjectWithMask); ok { + return casted + } + if casted, ok := structType.(*NullExtensionObjectWithMask); ok { + return *casted + } + return nil +} + +func (m *_NullExtensionObjectWithMask) GetTypeName() string { + return "NullExtensionObjectWithMask" +} + +func (m *_NullExtensionObjectWithMask) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).getLengthInBits(ctx)) + + // A virtual field doesn't have any in- or output. + + return lengthInBits +} + +func (m *_NullExtensionObjectWithMask) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_NullExtensionObjectWithMask) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectWithMask, extensionId int32, includeEncodingMask bool) (__nullExtensionObjectWithMask NullExtensionObjectWithMask, err error) { + m.ExtensionObjectWithMaskContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NullExtensionObjectWithMask"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NullExtensionObjectWithMask") + } + currentPos := positionAware.GetPos() + _ = currentPos + + body, err := ReadVirtualField[ExtensionObjectDefinition](ctx, "body", (*ExtensionObjectDefinition)(nil), nil) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'body' field")) + } + _ = body + + if closeErr := readBuffer.CloseContext("NullExtensionObjectWithMask"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NullExtensionObjectWithMask") + } + + return m, nil +} + +func (m *_NullExtensionObjectWithMask) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_NullExtensionObjectWithMask) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("NullExtensionObjectWithMask"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NullExtensionObjectWithMask") + } + // Virtual field + body := m.GetBody() + _ = body + if _bodyErr := writeBuffer.WriteVirtual(ctx, "body", m.GetBody()); _bodyErr != nil { + return errors.Wrap(_bodyErr, "Error serializing 'body' field") + } + + if popErr := writeBuffer.PopContext("NullExtensionObjectWithMask"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NullExtensionObjectWithMask") + } + return nil + } + return m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_NullExtensionObjectWithMask) IsNullExtensionObjectWithMask() {} + +func (m *_NullExtensionObjectWithMask) DeepCopy() any { + return m.deepCopy() +} + +func (m *_NullExtensionObjectWithMask) deepCopy() *_NullExtensionObjectWithMask { + if m == nil { + return nil + } + _NullExtensionObjectWithMaskCopy := &_NullExtensionObjectWithMask{ + m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask).deepCopy(), + } + m.ExtensionObjectWithMaskContract.(*_ExtensionObjectWithMask)._SubType = m + return _NullExtensionObjectWithMaskCopy +} + +func (m *_NullExtensionObjectWithMask) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ObjectAttributes.go b/plc4go/protocols/opcua/readwrite/model/ObjectAttributes.go new file mode 100644 index 00000000000..00361924c9a --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ObjectAttributes.go @@ -0,0 +1,499 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ObjectAttributes is the corresponding interface of ObjectAttributes +type ObjectAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetEventNotifier returns EventNotifier (property field) + GetEventNotifier() uint8 + // IsObjectAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsObjectAttributes() + // CreateBuilder creates a ObjectAttributesBuilder + CreateObjectAttributesBuilder() ObjectAttributesBuilder +} + +// _ObjectAttributes is the data-structure of this message +type _ObjectAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + EventNotifier uint8 +} + +var _ ObjectAttributes = (*_ObjectAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ObjectAttributes)(nil) + +// NewObjectAttributes factory function for _ObjectAttributes +func NewObjectAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, eventNotifier uint8) *_ObjectAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for ObjectAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for ObjectAttributes must not be nil") + } + _result := &_ObjectAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + EventNotifier: eventNotifier, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ObjectAttributesBuilder is a builder for ObjectAttributes +type ObjectAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, eventNotifier uint8) ObjectAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) ObjectAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) ObjectAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) ObjectAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) ObjectAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) ObjectAttributesBuilder + // WithEventNotifier adds EventNotifier (property field) + WithEventNotifier(uint8) ObjectAttributesBuilder + // Build builds the ObjectAttributes or returns an error if something is wrong + Build() (ObjectAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() ObjectAttributes +} + +// NewObjectAttributesBuilder() creates a ObjectAttributesBuilder +func NewObjectAttributesBuilder() ObjectAttributesBuilder { + return &_ObjectAttributesBuilder{_ObjectAttributes: new(_ObjectAttributes)} +} + +type _ObjectAttributesBuilder struct { + *_ObjectAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ObjectAttributesBuilder) = (*_ObjectAttributesBuilder)(nil) + +func (b *_ObjectAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ObjectAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, eventNotifier uint8) ObjectAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithEventNotifier(eventNotifier) +} + +func (b *_ObjectAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) ObjectAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_ObjectAttributesBuilder) WithDisplayName(displayName LocalizedText) ObjectAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_ObjectAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ObjectAttributesBuilder) WithDescription(description LocalizedText) ObjectAttributesBuilder { + b.Description = description + return b +} + +func (b *_ObjectAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ObjectAttributesBuilder) WithWriteMask(writeMask uint32) ObjectAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_ObjectAttributesBuilder) WithUserWriteMask(userWriteMask uint32) ObjectAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_ObjectAttributesBuilder) WithEventNotifier(eventNotifier uint8) ObjectAttributesBuilder { + b.EventNotifier = eventNotifier + return b +} + +func (b *_ObjectAttributesBuilder) Build() (ObjectAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ObjectAttributes.deepCopy(), nil +} + +func (b *_ObjectAttributesBuilder) MustBuild() ObjectAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ObjectAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ObjectAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ObjectAttributesBuilder) DeepCopy() any { + _copy := b.CreateObjectAttributesBuilder().(*_ObjectAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateObjectAttributesBuilder creates a ObjectAttributesBuilder +func (b *_ObjectAttributes) CreateObjectAttributesBuilder() ObjectAttributesBuilder { + if b == nil { + return NewObjectAttributesBuilder() + } + return &_ObjectAttributesBuilder{_ObjectAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ObjectAttributes) GetExtensionId() int32 { + return int32(354) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ObjectAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ObjectAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_ObjectAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_ObjectAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_ObjectAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_ObjectAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_ObjectAttributes) GetEventNotifier() uint8 { + return m.EventNotifier +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastObjectAttributes(structType any) ObjectAttributes { + if casted, ok := structType.(ObjectAttributes); ok { + return casted + } + if casted, ok := structType.(*ObjectAttributes); ok { + return *casted + } + return nil +} + +func (m *_ObjectAttributes) GetTypeName() string { + return "ObjectAttributes" +} + +func (m *_ObjectAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Simple field (eventNotifier) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_ObjectAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ObjectAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__objectAttributes ObjectAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ObjectAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ObjectAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + eventNotifier, err := ReadSimpleField(ctx, "eventNotifier", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eventNotifier' field")) + } + m.EventNotifier = eventNotifier + + if closeErr := readBuffer.CloseContext("ObjectAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ObjectAttributes") + } + + return m, nil +} + +func (m *_ObjectAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ObjectAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ObjectAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ObjectAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteSimpleField[uint8](ctx, "eventNotifier", m.GetEventNotifier(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'eventNotifier' field") + } + + if popErr := writeBuffer.PopContext("ObjectAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ObjectAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ObjectAttributes) IsObjectAttributes() {} + +func (m *_ObjectAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ObjectAttributes) deepCopy() *_ObjectAttributes { + if m == nil { + return nil + } + _ObjectAttributesCopy := &_ObjectAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.EventNotifier, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ObjectAttributesCopy +} + +func (m *_ObjectAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ObjectTypeAttributes.go b/plc4go/protocols/opcua/readwrite/model/ObjectTypeAttributes.go new file mode 100644 index 00000000000..eaeb3af1d89 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ObjectTypeAttributes.go @@ -0,0 +1,515 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ObjectTypeAttributes is the corresponding interface of ObjectTypeAttributes +type ObjectTypeAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetIsAbstract returns IsAbstract (property field) + GetIsAbstract() bool + // IsObjectTypeAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsObjectTypeAttributes() + // CreateBuilder creates a ObjectTypeAttributesBuilder + CreateObjectTypeAttributesBuilder() ObjectTypeAttributesBuilder +} + +// _ObjectTypeAttributes is the data-structure of this message +type _ObjectTypeAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + IsAbstract bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ ObjectTypeAttributes = (*_ObjectTypeAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ObjectTypeAttributes)(nil) + +// NewObjectTypeAttributes factory function for _ObjectTypeAttributes +func NewObjectTypeAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) *_ObjectTypeAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for ObjectTypeAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for ObjectTypeAttributes must not be nil") + } + _result := &_ObjectTypeAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + IsAbstract: isAbstract, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ObjectTypeAttributesBuilder is a builder for ObjectTypeAttributes +type ObjectTypeAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) ObjectTypeAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) ObjectTypeAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) ObjectTypeAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectTypeAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) ObjectTypeAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectTypeAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) ObjectTypeAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) ObjectTypeAttributesBuilder + // WithIsAbstract adds IsAbstract (property field) + WithIsAbstract(bool) ObjectTypeAttributesBuilder + // Build builds the ObjectTypeAttributes or returns an error if something is wrong + Build() (ObjectTypeAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() ObjectTypeAttributes +} + +// NewObjectTypeAttributesBuilder() creates a ObjectTypeAttributesBuilder +func NewObjectTypeAttributesBuilder() ObjectTypeAttributesBuilder { + return &_ObjectTypeAttributesBuilder{_ObjectTypeAttributes: new(_ObjectTypeAttributes)} +} + +type _ObjectTypeAttributesBuilder struct { + *_ObjectTypeAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ObjectTypeAttributesBuilder) = (*_ObjectTypeAttributesBuilder)(nil) + +func (b *_ObjectTypeAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ObjectTypeAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, isAbstract bool) ObjectTypeAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithIsAbstract(isAbstract) +} + +func (b *_ObjectTypeAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) ObjectTypeAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithDisplayName(displayName LocalizedText) ObjectTypeAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectTypeAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithDescription(description LocalizedText) ObjectTypeAttributesBuilder { + b.Description = description + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ObjectTypeAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithWriteMask(writeMask uint32) ObjectTypeAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithUserWriteMask(userWriteMask uint32) ObjectTypeAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_ObjectTypeAttributesBuilder) WithIsAbstract(isAbstract bool) ObjectTypeAttributesBuilder { + b.IsAbstract = isAbstract + return b +} + +func (b *_ObjectTypeAttributesBuilder) Build() (ObjectTypeAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ObjectTypeAttributes.deepCopy(), nil +} + +func (b *_ObjectTypeAttributesBuilder) MustBuild() ObjectTypeAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ObjectTypeAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ObjectTypeAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ObjectTypeAttributesBuilder) DeepCopy() any { + _copy := b.CreateObjectTypeAttributesBuilder().(*_ObjectTypeAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateObjectTypeAttributesBuilder creates a ObjectTypeAttributesBuilder +func (b *_ObjectTypeAttributes) CreateObjectTypeAttributesBuilder() ObjectTypeAttributesBuilder { + if b == nil { + return NewObjectTypeAttributesBuilder() + } + return &_ObjectTypeAttributesBuilder{_ObjectTypeAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ObjectTypeAttributes) GetExtensionId() int32 { + return int32(363) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ObjectTypeAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ObjectTypeAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_ObjectTypeAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_ObjectTypeAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_ObjectTypeAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_ObjectTypeAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_ObjectTypeAttributes) GetIsAbstract() bool { + return m.IsAbstract +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastObjectTypeAttributes(structType any) ObjectTypeAttributes { + if casted, ok := structType.(ObjectTypeAttributes); ok { + return casted + } + if casted, ok := structType.(*ObjectTypeAttributes); ok { + return *casted + } + return nil +} + +func (m *_ObjectTypeAttributes) GetTypeName() string { + return "ObjectTypeAttributes" +} + +func (m *_ObjectTypeAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (isAbstract) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_ObjectTypeAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ObjectTypeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__objectTypeAttributes ObjectTypeAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ObjectTypeAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ObjectTypeAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + isAbstract, err := ReadSimpleField(ctx, "isAbstract", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isAbstract' field")) + } + m.IsAbstract = isAbstract + + if closeErr := readBuffer.CloseContext("ObjectTypeAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ObjectTypeAttributes") + } + + return m, nil +} + +func (m *_ObjectTypeAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ObjectTypeAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ObjectTypeAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ObjectTypeAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "isAbstract", m.GetIsAbstract(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isAbstract' field") + } + + if popErr := writeBuffer.PopContext("ObjectTypeAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ObjectTypeAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ObjectTypeAttributes) IsObjectTypeAttributes() {} + +func (m *_ObjectTypeAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ObjectTypeAttributes) deepCopy() *_ObjectTypeAttributes { + if m == nil { + return nil + } + _ObjectTypeAttributesCopy := &_ObjectTypeAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.IsAbstract, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ObjectTypeAttributesCopy +} + +func (m *_ObjectTypeAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaAPU.go b/plc4go/protocols/opcua/readwrite/model/OpcuaAPU.go index cb06ab2477f..bfb945657aa 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaAPU.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaAPU.go @@ -54,17 +54,18 @@ type _OpcuaAPU struct { Message MessagePDU // Arguments. - Response bool + Response bool + BinaryEncoding bool } var _ OpcuaAPU = (*_OpcuaAPU)(nil) // NewOpcuaAPU factory function for _OpcuaAPU -func NewOpcuaAPU(message MessagePDU, response bool) *_OpcuaAPU { +func NewOpcuaAPU(message MessagePDU, response bool, binaryEncoding bool) *_OpcuaAPU { if message == nil { panic("message of type MessagePDU for OpcuaAPU must not be nil") } - return &_OpcuaAPU{Message: message, Response: response} + return &_OpcuaAPU{Message: message, Response: response, BinaryEncoding: binaryEncoding} } /////////////////////////////////////////////////////////// @@ -206,25 +207,25 @@ func (m *_OpcuaAPU) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func OpcuaAPUParse(ctx context.Context, theBytes []byte, response bool) (OpcuaAPU, error) { - return OpcuaAPUParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), response) +func OpcuaAPUParse(ctx context.Context, theBytes []byte, response bool, binaryEncoding bool) (OpcuaAPU, error) { + return OpcuaAPUParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian)), response, binaryEncoding) } -func OpcuaAPUParseWithBufferProducer(response bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaAPU, error) { +func OpcuaAPUParseWithBufferProducer(response bool, binaryEncoding bool) func(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaAPU, error) { return func(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaAPU, error) { - return OpcuaAPUParseWithBuffer(ctx, readBuffer, response) + return OpcuaAPUParseWithBuffer(ctx, readBuffer, response, binaryEncoding) } } -func OpcuaAPUParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer, response bool) (OpcuaAPU, error) { - v, err := (&_OpcuaAPU{Response: response}).parse(ctx, readBuffer, response) +func OpcuaAPUParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer, response bool, binaryEncoding bool) (OpcuaAPU, error) { + v, err := (&_OpcuaAPU{Response: response, BinaryEncoding: binaryEncoding}).parse(ctx, readBuffer, response, binaryEncoding) if err != nil { return nil, err } return v, nil } -func (m *_OpcuaAPU) parse(ctx context.Context, readBuffer utils.ReadBuffer, response bool) (__opcuaAPU OpcuaAPU, err error) { +func (m *_OpcuaAPU) parse(ctx context.Context, readBuffer utils.ReadBuffer, response bool, binaryEncoding bool) (__opcuaAPU OpcuaAPU, err error) { positionAware := readBuffer _ = positionAware if pullErr := readBuffer.PullContext("OpcuaAPU"); pullErr != nil { @@ -233,7 +234,7 @@ func (m *_OpcuaAPU) parse(ctx context.Context, readBuffer utils.ReadBuffer, resp currentPos := positionAware.GetPos() _ = currentPos - message, err := ReadSimpleField[MessagePDU](ctx, "message", ReadComplex[MessagePDU](MessagePDUParseWithBufferProducer[MessagePDU]((bool)(response)), readBuffer), codegen.WithByteOrder(binary.LittleEndian)) + message, err := ReadSimpleField[MessagePDU](ctx, "message", ReadComplex[MessagePDU](MessagePDUParseWithBufferProducer[MessagePDU]((bool)(response), (bool)(binaryEncoding)), readBuffer), codegen.WithByteOrder(binary.LittleEndian)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } @@ -279,6 +280,9 @@ func (m *_OpcuaAPU) SerializeWithWriteBuffer(ctx context.Context, writeBuffer ut func (m *_OpcuaAPU) GetResponse() bool { return m.Response } +func (m *_OpcuaAPU) GetBinaryEncoding() bool { + return m.BinaryEncoding +} // //// @@ -296,6 +300,7 @@ func (m *_OpcuaAPU) deepCopy() *_OpcuaAPU { _OpcuaAPUCopy := &_OpcuaAPU{ m.Message.DeepCopy().(MessagePDU), m.Response, + m.BinaryEncoding, } return _OpcuaAPUCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaAcknowledgeResponse.go b/plc4go/protocols/opcua/readwrite/model/OpcuaAcknowledgeResponse.go index 5493eadd404..e26f8869117 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaAcknowledgeResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaAcknowledgeResponse.go @@ -61,12 +61,12 @@ var _ OpcuaAcknowledgeResponse = (*_OpcuaAcknowledgeResponse)(nil) var _ MessagePDURequirements = (*_OpcuaAcknowledgeResponse)(nil) // NewOpcuaAcknowledgeResponse factory function for _OpcuaAcknowledgeResponse -func NewOpcuaAcknowledgeResponse(chunk ChunkType, version uint32, limits OpcuaProtocolLimits) *_OpcuaAcknowledgeResponse { +func NewOpcuaAcknowledgeResponse(chunk ChunkType, version uint32, limits OpcuaProtocolLimits, binary bool) *_OpcuaAcknowledgeResponse { if limits == nil { panic("limits of type OpcuaProtocolLimits for OpcuaAcknowledgeResponse must not be nil") } _result := &_OpcuaAcknowledgeResponse{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), Version: version, Limits: limits, } @@ -264,7 +264,7 @@ func (m *_OpcuaAcknowledgeResponse) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaAcknowledgeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool) (__opcuaAcknowledgeResponse OpcuaAcknowledgeResponse, err error) { +func (m *_OpcuaAcknowledgeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool, binary bool) (__opcuaAcknowledgeResponse OpcuaAcknowledgeResponse, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaCloseRequest.go b/plc4go/protocols/opcua/readwrite/model/OpcuaCloseRequest.go index 8bcd0ae1dc9..955c2af685f 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaCloseRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaCloseRequest.go @@ -61,7 +61,7 @@ var _ OpcuaCloseRequest = (*_OpcuaCloseRequest)(nil) var _ MessagePDURequirements = (*_OpcuaCloseRequest)(nil) // NewOpcuaCloseRequest factory function for _OpcuaCloseRequest -func NewOpcuaCloseRequest(chunk ChunkType, securityHeader SecurityHeader, message Payload) *_OpcuaCloseRequest { +func NewOpcuaCloseRequest(chunk ChunkType, securityHeader SecurityHeader, message Payload, binary bool) *_OpcuaCloseRequest { if securityHeader == nil { panic("securityHeader of type SecurityHeader for OpcuaCloseRequest must not be nil") } @@ -69,7 +69,7 @@ func NewOpcuaCloseRequest(chunk ChunkType, securityHeader SecurityHeader, messag panic("message of type Payload for OpcuaCloseRequest must not be nil") } _result := &_OpcuaCloseRequest{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), SecurityHeader: securityHeader, Message: message, } @@ -288,7 +288,7 @@ func (m *_OpcuaCloseRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaCloseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool) (__opcuaCloseRequest OpcuaCloseRequest, err error) { +func (m *_OpcuaCloseRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool, binary bool) (__opcuaCloseRequest OpcuaCloseRequest, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer @@ -305,7 +305,7 @@ func (m *_OpcuaCloseRequest) parse(ctx context.Context, readBuffer utils.ReadBuf } m.SecurityHeader = securityHeader - message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(bool(false)), (uint32)(uint32(0))), readBuffer)) + message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(binary), (uint32)(uint32(0))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaHelloRequest.go b/plc4go/protocols/opcua/readwrite/model/OpcuaHelloRequest.go index 5628236454a..bcf5be7b602 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaHelloRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaHelloRequest.go @@ -64,7 +64,7 @@ var _ OpcuaHelloRequest = (*_OpcuaHelloRequest)(nil) var _ MessagePDURequirements = (*_OpcuaHelloRequest)(nil) // NewOpcuaHelloRequest factory function for _OpcuaHelloRequest -func NewOpcuaHelloRequest(chunk ChunkType, version uint32, limits OpcuaProtocolLimits, endpoint PascalString) *_OpcuaHelloRequest { +func NewOpcuaHelloRequest(chunk ChunkType, version uint32, limits OpcuaProtocolLimits, endpoint PascalString, binary bool) *_OpcuaHelloRequest { if limits == nil { panic("limits of type OpcuaProtocolLimits for OpcuaHelloRequest must not be nil") } @@ -72,7 +72,7 @@ func NewOpcuaHelloRequest(chunk ChunkType, version uint32, limits OpcuaProtocolL panic("endpoint of type PascalString for OpcuaHelloRequest must not be nil") } _result := &_OpcuaHelloRequest{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), Version: version, Limits: limits, Endpoint: endpoint, @@ -306,7 +306,7 @@ func (m *_OpcuaHelloRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaHelloRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool) (__opcuaHelloRequest OpcuaHelloRequest, err error) { +func (m *_OpcuaHelloRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool, binary bool) (__opcuaHelloRequest OpcuaHelloRequest, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageError.go b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageError.go index b9290ff2c47..2dffcded5c6 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageError.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageError.go @@ -61,12 +61,12 @@ var _ OpcuaMessageError = (*_OpcuaMessageError)(nil) var _ MessagePDURequirements = (*_OpcuaMessageError)(nil) // NewOpcuaMessageError factory function for _OpcuaMessageError -func NewOpcuaMessageError(chunk ChunkType, error OpcuaStatusCode, reason PascalString) *_OpcuaMessageError { +func NewOpcuaMessageError(chunk ChunkType, error OpcuaStatusCode, reason PascalString, binary bool) *_OpcuaMessageError { if reason == nil { panic("reason of type PascalString for OpcuaMessageError must not be nil") } _result := &_OpcuaMessageError{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), Error: error, Reason: reason, } @@ -264,7 +264,7 @@ func (m *_OpcuaMessageError) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaMessageError) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool) (__opcuaMessageError OpcuaMessageError, err error) { +func (m *_OpcuaMessageError) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, response bool, binary bool) (__opcuaMessageError OpcuaMessageError, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageRequest.go b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageRequest.go index e5df1ca8061..ece273730b7 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageRequest.go @@ -64,7 +64,7 @@ var _ OpcuaMessageRequest = (*_OpcuaMessageRequest)(nil) var _ MessagePDURequirements = (*_OpcuaMessageRequest)(nil) // NewOpcuaMessageRequest factory function for _OpcuaMessageRequest -func NewOpcuaMessageRequest(chunk ChunkType, securityHeader SecurityHeader, message Payload, totalLength uint32) *_OpcuaMessageRequest { +func NewOpcuaMessageRequest(chunk ChunkType, securityHeader SecurityHeader, message Payload, totalLength uint32, binary bool) *_OpcuaMessageRequest { if securityHeader == nil { panic("securityHeader of type SecurityHeader for OpcuaMessageRequest must not be nil") } @@ -72,7 +72,7 @@ func NewOpcuaMessageRequest(chunk ChunkType, securityHeader SecurityHeader, mess panic("message of type Payload for OpcuaMessageRequest must not be nil") } _result := &_OpcuaMessageRequest{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), SecurityHeader: securityHeader, Message: message, } @@ -291,7 +291,7 @@ func (m *_OpcuaMessageRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaMessageRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool) (__opcuaMessageRequest OpcuaMessageRequest, err error) { +func (m *_OpcuaMessageRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool, binary bool) (__opcuaMessageRequest OpcuaMessageRequest, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer @@ -308,7 +308,7 @@ func (m *_OpcuaMessageRequest) parse(ctx context.Context, readBuffer utils.ReadB } m.SecurityHeader = securityHeader - message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(bool(false)), (uint32)(uint32(uint32(totalLength)-uint32(securityHeader.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) + message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(binary), (uint32)(uint32(uint32(totalLength)-uint32(securityHeader.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageResponse.go b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageResponse.go index faa4cb290e2..b51bdda07a1 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaMessageResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaMessageResponse.go @@ -64,7 +64,7 @@ var _ OpcuaMessageResponse = (*_OpcuaMessageResponse)(nil) var _ MessagePDURequirements = (*_OpcuaMessageResponse)(nil) // NewOpcuaMessageResponse factory function for _OpcuaMessageResponse -func NewOpcuaMessageResponse(chunk ChunkType, securityHeader SecurityHeader, message Payload, totalLength uint32) *_OpcuaMessageResponse { +func NewOpcuaMessageResponse(chunk ChunkType, securityHeader SecurityHeader, message Payload, totalLength uint32, binary bool) *_OpcuaMessageResponse { if securityHeader == nil { panic("securityHeader of type SecurityHeader for OpcuaMessageResponse must not be nil") } @@ -72,7 +72,7 @@ func NewOpcuaMessageResponse(chunk ChunkType, securityHeader SecurityHeader, mes panic("message of type Payload for OpcuaMessageResponse must not be nil") } _result := &_OpcuaMessageResponse{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), SecurityHeader: securityHeader, Message: message, } @@ -291,7 +291,7 @@ func (m *_OpcuaMessageResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaMessageResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool) (__opcuaMessageResponse OpcuaMessageResponse, err error) { +func (m *_OpcuaMessageResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool, binary bool) (__opcuaMessageResponse OpcuaMessageResponse, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer @@ -308,7 +308,7 @@ func (m *_OpcuaMessageResponse) parse(ctx context.Context, readBuffer utils.Read } m.SecurityHeader = securityHeader - message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(bool(false)), (uint32)(uint32(uint32(totalLength)-uint32(securityHeader.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) + message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(binary), (uint32)(uint32(uint32(totalLength)-uint32(securityHeader.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableAddress.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableAddress.go deleted file mode 100644 index d7810baf0b4..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableAddress.go +++ /dev/null @@ -1,263 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableAddress is an enum -type OpcuaNodeIdServicesVariableAddress int32 - -type IOpcuaNodeIdServicesVariableAddress interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Size OpcuaNodeIdServicesVariableAddress = 11596 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_OpenCount OpcuaNodeIdServicesVariableAddress = 11599 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_InputArguments OpcuaNodeIdServicesVariableAddress = 11601 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_OutputArguments OpcuaNodeIdServicesVariableAddress = 11602 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Close_InputArguments OpcuaNodeIdServicesVariableAddress = 11604 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_InputArguments OpcuaNodeIdServicesVariableAddress = 11606 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_OutputArguments OpcuaNodeIdServicesVariableAddress = 11607 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Write_InputArguments OpcuaNodeIdServicesVariableAddress = 11609 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_InputArguments OpcuaNodeIdServicesVariableAddress = 11611 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_OutputArguments OpcuaNodeIdServicesVariableAddress = 11612 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_SetPosition_InputArguments OpcuaNodeIdServicesVariableAddress = 11614 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Writable OpcuaNodeIdServicesVariableAddress = 12688 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_UserWritable OpcuaNodeIdServicesVariableAddress = 12689 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MimeType OpcuaNodeIdServicesVariableAddress = 13398 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MaxByteStringLength OpcuaNodeIdServicesVariableAddress = 24245 - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_LastModifiedTime OpcuaNodeIdServicesVariableAddress = 25201 -) - -var OpcuaNodeIdServicesVariableAddressValues []OpcuaNodeIdServicesVariableAddress - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableAddressValues = []OpcuaNodeIdServicesVariableAddress{ - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Size, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_OpenCount, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_OutputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Close_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_OutputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Write_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_OutputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_SetPosition_InputArguments, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Writable, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_UserWritable, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MimeType, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MaxByteStringLength, - OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_LastModifiedTime, - } -} - -func OpcuaNodeIdServicesVariableAddressByValue(value int32) (enum OpcuaNodeIdServicesVariableAddress, ok bool) { - switch value { - case 11596: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Size, true - case 11599: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_OpenCount, true - case 11601: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_InputArguments, true - case 11602: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_OutputArguments, true - case 11604: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Close_InputArguments, true - case 11606: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_InputArguments, true - case 11607: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_OutputArguments, true - case 11609: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Write_InputArguments, true - case 11611: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_InputArguments, true - case 11612: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_OutputArguments, true - case 11614: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_SetPosition_InputArguments, true - case 12688: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Writable, true - case 12689: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_UserWritable, true - case 13398: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MimeType, true - case 24245: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MaxByteStringLength, true - case 25201: - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_LastModifiedTime, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableAddressByName(value string) (enum OpcuaNodeIdServicesVariableAddress, ok bool) { - switch value { - case "AddressSpaceFileType_Size": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Size, true - case "AddressSpaceFileType_OpenCount": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_OpenCount, true - case "AddressSpaceFileType_Open_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_InputArguments, true - case "AddressSpaceFileType_Open_OutputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_OutputArguments, true - case "AddressSpaceFileType_Close_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Close_InputArguments, true - case "AddressSpaceFileType_Read_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_InputArguments, true - case "AddressSpaceFileType_Read_OutputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_OutputArguments, true - case "AddressSpaceFileType_Write_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Write_InputArguments, true - case "AddressSpaceFileType_GetPosition_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_InputArguments, true - case "AddressSpaceFileType_GetPosition_OutputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_OutputArguments, true - case "AddressSpaceFileType_SetPosition_InputArguments": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_SetPosition_InputArguments, true - case "AddressSpaceFileType_Writable": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Writable, true - case "AddressSpaceFileType_UserWritable": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_UserWritable, true - case "AddressSpaceFileType_MimeType": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MimeType, true - case "AddressSpaceFileType_MaxByteStringLength": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MaxByteStringLength, true - case "AddressSpaceFileType_LastModifiedTime": - return OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_LastModifiedTime, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableAddressKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableAddressValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableAddress(structType any) OpcuaNodeIdServicesVariableAddress { - castFunc := func(typ any) OpcuaNodeIdServicesVariableAddress { - if sOpcuaNodeIdServicesVariableAddress, ok := typ.(OpcuaNodeIdServicesVariableAddress); ok { - return sOpcuaNodeIdServicesVariableAddress - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableAddress) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableAddress) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableAddressParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableAddress, error) { - return OpcuaNodeIdServicesVariableAddressParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableAddressParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableAddress, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableAddress", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableAddress") - } - if enum, ok := OpcuaNodeIdServicesVariableAddressByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableAddress") - return OpcuaNodeIdServicesVariableAddress(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableAddress) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableAddress) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableAddress", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableAddress) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Size: - return "AddressSpaceFileType_Size" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_OpenCount: - return "AddressSpaceFileType_OpenCount" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_InputArguments: - return "AddressSpaceFileType_Open_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Open_OutputArguments: - return "AddressSpaceFileType_Open_OutputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Close_InputArguments: - return "AddressSpaceFileType_Close_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_InputArguments: - return "AddressSpaceFileType_Read_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Read_OutputArguments: - return "AddressSpaceFileType_Read_OutputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Write_InputArguments: - return "AddressSpaceFileType_Write_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_InputArguments: - return "AddressSpaceFileType_GetPosition_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_GetPosition_OutputArguments: - return "AddressSpaceFileType_GetPosition_OutputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_SetPosition_InputArguments: - return "AddressSpaceFileType_SetPosition_InputArguments" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_Writable: - return "AddressSpaceFileType_Writable" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_UserWritable: - return "AddressSpaceFileType_UserWritable" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MimeType: - return "AddressSpaceFileType_MimeType" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_MaxByteStringLength: - return "AddressSpaceFileType_MaxByteStringLength" - case OpcuaNodeIdServicesVariableAddress_AddressSpaceFileType_LastModifiedTime: - return "AddressSpaceFileType_LastModifiedTime" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableAddress) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableChoice.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableChoice.go deleted file mode 100644 index 9fefd35356f..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableChoice.go +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableChoice is an enum -type OpcuaNodeIdServicesVariableChoice int32 - -type IOpcuaNodeIdServicesVariableChoice interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableChoice_ChoiceStateType_StateNumber OpcuaNodeIdServicesVariableChoice = 15110 -) - -var OpcuaNodeIdServicesVariableChoiceValues []OpcuaNodeIdServicesVariableChoice - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableChoiceValues = []OpcuaNodeIdServicesVariableChoice{ - OpcuaNodeIdServicesVariableChoice_ChoiceStateType_StateNumber, - } -} - -func OpcuaNodeIdServicesVariableChoiceByValue(value int32) (enum OpcuaNodeIdServicesVariableChoice, ok bool) { - switch value { - case 15110: - return OpcuaNodeIdServicesVariableChoice_ChoiceStateType_StateNumber, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableChoiceByName(value string) (enum OpcuaNodeIdServicesVariableChoice, ok bool) { - switch value { - case "ChoiceStateType_StateNumber": - return OpcuaNodeIdServicesVariableChoice_ChoiceStateType_StateNumber, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableChoiceKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableChoiceValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableChoice(structType any) OpcuaNodeIdServicesVariableChoice { - castFunc := func(typ any) OpcuaNodeIdServicesVariableChoice { - if sOpcuaNodeIdServicesVariableChoice, ok := typ.(OpcuaNodeIdServicesVariableChoice); ok { - return sOpcuaNodeIdServicesVariableChoice - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableChoice) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableChoice) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableChoiceParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableChoice, error) { - return OpcuaNodeIdServicesVariableChoiceParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableChoiceParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableChoice, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableChoice", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableChoice") - } - if enum, ok := OpcuaNodeIdServicesVariableChoiceByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableChoice") - return OpcuaNodeIdServicesVariableChoice(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableChoice) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableChoice) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableChoice", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableChoice) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableChoice_ChoiceStateType_StateNumber: - return "ChoiceStateType_StateNumber" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableChoice) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDevice.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDevice.go deleted file mode 100644 index ff3dc3a61ac..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDevice.go +++ /dev/null @@ -1,239 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableDevice is an enum -type OpcuaNodeIdServicesVariableDevice int32 - -type IOpcuaNodeIdServicesVariableDevice interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventId OpcuaNodeIdServicesVariableDevice = 3662 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventType OpcuaNodeIdServicesVariableDevice = 3663 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceNode OpcuaNodeIdServicesVariableDevice = 3664 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceName OpcuaNodeIdServicesVariableDevice = 3665 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Time OpcuaNodeIdServicesVariableDevice = 3666 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ReceiveTime OpcuaNodeIdServicesVariableDevice = 3667 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_LocalTime OpcuaNodeIdServicesVariableDevice = 3668 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Message OpcuaNodeIdServicesVariableDevice = 3669 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Severity OpcuaNodeIdServicesVariableDevice = 3670 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassId OpcuaNodeIdServicesVariableDevice = 31879 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassName OpcuaNodeIdServicesVariableDevice = 31880 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassId OpcuaNodeIdServicesVariableDevice = 31881 - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassName OpcuaNodeIdServicesVariableDevice = 31882 -) - -var OpcuaNodeIdServicesVariableDeviceValues []OpcuaNodeIdServicesVariableDevice - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableDeviceValues = []OpcuaNodeIdServicesVariableDevice{ - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventId, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventType, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceNode, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceName, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Time, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ReceiveTime, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_LocalTime, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Message, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Severity, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassId, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassName, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassId, - OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassName, - } -} - -func OpcuaNodeIdServicesVariableDeviceByValue(value int32) (enum OpcuaNodeIdServicesVariableDevice, ok bool) { - switch value { - case 31879: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassId, true - case 31880: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassName, true - case 31881: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassId, true - case 31882: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassName, true - case 3662: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventId, true - case 3663: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventType, true - case 3664: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceNode, true - case 3665: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceName, true - case 3666: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Time, true - case 3667: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ReceiveTime, true - case 3668: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_LocalTime, true - case 3669: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Message, true - case 3670: - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Severity, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableDeviceByName(value string) (enum OpcuaNodeIdServicesVariableDevice, ok bool) { - switch value { - case "DeviceFailureEventType_ConditionClassId": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassId, true - case "DeviceFailureEventType_ConditionClassName": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassName, true - case "DeviceFailureEventType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassId, true - case "DeviceFailureEventType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassName, true - case "DeviceFailureEventType_EventId": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventId, true - case "DeviceFailureEventType_EventType": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventType, true - case "DeviceFailureEventType_SourceNode": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceNode, true - case "DeviceFailureEventType_SourceName": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceName, true - case "DeviceFailureEventType_Time": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Time, true - case "DeviceFailureEventType_ReceiveTime": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ReceiveTime, true - case "DeviceFailureEventType_LocalTime": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_LocalTime, true - case "DeviceFailureEventType_Message": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Message, true - case "DeviceFailureEventType_Severity": - return OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Severity, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableDeviceKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableDeviceValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableDevice(structType any) OpcuaNodeIdServicesVariableDevice { - castFunc := func(typ any) OpcuaNodeIdServicesVariableDevice { - if sOpcuaNodeIdServicesVariableDevice, ok := typ.(OpcuaNodeIdServicesVariableDevice); ok { - return sOpcuaNodeIdServicesVariableDevice - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableDevice) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableDevice) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableDeviceParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableDevice, error) { - return OpcuaNodeIdServicesVariableDeviceParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableDeviceParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableDevice, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableDevice", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableDevice") - } - if enum, ok := OpcuaNodeIdServicesVariableDeviceByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableDevice") - return OpcuaNodeIdServicesVariableDevice(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableDevice) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableDevice) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableDevice", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableDevice) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassId: - return "DeviceFailureEventType_ConditionClassId" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionClassName: - return "DeviceFailureEventType_ConditionClassName" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassId: - return "DeviceFailureEventType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ConditionSubClassName: - return "DeviceFailureEventType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventId: - return "DeviceFailureEventType_EventId" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_EventType: - return "DeviceFailureEventType_EventType" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceNode: - return "DeviceFailureEventType_SourceNode" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_SourceName: - return "DeviceFailureEventType_SourceName" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Time: - return "DeviceFailureEventType_Time" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_ReceiveTime: - return "DeviceFailureEventType_ReceiveTime" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_LocalTime: - return "DeviceFailureEventType_LocalTime" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Message: - return "DeviceFailureEventType_Message" - case OpcuaNodeIdServicesVariableDevice_DeviceFailureEventType_Severity: - return "DeviceFailureEventType_Severity" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableDevice) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDiscrete.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDiscrete.go deleted file mode 100644 index 6d964af550f..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableDiscrete.go +++ /dev/null @@ -1,1255 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableDiscrete is an enum -type OpcuaNodeIdServicesVariableDiscrete int32 - -type IOpcuaNodeIdServicesVariableDiscrete interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_Definition OpcuaNodeIdServicesVariableDiscrete = 3776 - OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_ValuePrecision OpcuaNodeIdServicesVariableDiscrete = 3777 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventId OpcuaNodeIdServicesVariableDiscrete = 10524 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventType OpcuaNodeIdServicesVariableDiscrete = 10525 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceNode OpcuaNodeIdServicesVariableDiscrete = 10526 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceName OpcuaNodeIdServicesVariableDiscrete = 10527 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Time OpcuaNodeIdServicesVariableDiscrete = 10528 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReceiveTime OpcuaNodeIdServicesVariableDiscrete = 10529 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LocalTime OpcuaNodeIdServicesVariableDiscrete = 10530 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Message OpcuaNodeIdServicesVariableDiscrete = 10531 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Severity OpcuaNodeIdServicesVariableDiscrete = 10532 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionName OpcuaNodeIdServicesVariableDiscrete = 10533 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_BranchId OpcuaNodeIdServicesVariableDiscrete = 10534 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Retain OpcuaNodeIdServicesVariableDiscrete = 10535 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState OpcuaNodeIdServicesVariableDiscrete = 10536 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Id OpcuaNodeIdServicesVariableDiscrete = 10537 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Name OpcuaNodeIdServicesVariableDiscrete = 10538 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Number OpcuaNodeIdServicesVariableDiscrete = 10539 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10540 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10541 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 10542 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TrueState OpcuaNodeIdServicesVariableDiscrete = 10543 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_FalseState OpcuaNodeIdServicesVariableDiscrete = 10544 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality OpcuaNodeIdServicesVariableDiscrete = 10545 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality_SourceTimestamp OpcuaNodeIdServicesVariableDiscrete = 10546 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity OpcuaNodeIdServicesVariableDiscrete = 10547 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity_SourceTimestamp OpcuaNodeIdServicesVariableDiscrete = 10548 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment OpcuaNodeIdServicesVariableDiscrete = 10549 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment_SourceTimestamp OpcuaNodeIdServicesVariableDiscrete = 10550 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ClientUserId OpcuaNodeIdServicesVariableDiscrete = 10551 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AddComment_InputArguments OpcuaNodeIdServicesVariableDiscrete = 10555 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh_InputArguments OpcuaNodeIdServicesVariableDiscrete = 10557 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState OpcuaNodeIdServicesVariableDiscrete = 10558 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Id OpcuaNodeIdServicesVariableDiscrete = 10559 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Name OpcuaNodeIdServicesVariableDiscrete = 10560 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Number OpcuaNodeIdServicesVariableDiscrete = 10561 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10562 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10563 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 10564 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TrueState OpcuaNodeIdServicesVariableDiscrete = 10565 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_FalseState OpcuaNodeIdServicesVariableDiscrete = 10566 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState OpcuaNodeIdServicesVariableDiscrete = 10567 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Id OpcuaNodeIdServicesVariableDiscrete = 10568 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Name OpcuaNodeIdServicesVariableDiscrete = 10569 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Number OpcuaNodeIdServicesVariableDiscrete = 10570 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10571 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10572 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 10573 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TrueState OpcuaNodeIdServicesVariableDiscrete = 10574 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_FalseState OpcuaNodeIdServicesVariableDiscrete = 10575 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Acknowledge_InputArguments OpcuaNodeIdServicesVariableDiscrete = 10577 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Confirm_InputArguments OpcuaNodeIdServicesVariableDiscrete = 10579 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState OpcuaNodeIdServicesVariableDiscrete = 10580 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Id OpcuaNodeIdServicesVariableDiscrete = 10581 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Name OpcuaNodeIdServicesVariableDiscrete = 10582 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Number OpcuaNodeIdServicesVariableDiscrete = 10583 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10584 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10585 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 10586 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TrueState OpcuaNodeIdServicesVariableDiscrete = 10587 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_FalseState OpcuaNodeIdServicesVariableDiscrete = 10588 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState OpcuaNodeIdServicesVariableDiscrete = 10589 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Id OpcuaNodeIdServicesVariableDiscrete = 10590 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Name OpcuaNodeIdServicesVariableDiscrete = 10591 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Number OpcuaNodeIdServicesVariableDiscrete = 10592 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10593 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10594 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 10595 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TrueState OpcuaNodeIdServicesVariableDiscrete = 10596 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_FalseState OpcuaNodeIdServicesVariableDiscrete = 10597 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState OpcuaNodeIdServicesVariableDiscrete = 10599 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Id OpcuaNodeIdServicesVariableDiscrete = 10600 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Name OpcuaNodeIdServicesVariableDiscrete = 10601 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Number OpcuaNodeIdServicesVariableDiscrete = 10602 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 10603 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition OpcuaNodeIdServicesVariableDiscrete = 10604 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Id OpcuaNodeIdServicesVariableDiscrete = 10605 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Name OpcuaNodeIdServicesVariableDiscrete = 10606 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Number OpcuaNodeIdServicesVariableDiscrete = 10607 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 10608 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_UnshelveTime OpcuaNodeIdServicesVariableDiscrete = 10609 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments OpcuaNodeIdServicesVariableDiscrete = 10634 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedOrShelved OpcuaNodeIdServicesVariableDiscrete = 10635 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_MaxTimeShelved OpcuaNodeIdServicesVariableDiscrete = 10636 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassId OpcuaNodeIdServicesVariableDiscrete = 11152 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassName OpcuaNodeIdServicesVariableDiscrete = 11153 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_InputNode OpcuaNodeIdServicesVariableDiscrete = 11154 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 11481 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 13005 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassId OpcuaNodeIdServicesVariableDiscrete = 16900 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassName OpcuaNodeIdServicesVariableDiscrete = 16901 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState OpcuaNodeIdServicesVariableDiscrete = 16902 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Id OpcuaNodeIdServicesVariableDiscrete = 16903 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Name OpcuaNodeIdServicesVariableDiscrete = 16904 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Number OpcuaNodeIdServicesVariableDiscrete = 16905 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 16906 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 16907 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 16908 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TrueState OpcuaNodeIdServicesVariableDiscrete = 16909 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_FalseState OpcuaNodeIdServicesVariableDiscrete = 16910 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState OpcuaNodeIdServicesVariableDiscrete = 16911 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Id OpcuaNodeIdServicesVariableDiscrete = 16912 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Name OpcuaNodeIdServicesVariableDiscrete = 16913 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Number OpcuaNodeIdServicesVariableDiscrete = 16914 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 16915 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 16916 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 16917 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TrueState OpcuaNodeIdServicesVariableDiscrete = 16918 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_FalseState OpcuaNodeIdServicesVariableDiscrete = 16919 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleEnabled OpcuaNodeIdServicesVariableDiscrete = 16920 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound OpcuaNodeIdServicesVariableDiscrete = 16921 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OnDelay OpcuaNodeIdServicesVariableDiscrete = 16926 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OffDelay OpcuaNodeIdServicesVariableDiscrete = 16927 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_FirstInGroupFlag OpcuaNodeIdServicesVariableDiscrete = 16928 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmTime OpcuaNodeIdServicesVariableDiscrete = 16931 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmRepeatCount OpcuaNodeIdServicesVariableDiscrete = 16932 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableStates OpcuaNodeIdServicesVariableDiscrete = 17692 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableTransitions OpcuaNodeIdServicesVariableDiscrete = 17693 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_ListId OpcuaNodeIdServicesVariableDiscrete = 17942 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_AgencyId OpcuaNodeIdServicesVariableDiscrete = 17943 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_VersionId OpcuaNodeIdServicesVariableDiscrete = 17944 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState OpcuaNodeIdServicesVariableDiscrete = 18307 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Id OpcuaNodeIdServicesVariableDiscrete = 18308 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Name OpcuaNodeIdServicesVariableDiscrete = 18309 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Number OpcuaNodeIdServicesVariableDiscrete = 18310 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveDisplayName OpcuaNodeIdServicesVariableDiscrete = 18311 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TransitionTime OpcuaNodeIdServicesVariableDiscrete = 18312 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableDiscrete = 18313 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TrueState OpcuaNodeIdServicesVariableDiscrete = 18314 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_FalseState OpcuaNodeIdServicesVariableDiscrete = 18315 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Suppress2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24429 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Unsuppress2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24431 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_RemoveFromService2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24433 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_PlaceInService2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24435 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Reset2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24437 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24907 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24909 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments OpcuaNodeIdServicesVariableDiscrete = 24911 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_GetGroupMemberships_OutputArguments OpcuaNodeIdServicesVariableDiscrete = 25168 - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SupportsFilteredRetain OpcuaNodeIdServicesVariableDiscrete = 32236 -) - -var OpcuaNodeIdServicesVariableDiscreteValues []OpcuaNodeIdServicesVariableDiscrete - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableDiscreteValues = []OpcuaNodeIdServicesVariableDiscrete{ - OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_Definition, - OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_ValuePrecision, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventType, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceNode, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Time, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReceiveTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LocalTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Message, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Severity, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_BranchId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Retain, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality_SourceTimestamp, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity_SourceTimestamp, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment_SourceTimestamp, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ClientUserId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AddComment_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Acknowledge_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Confirm_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_UnshelveTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedOrShelved, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_MaxTimeShelved, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_InputNode, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleEnabled, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OnDelay, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OffDelay, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_FirstInGroupFlag, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmRepeatCount, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableStates, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableTransitions, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_ListId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_AgencyId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_VersionId, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Id, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Name, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Number, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TrueState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_FalseState, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Suppress2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Unsuppress2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_RemoveFromService2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_PlaceInService2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Reset2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_GetGroupMemberships_OutputArguments, - OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SupportsFilteredRetain, - } -} - -func OpcuaNodeIdServicesVariableDiscreteByValue(value int32) (enum OpcuaNodeIdServicesVariableDiscrete, ok bool) { - switch value { - case 10524: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventId, true - case 10525: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventType, true - case 10526: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceNode, true - case 10527: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceName, true - case 10528: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Time, true - case 10529: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReceiveTime, true - case 10530: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LocalTime, true - case 10531: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Message, true - case 10532: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Severity, true - case 10533: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionName, true - case 10534: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_BranchId, true - case 10535: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Retain, true - case 10536: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState, true - case 10537: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Id, true - case 10538: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Name, true - case 10539: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Number, true - case 10540: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveDisplayName, true - case 10541: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TransitionTime, true - case 10542: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveTransitionTime, true - case 10543: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TrueState, true - case 10544: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_FalseState, true - case 10545: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality, true - case 10546: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality_SourceTimestamp, true - case 10547: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity, true - case 10548: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity_SourceTimestamp, true - case 10549: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment, true - case 10550: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment_SourceTimestamp, true - case 10551: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ClientUserId, true - case 10555: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AddComment_InputArguments, true - case 10557: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh_InputArguments, true - case 10558: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState, true - case 10559: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Id, true - case 10560: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Name, true - case 10561: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Number, true - case 10562: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveDisplayName, true - case 10563: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TransitionTime, true - case 10564: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveTransitionTime, true - case 10565: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TrueState, true - case 10566: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_FalseState, true - case 10567: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState, true - case 10568: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Id, true - case 10569: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Name, true - case 10570: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Number, true - case 10571: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveDisplayName, true - case 10572: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TransitionTime, true - case 10573: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime, true - case 10574: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TrueState, true - case 10575: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_FalseState, true - case 10577: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Acknowledge_InputArguments, true - case 10579: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Confirm_InputArguments, true - case 10580: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState, true - case 10581: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Id, true - case 10582: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Name, true - case 10583: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Number, true - case 10584: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveDisplayName, true - case 10585: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TransitionTime, true - case 10586: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveTransitionTime, true - case 10587: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TrueState, true - case 10588: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_FalseState, true - case 10589: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState, true - case 10590: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Id, true - case 10591: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Name, true - case 10592: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Number, true - case 10593: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveDisplayName, true - case 10594: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TransitionTime, true - case 10595: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveTransitionTime, true - case 10596: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TrueState, true - case 10597: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_FalseState, true - case 10599: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState, true - case 10600: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Id, true - case 10601: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Name, true - case 10602: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Number, true - case 10603: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case 10604: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition, true - case 10605: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Id, true - case 10606: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Name, true - case 10607: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Number, true - case 10608: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime, true - case 10609: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_UnshelveTime, true - case 10634: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments, true - case 10635: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedOrShelved, true - case 10636: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_MaxTimeShelved, true - case 11152: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassId, true - case 11153: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassName, true - case 11154: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_InputNode, true - case 11481: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case 13005: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh2_InputArguments, true - case 16900: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassId, true - case 16901: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassName, true - case 16902: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState, true - case 16903: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Id, true - case 16904: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Name, true - case 16905: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Number, true - case 16906: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName, true - case 16907: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TransitionTime, true - case 16908: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case 16909: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TrueState, true - case 16910: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_FalseState, true - case 16911: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState, true - case 16912: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Id, true - case 16913: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Name, true - case 16914: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Number, true - case 16915: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveDisplayName, true - case 16916: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TransitionTime, true - case 16917: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveTransitionTime, true - case 16918: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TrueState, true - case 16919: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_FalseState, true - case 16920: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleEnabled, true - case 16921: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound, true - case 16926: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OnDelay, true - case 16927: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OffDelay, true - case 16928: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_FirstInGroupFlag, true - case 16931: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmTime, true - case 16932: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmRepeatCount, true - case 17692: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableStates, true - case 17693: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableTransitions, true - case 17942: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_ListId, true - case 17943: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_AgencyId, true - case 17944: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_VersionId, true - case 18307: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState, true - case 18308: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Id, true - case 18309: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Name, true - case 18310: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Number, true - case 18311: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveDisplayName, true - case 18312: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TransitionTime, true - case 18313: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveTransitionTime, true - case 18314: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TrueState, true - case 18315: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_FalseState, true - case 24429: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Suppress2_InputArguments, true - case 24431: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Unsuppress2_InputArguments, true - case 24433: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_RemoveFromService2_InputArguments, true - case 24435: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_PlaceInService2_InputArguments, true - case 24437: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Reset2_InputArguments, true - case 24907: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case 24909: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments, true - case 24911: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case 25168: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_GetGroupMemberships_OutputArguments, true - case 32236: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SupportsFilteredRetain, true - case 3776: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_Definition, true - case 3777: - return OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_ValuePrecision, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableDiscreteByName(value string) (enum OpcuaNodeIdServicesVariableDiscrete, ok bool) { - switch value { - case "DiscreteAlarmType_EventId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventId, true - case "DiscreteAlarmType_EventType": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventType, true - case "DiscreteAlarmType_SourceNode": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceNode, true - case "DiscreteAlarmType_SourceName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceName, true - case "DiscreteAlarmType_Time": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Time, true - case "DiscreteAlarmType_ReceiveTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReceiveTime, true - case "DiscreteAlarmType_LocalTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LocalTime, true - case "DiscreteAlarmType_Message": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Message, true - case "DiscreteAlarmType_Severity": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Severity, true - case "DiscreteAlarmType_ConditionName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionName, true - case "DiscreteAlarmType_BranchId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_BranchId, true - case "DiscreteAlarmType_Retain": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Retain, true - case "DiscreteAlarmType_EnabledState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState, true - case "DiscreteAlarmType_EnabledState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Id, true - case "DiscreteAlarmType_EnabledState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Name, true - case "DiscreteAlarmType_EnabledState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Number, true - case "DiscreteAlarmType_EnabledState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveDisplayName, true - case "DiscreteAlarmType_EnabledState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TransitionTime, true - case "DiscreteAlarmType_EnabledState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveTransitionTime, true - case "DiscreteAlarmType_EnabledState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TrueState, true - case "DiscreteAlarmType_EnabledState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_FalseState, true - case "DiscreteAlarmType_Quality": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality, true - case "DiscreteAlarmType_Quality_SourceTimestamp": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality_SourceTimestamp, true - case "DiscreteAlarmType_LastSeverity": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity, true - case "DiscreteAlarmType_LastSeverity_SourceTimestamp": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity_SourceTimestamp, true - case "DiscreteAlarmType_Comment": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment, true - case "DiscreteAlarmType_Comment_SourceTimestamp": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment_SourceTimestamp, true - case "DiscreteAlarmType_ClientUserId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ClientUserId, true - case "DiscreteAlarmType_AddComment_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AddComment_InputArguments, true - case "DiscreteAlarmType_ConditionRefresh_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh_InputArguments, true - case "DiscreteAlarmType_AckedState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState, true - case "DiscreteAlarmType_AckedState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Id, true - case "DiscreteAlarmType_AckedState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Name, true - case "DiscreteAlarmType_AckedState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Number, true - case "DiscreteAlarmType_AckedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveDisplayName, true - case "DiscreteAlarmType_AckedState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TransitionTime, true - case "DiscreteAlarmType_AckedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveTransitionTime, true - case "DiscreteAlarmType_AckedState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TrueState, true - case "DiscreteAlarmType_AckedState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_FalseState, true - case "DiscreteAlarmType_ConfirmedState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState, true - case "DiscreteAlarmType_ConfirmedState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Id, true - case "DiscreteAlarmType_ConfirmedState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Name, true - case "DiscreteAlarmType_ConfirmedState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Number, true - case "DiscreteAlarmType_ConfirmedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveDisplayName, true - case "DiscreteAlarmType_ConfirmedState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TransitionTime, true - case "DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime, true - case "DiscreteAlarmType_ConfirmedState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TrueState, true - case "DiscreteAlarmType_ConfirmedState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_FalseState, true - case "DiscreteAlarmType_Acknowledge_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Acknowledge_InputArguments, true - case "DiscreteAlarmType_Confirm_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Confirm_InputArguments, true - case "DiscreteAlarmType_ActiveState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState, true - case "DiscreteAlarmType_ActiveState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Id, true - case "DiscreteAlarmType_ActiveState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Name, true - case "DiscreteAlarmType_ActiveState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Number, true - case "DiscreteAlarmType_ActiveState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveDisplayName, true - case "DiscreteAlarmType_ActiveState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TransitionTime, true - case "DiscreteAlarmType_ActiveState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveTransitionTime, true - case "DiscreteAlarmType_ActiveState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TrueState, true - case "DiscreteAlarmType_ActiveState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_FalseState, true - case "DiscreteAlarmType_SuppressedState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState, true - case "DiscreteAlarmType_SuppressedState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Id, true - case "DiscreteAlarmType_SuppressedState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Name, true - case "DiscreteAlarmType_SuppressedState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Number, true - case "DiscreteAlarmType_SuppressedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveDisplayName, true - case "DiscreteAlarmType_SuppressedState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TransitionTime, true - case "DiscreteAlarmType_SuppressedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveTransitionTime, true - case "DiscreteAlarmType_SuppressedState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TrueState, true - case "DiscreteAlarmType_SuppressedState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_FalseState, true - case "DiscreteAlarmType_ShelvingState_CurrentState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState, true - case "DiscreteAlarmType_ShelvingState_CurrentState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Id, true - case "DiscreteAlarmType_ShelvingState_CurrentState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Name, true - case "DiscreteAlarmType_ShelvingState_CurrentState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Number, true - case "DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case "DiscreteAlarmType_ShelvingState_LastTransition": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition, true - case "DiscreteAlarmType_ShelvingState_LastTransition_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Id, true - case "DiscreteAlarmType_ShelvingState_LastTransition_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Name, true - case "DiscreteAlarmType_ShelvingState_LastTransition_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Number, true - case "DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime, true - case "DiscreteAlarmType_ShelvingState_UnshelveTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_UnshelveTime, true - case "DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments, true - case "DiscreteAlarmType_SuppressedOrShelved": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedOrShelved, true - case "DiscreteAlarmType_MaxTimeShelved": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_MaxTimeShelved, true - case "DiscreteAlarmType_ConditionClassId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassId, true - case "DiscreteAlarmType_ConditionClassName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassName, true - case "DiscreteAlarmType_InputNode": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_InputNode, true - case "DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case "DiscreteAlarmType_ConditionRefresh2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh2_InputArguments, true - case "DiscreteAlarmType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassId, true - case "DiscreteAlarmType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassName, true - case "DiscreteAlarmType_OutOfServiceState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState, true - case "DiscreteAlarmType_OutOfServiceState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Id, true - case "DiscreteAlarmType_OutOfServiceState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Name, true - case "DiscreteAlarmType_OutOfServiceState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Number, true - case "DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName, true - case "DiscreteAlarmType_OutOfServiceState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TransitionTime, true - case "DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case "DiscreteAlarmType_OutOfServiceState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TrueState, true - case "DiscreteAlarmType_OutOfServiceState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_FalseState, true - case "DiscreteAlarmType_SilenceState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState, true - case "DiscreteAlarmType_SilenceState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Id, true - case "DiscreteAlarmType_SilenceState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Name, true - case "DiscreteAlarmType_SilenceState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Number, true - case "DiscreteAlarmType_SilenceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveDisplayName, true - case "DiscreteAlarmType_SilenceState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TransitionTime, true - case "DiscreteAlarmType_SilenceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveTransitionTime, true - case "DiscreteAlarmType_SilenceState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TrueState, true - case "DiscreteAlarmType_SilenceState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_FalseState, true - case "DiscreteAlarmType_AudibleEnabled": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleEnabled, true - case "DiscreteAlarmType_AudibleSound": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound, true - case "DiscreteAlarmType_OnDelay": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OnDelay, true - case "DiscreteAlarmType_OffDelay": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OffDelay, true - case "DiscreteAlarmType_FirstInGroupFlag": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_FirstInGroupFlag, true - case "DiscreteAlarmType_ReAlarmTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmTime, true - case "DiscreteAlarmType_ReAlarmRepeatCount": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmRepeatCount, true - case "DiscreteAlarmType_ShelvingState_AvailableStates": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableStates, true - case "DiscreteAlarmType_ShelvingState_AvailableTransitions": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableTransitions, true - case "DiscreteAlarmType_AudibleSound_ListId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_ListId, true - case "DiscreteAlarmType_AudibleSound_AgencyId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_AgencyId, true - case "DiscreteAlarmType_AudibleSound_VersionId": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_VersionId, true - case "DiscreteAlarmType_LatchedState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState, true - case "DiscreteAlarmType_LatchedState_Id": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Id, true - case "DiscreteAlarmType_LatchedState_Name": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Name, true - case "DiscreteAlarmType_LatchedState_Number": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Number, true - case "DiscreteAlarmType_LatchedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveDisplayName, true - case "DiscreteAlarmType_LatchedState_TransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TransitionTime, true - case "DiscreteAlarmType_LatchedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveTransitionTime, true - case "DiscreteAlarmType_LatchedState_TrueState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TrueState, true - case "DiscreteAlarmType_LatchedState_FalseState": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_FalseState, true - case "DiscreteAlarmType_Suppress2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Suppress2_InputArguments, true - case "DiscreteAlarmType_Unsuppress2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Unsuppress2_InputArguments, true - case "DiscreteAlarmType_RemoveFromService2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_RemoveFromService2_InputArguments, true - case "DiscreteAlarmType_PlaceInService2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_PlaceInService2_InputArguments, true - case "DiscreteAlarmType_Reset2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Reset2_InputArguments, true - case "DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case "DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments, true - case "DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case "DiscreteAlarmType_GetGroupMemberships_OutputArguments": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_GetGroupMemberships_OutputArguments, true - case "DiscreteAlarmType_SupportsFilteredRetain": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SupportsFilteredRetain, true - case "DiscreteItemType_Definition": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_Definition, true - case "DiscreteItemType_ValuePrecision": - return OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_ValuePrecision, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableDiscreteKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableDiscreteValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableDiscrete(structType any) OpcuaNodeIdServicesVariableDiscrete { - castFunc := func(typ any) OpcuaNodeIdServicesVariableDiscrete { - if sOpcuaNodeIdServicesVariableDiscrete, ok := typ.(OpcuaNodeIdServicesVariableDiscrete); ok { - return sOpcuaNodeIdServicesVariableDiscrete - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableDiscrete) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableDiscrete) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableDiscreteParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableDiscrete, error) { - return OpcuaNodeIdServicesVariableDiscreteParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableDiscreteParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableDiscrete, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableDiscrete", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableDiscrete") - } - if enum, ok := OpcuaNodeIdServicesVariableDiscreteByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableDiscrete") - return OpcuaNodeIdServicesVariableDiscrete(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableDiscrete) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableDiscrete) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableDiscrete", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableDiscrete) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventId: - return "DiscreteAlarmType_EventId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EventType: - return "DiscreteAlarmType_EventType" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceNode: - return "DiscreteAlarmType_SourceNode" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SourceName: - return "DiscreteAlarmType_SourceName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Time: - return "DiscreteAlarmType_Time" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReceiveTime: - return "DiscreteAlarmType_ReceiveTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LocalTime: - return "DiscreteAlarmType_LocalTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Message: - return "DiscreteAlarmType_Message" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Severity: - return "DiscreteAlarmType_Severity" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionName: - return "DiscreteAlarmType_ConditionName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_BranchId: - return "DiscreteAlarmType_BranchId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Retain: - return "DiscreteAlarmType_Retain" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState: - return "DiscreteAlarmType_EnabledState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Id: - return "DiscreteAlarmType_EnabledState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Name: - return "DiscreteAlarmType_EnabledState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_Number: - return "DiscreteAlarmType_EnabledState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveDisplayName: - return "DiscreteAlarmType_EnabledState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TransitionTime: - return "DiscreteAlarmType_EnabledState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_EffectiveTransitionTime: - return "DiscreteAlarmType_EnabledState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_TrueState: - return "DiscreteAlarmType_EnabledState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_EnabledState_FalseState: - return "DiscreteAlarmType_EnabledState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality: - return "DiscreteAlarmType_Quality" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Quality_SourceTimestamp: - return "DiscreteAlarmType_Quality_SourceTimestamp" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity: - return "DiscreteAlarmType_LastSeverity" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LastSeverity_SourceTimestamp: - return "DiscreteAlarmType_LastSeverity_SourceTimestamp" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment: - return "DiscreteAlarmType_Comment" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Comment_SourceTimestamp: - return "DiscreteAlarmType_Comment_SourceTimestamp" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ClientUserId: - return "DiscreteAlarmType_ClientUserId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AddComment_InputArguments: - return "DiscreteAlarmType_AddComment_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh_InputArguments: - return "DiscreteAlarmType_ConditionRefresh_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState: - return "DiscreteAlarmType_AckedState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Id: - return "DiscreteAlarmType_AckedState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Name: - return "DiscreteAlarmType_AckedState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_Number: - return "DiscreteAlarmType_AckedState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveDisplayName: - return "DiscreteAlarmType_AckedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TransitionTime: - return "DiscreteAlarmType_AckedState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_EffectiveTransitionTime: - return "DiscreteAlarmType_AckedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_TrueState: - return "DiscreteAlarmType_AckedState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AckedState_FalseState: - return "DiscreteAlarmType_AckedState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState: - return "DiscreteAlarmType_ConfirmedState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Id: - return "DiscreteAlarmType_ConfirmedState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Name: - return "DiscreteAlarmType_ConfirmedState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_Number: - return "DiscreteAlarmType_ConfirmedState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveDisplayName: - return "DiscreteAlarmType_ConfirmedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TransitionTime: - return "DiscreteAlarmType_ConfirmedState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime: - return "DiscreteAlarmType_ConfirmedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_TrueState: - return "DiscreteAlarmType_ConfirmedState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConfirmedState_FalseState: - return "DiscreteAlarmType_ConfirmedState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Acknowledge_InputArguments: - return "DiscreteAlarmType_Acknowledge_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Confirm_InputArguments: - return "DiscreteAlarmType_Confirm_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState: - return "DiscreteAlarmType_ActiveState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Id: - return "DiscreteAlarmType_ActiveState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Name: - return "DiscreteAlarmType_ActiveState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_Number: - return "DiscreteAlarmType_ActiveState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveDisplayName: - return "DiscreteAlarmType_ActiveState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TransitionTime: - return "DiscreteAlarmType_ActiveState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_EffectiveTransitionTime: - return "DiscreteAlarmType_ActiveState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_TrueState: - return "DiscreteAlarmType_ActiveState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ActiveState_FalseState: - return "DiscreteAlarmType_ActiveState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState: - return "DiscreteAlarmType_SuppressedState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Id: - return "DiscreteAlarmType_SuppressedState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Name: - return "DiscreteAlarmType_SuppressedState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_Number: - return "DiscreteAlarmType_SuppressedState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveDisplayName: - return "DiscreteAlarmType_SuppressedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TransitionTime: - return "DiscreteAlarmType_SuppressedState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_EffectiveTransitionTime: - return "DiscreteAlarmType_SuppressedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_TrueState: - return "DiscreteAlarmType_SuppressedState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedState_FalseState: - return "DiscreteAlarmType_SuppressedState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState: - return "DiscreteAlarmType_ShelvingState_CurrentState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Id: - return "DiscreteAlarmType_ShelvingState_CurrentState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Name: - return "DiscreteAlarmType_ShelvingState_CurrentState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_Number: - return "DiscreteAlarmType_ShelvingState_CurrentState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName: - return "DiscreteAlarmType_ShelvingState_CurrentState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition: - return "DiscreteAlarmType_ShelvingState_LastTransition" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Id: - return "DiscreteAlarmType_ShelvingState_LastTransition_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Name: - return "DiscreteAlarmType_ShelvingState_LastTransition_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_Number: - return "DiscreteAlarmType_ShelvingState_LastTransition_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime: - return "DiscreteAlarmType_ShelvingState_LastTransition_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_UnshelveTime: - return "DiscreteAlarmType_ShelvingState_UnshelveTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments: - return "DiscreteAlarmType_ShelvingState_TimedShelve_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SuppressedOrShelved: - return "DiscreteAlarmType_SuppressedOrShelved" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_MaxTimeShelved: - return "DiscreteAlarmType_MaxTimeShelved" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassId: - return "DiscreteAlarmType_ConditionClassId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionClassName: - return "DiscreteAlarmType_ConditionClassName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_InputNode: - return "DiscreteAlarmType_InputNode" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime: - return "DiscreteAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionRefresh2_InputArguments: - return "DiscreteAlarmType_ConditionRefresh2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassId: - return "DiscreteAlarmType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ConditionSubClassName: - return "DiscreteAlarmType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState: - return "DiscreteAlarmType_OutOfServiceState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Id: - return "DiscreteAlarmType_OutOfServiceState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Name: - return "DiscreteAlarmType_OutOfServiceState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_Number: - return "DiscreteAlarmType_OutOfServiceState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName: - return "DiscreteAlarmType_OutOfServiceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TransitionTime: - return "DiscreteAlarmType_OutOfServiceState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime: - return "DiscreteAlarmType_OutOfServiceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_TrueState: - return "DiscreteAlarmType_OutOfServiceState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OutOfServiceState_FalseState: - return "DiscreteAlarmType_OutOfServiceState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState: - return "DiscreteAlarmType_SilenceState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Id: - return "DiscreteAlarmType_SilenceState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Name: - return "DiscreteAlarmType_SilenceState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_Number: - return "DiscreteAlarmType_SilenceState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveDisplayName: - return "DiscreteAlarmType_SilenceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TransitionTime: - return "DiscreteAlarmType_SilenceState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_EffectiveTransitionTime: - return "DiscreteAlarmType_SilenceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_TrueState: - return "DiscreteAlarmType_SilenceState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SilenceState_FalseState: - return "DiscreteAlarmType_SilenceState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleEnabled: - return "DiscreteAlarmType_AudibleEnabled" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound: - return "DiscreteAlarmType_AudibleSound" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OnDelay: - return "DiscreteAlarmType_OnDelay" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_OffDelay: - return "DiscreteAlarmType_OffDelay" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_FirstInGroupFlag: - return "DiscreteAlarmType_FirstInGroupFlag" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmTime: - return "DiscreteAlarmType_ReAlarmTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ReAlarmRepeatCount: - return "DiscreteAlarmType_ReAlarmRepeatCount" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableStates: - return "DiscreteAlarmType_ShelvingState_AvailableStates" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_AvailableTransitions: - return "DiscreteAlarmType_ShelvingState_AvailableTransitions" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_ListId: - return "DiscreteAlarmType_AudibleSound_ListId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_AgencyId: - return "DiscreteAlarmType_AudibleSound_AgencyId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_AudibleSound_VersionId: - return "DiscreteAlarmType_AudibleSound_VersionId" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState: - return "DiscreteAlarmType_LatchedState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Id: - return "DiscreteAlarmType_LatchedState_Id" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Name: - return "DiscreteAlarmType_LatchedState_Name" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_Number: - return "DiscreteAlarmType_LatchedState_Number" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveDisplayName: - return "DiscreteAlarmType_LatchedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TransitionTime: - return "DiscreteAlarmType_LatchedState_TransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_EffectiveTransitionTime: - return "DiscreteAlarmType_LatchedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_TrueState: - return "DiscreteAlarmType_LatchedState_TrueState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_LatchedState_FalseState: - return "DiscreteAlarmType_LatchedState_FalseState" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Suppress2_InputArguments: - return "DiscreteAlarmType_Suppress2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Unsuppress2_InputArguments: - return "DiscreteAlarmType_Unsuppress2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_RemoveFromService2_InputArguments: - return "DiscreteAlarmType_RemoveFromService2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_PlaceInService2_InputArguments: - return "DiscreteAlarmType_PlaceInService2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_Reset2_InputArguments: - return "DiscreteAlarmType_Reset2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments: - return "DiscreteAlarmType_ShelvingState_TimedShelve2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments: - return "DiscreteAlarmType_ShelvingState_Unshelve2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments: - return "DiscreteAlarmType_ShelvingState_OneShotShelve2_InputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_GetGroupMemberships_OutputArguments: - return "DiscreteAlarmType_GetGroupMemberships_OutputArguments" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteAlarmType_SupportsFilteredRetain: - return "DiscreteAlarmType_SupportsFilteredRetain" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_Definition: - return "DiscreteItemType_Definition" - case OpcuaNodeIdServicesVariableDiscrete_DiscreteItemType_ValuePrecision: - return "DiscreteItemType_ValuePrecision" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableDiscrete) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInitial.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInitial.go deleted file mode 100644 index e1c868ca524..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInitial.go +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableInitial is an enum -type OpcuaNodeIdServicesVariableInitial int32 - -type IOpcuaNodeIdServicesVariableInitial interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableInitial_InitialStateType_StateNumber OpcuaNodeIdServicesVariableInitial = 3736 -) - -var OpcuaNodeIdServicesVariableInitialValues []OpcuaNodeIdServicesVariableInitial - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableInitialValues = []OpcuaNodeIdServicesVariableInitial{ - OpcuaNodeIdServicesVariableInitial_InitialStateType_StateNumber, - } -} - -func OpcuaNodeIdServicesVariableInitialByValue(value int32) (enum OpcuaNodeIdServicesVariableInitial, ok bool) { - switch value { - case 3736: - return OpcuaNodeIdServicesVariableInitial_InitialStateType_StateNumber, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableInitialByName(value string) (enum OpcuaNodeIdServicesVariableInitial, ok bool) { - switch value { - case "InitialStateType_StateNumber": - return OpcuaNodeIdServicesVariableInitial_InitialStateType_StateNumber, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableInitialKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableInitialValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableInitial(structType any) OpcuaNodeIdServicesVariableInitial { - castFunc := func(typ any) OpcuaNodeIdServicesVariableInitial { - if sOpcuaNodeIdServicesVariableInitial, ok := typ.(OpcuaNodeIdServicesVariableInitial); ok { - return sOpcuaNodeIdServicesVariableInitial - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableInitial) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableInitial) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableInitialParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableInitial, error) { - return OpcuaNodeIdServicesVariableInitialParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableInitialParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableInitial, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableInitial", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableInitial") - } - if enum, ok := OpcuaNodeIdServicesVariableInitialByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableInitial") - return OpcuaNodeIdServicesVariableInitial(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableInitial) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableInitial) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableInitial", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableInitial) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableInitial_InitialStateType_StateNumber: - return "InitialStateType_StateNumber" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableInitial) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInstrument.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInstrument.go deleted file mode 100644 index 62beafea9ac..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableInstrument.go +++ /dev/null @@ -1,1247 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableInstrument is an enum -type OpcuaNodeIdServicesVariableInstrument int32 - -type IOpcuaNodeIdServicesVariableInstrument interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventId OpcuaNodeIdServicesVariableInstrument = 18348 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventType OpcuaNodeIdServicesVariableInstrument = 18349 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceNode OpcuaNodeIdServicesVariableInstrument = 18350 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceName OpcuaNodeIdServicesVariableInstrument = 18351 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Time OpcuaNodeIdServicesVariableInstrument = 18352 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReceiveTime OpcuaNodeIdServicesVariableInstrument = 18353 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LocalTime OpcuaNodeIdServicesVariableInstrument = 18354 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Message OpcuaNodeIdServicesVariableInstrument = 18355 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Severity OpcuaNodeIdServicesVariableInstrument = 18356 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassId OpcuaNodeIdServicesVariableInstrument = 18357 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassName OpcuaNodeIdServicesVariableInstrument = 18358 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassId OpcuaNodeIdServicesVariableInstrument = 18359 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassName OpcuaNodeIdServicesVariableInstrument = 18360 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionName OpcuaNodeIdServicesVariableInstrument = 18361 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_BranchId OpcuaNodeIdServicesVariableInstrument = 18362 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Retain OpcuaNodeIdServicesVariableInstrument = 18363 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState OpcuaNodeIdServicesVariableInstrument = 18364 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Id OpcuaNodeIdServicesVariableInstrument = 18365 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Name OpcuaNodeIdServicesVariableInstrument = 18366 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Number OpcuaNodeIdServicesVariableInstrument = 18367 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18368 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18369 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18370 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TrueState OpcuaNodeIdServicesVariableInstrument = 18371 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_FalseState OpcuaNodeIdServicesVariableInstrument = 18372 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality OpcuaNodeIdServicesVariableInstrument = 18373 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality_SourceTimestamp OpcuaNodeIdServicesVariableInstrument = 18374 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity OpcuaNodeIdServicesVariableInstrument = 18375 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp OpcuaNodeIdServicesVariableInstrument = 18376 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment OpcuaNodeIdServicesVariableInstrument = 18377 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment_SourceTimestamp OpcuaNodeIdServicesVariableInstrument = 18378 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ClientUserId OpcuaNodeIdServicesVariableInstrument = 18379 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AddComment_InputArguments OpcuaNodeIdServicesVariableInstrument = 18383 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments OpcuaNodeIdServicesVariableInstrument = 18385 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments OpcuaNodeIdServicesVariableInstrument = 18387 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState OpcuaNodeIdServicesVariableInstrument = 18388 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Id OpcuaNodeIdServicesVariableInstrument = 18389 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Name OpcuaNodeIdServicesVariableInstrument = 18390 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Number OpcuaNodeIdServicesVariableInstrument = 18391 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18392 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18393 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18394 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TrueState OpcuaNodeIdServicesVariableInstrument = 18395 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_FalseState OpcuaNodeIdServicesVariableInstrument = 18396 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState OpcuaNodeIdServicesVariableInstrument = 18397 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Id OpcuaNodeIdServicesVariableInstrument = 18398 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Name OpcuaNodeIdServicesVariableInstrument = 18399 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Number OpcuaNodeIdServicesVariableInstrument = 18400 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18401 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18402 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18403 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TrueState OpcuaNodeIdServicesVariableInstrument = 18404 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_FalseState OpcuaNodeIdServicesVariableInstrument = 18405 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Acknowledge_InputArguments OpcuaNodeIdServicesVariableInstrument = 18407 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Confirm_InputArguments OpcuaNodeIdServicesVariableInstrument = 18409 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState OpcuaNodeIdServicesVariableInstrument = 18410 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Id OpcuaNodeIdServicesVariableInstrument = 18411 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Name OpcuaNodeIdServicesVariableInstrument = 18412 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Number OpcuaNodeIdServicesVariableInstrument = 18413 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18414 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18415 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18416 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TrueState OpcuaNodeIdServicesVariableInstrument = 18417 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_FalseState OpcuaNodeIdServicesVariableInstrument = 18418 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_InputNode OpcuaNodeIdServicesVariableInstrument = 18419 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState OpcuaNodeIdServicesVariableInstrument = 18420 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Id OpcuaNodeIdServicesVariableInstrument = 18421 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Name OpcuaNodeIdServicesVariableInstrument = 18422 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Number OpcuaNodeIdServicesVariableInstrument = 18423 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18424 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18425 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18426 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TrueState OpcuaNodeIdServicesVariableInstrument = 18427 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_FalseState OpcuaNodeIdServicesVariableInstrument = 18428 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState OpcuaNodeIdServicesVariableInstrument = 18429 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Id OpcuaNodeIdServicesVariableInstrument = 18430 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Name OpcuaNodeIdServicesVariableInstrument = 18431 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Number OpcuaNodeIdServicesVariableInstrument = 18432 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18433 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18434 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18435 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState OpcuaNodeIdServicesVariableInstrument = 18436 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState OpcuaNodeIdServicesVariableInstrument = 18437 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState OpcuaNodeIdServicesVariableInstrument = 18439 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id OpcuaNodeIdServicesVariableInstrument = 18440 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name OpcuaNodeIdServicesVariableInstrument = 18441 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number OpcuaNodeIdServicesVariableInstrument = 18442 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18443 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition OpcuaNodeIdServicesVariableInstrument = 18444 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id OpcuaNodeIdServicesVariableInstrument = 18445 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name OpcuaNodeIdServicesVariableInstrument = 18446 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number OpcuaNodeIdServicesVariableInstrument = 18447 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18448 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18449 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates OpcuaNodeIdServicesVariableInstrument = 18450 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions OpcuaNodeIdServicesVariableInstrument = 18451 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime OpcuaNodeIdServicesVariableInstrument = 18452 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments OpcuaNodeIdServicesVariableInstrument = 18454 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedOrShelved OpcuaNodeIdServicesVariableInstrument = 18457 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_MaxTimeShelved OpcuaNodeIdServicesVariableInstrument = 18458 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleEnabled OpcuaNodeIdServicesVariableInstrument = 18459 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound OpcuaNodeIdServicesVariableInstrument = 18460 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_ListId OpcuaNodeIdServicesVariableInstrument = 18461 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_AgencyId OpcuaNodeIdServicesVariableInstrument = 18462 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_VersionId OpcuaNodeIdServicesVariableInstrument = 18463 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState OpcuaNodeIdServicesVariableInstrument = 18464 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Id OpcuaNodeIdServicesVariableInstrument = 18465 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Name OpcuaNodeIdServicesVariableInstrument = 18466 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Number OpcuaNodeIdServicesVariableInstrument = 18467 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18468 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18469 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18470 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TrueState OpcuaNodeIdServicesVariableInstrument = 18471 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_FalseState OpcuaNodeIdServicesVariableInstrument = 18472 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OnDelay OpcuaNodeIdServicesVariableInstrument = 18473 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OffDelay OpcuaNodeIdServicesVariableInstrument = 18474 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_FirstInGroupFlag OpcuaNodeIdServicesVariableInstrument = 18475 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState OpcuaNodeIdServicesVariableInstrument = 18477 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Id OpcuaNodeIdServicesVariableInstrument = 18478 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Name OpcuaNodeIdServicesVariableInstrument = 18479 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Number OpcuaNodeIdServicesVariableInstrument = 18480 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName OpcuaNodeIdServicesVariableInstrument = 18481 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TransitionTime OpcuaNodeIdServicesVariableInstrument = 18482 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableInstrument = 18483 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TrueState OpcuaNodeIdServicesVariableInstrument = 18484 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_FalseState OpcuaNodeIdServicesVariableInstrument = 18485 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmTime OpcuaNodeIdServicesVariableInstrument = 18487 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmRepeatCount OpcuaNodeIdServicesVariableInstrument = 18488 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_NormalState OpcuaNodeIdServicesVariableInstrument = 18495 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Suppress2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24469 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24471 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24473 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24475 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Reset2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24477 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24939 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24941 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments OpcuaNodeIdServicesVariableInstrument = 24943 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments OpcuaNodeIdServicesVariableInstrument = 25172 - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SupportsFilteredRetain OpcuaNodeIdServicesVariableInstrument = 32240 -) - -var OpcuaNodeIdServicesVariableInstrumentValues []OpcuaNodeIdServicesVariableInstrument - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableInstrumentValues = []OpcuaNodeIdServicesVariableInstrument{ - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventType, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceNode, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Time, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReceiveTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LocalTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Message, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Severity, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_BranchId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Retain, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality_SourceTimestamp, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment_SourceTimestamp, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ClientUserId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AddComment_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Acknowledge_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Confirm_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_InputNode, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedOrShelved, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_MaxTimeShelved, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleEnabled, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_ListId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_AgencyId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_VersionId, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OnDelay, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OffDelay, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_FirstInGroupFlag, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Id, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Name, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Number, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TrueState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_FalseState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmTime, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmRepeatCount, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_NormalState, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Suppress2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Reset2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments, - OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SupportsFilteredRetain, - } -} - -func OpcuaNodeIdServicesVariableInstrumentByValue(value int32) (enum OpcuaNodeIdServicesVariableInstrument, ok bool) { - switch value { - case 18348: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventId, true - case 18349: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventType, true - case 18350: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceNode, true - case 18351: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceName, true - case 18352: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Time, true - case 18353: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReceiveTime, true - case 18354: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LocalTime, true - case 18355: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Message, true - case 18356: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Severity, true - case 18357: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassId, true - case 18358: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassName, true - case 18359: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassId, true - case 18360: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassName, true - case 18361: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionName, true - case 18362: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_BranchId, true - case 18363: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Retain, true - case 18364: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState, true - case 18365: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Id, true - case 18366: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Name, true - case 18367: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Number, true - case 18368: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName, true - case 18369: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TransitionTime, true - case 18370: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime, true - case 18371: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TrueState, true - case 18372: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_FalseState, true - case 18373: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality, true - case 18374: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality_SourceTimestamp, true - case 18375: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity, true - case 18376: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp, true - case 18377: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment, true - case 18378: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment_SourceTimestamp, true - case 18379: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ClientUserId, true - case 18383: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AddComment_InputArguments, true - case 18385: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments, true - case 18387: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments, true - case 18388: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState, true - case 18389: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Id, true - case 18390: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Name, true - case 18391: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Number, true - case 18392: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName, true - case 18393: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TransitionTime, true - case 18394: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime, true - case 18395: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TrueState, true - case 18396: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_FalseState, true - case 18397: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState, true - case 18398: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Id, true - case 18399: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Name, true - case 18400: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Number, true - case 18401: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName, true - case 18402: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime, true - case 18403: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime, true - case 18404: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TrueState, true - case 18405: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_FalseState, true - case 18407: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Acknowledge_InputArguments, true - case 18409: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Confirm_InputArguments, true - case 18410: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState, true - case 18411: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Id, true - case 18412: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Name, true - case 18413: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Number, true - case 18414: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName, true - case 18415: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TransitionTime, true - case 18416: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime, true - case 18417: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TrueState, true - case 18418: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_FalseState, true - case 18419: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_InputNode, true - case 18420: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState, true - case 18421: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Id, true - case 18422: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Name, true - case 18423: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Number, true - case 18424: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName, true - case 18425: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime, true - case 18426: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime, true - case 18427: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TrueState, true - case 18428: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_FalseState, true - case 18429: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState, true - case 18430: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Id, true - case 18431: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Name, true - case 18432: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Number, true - case 18433: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName, true - case 18434: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime, true - case 18435: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case 18436: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState, true - case 18437: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState, true - case 18439: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState, true - case 18440: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id, true - case 18441: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name, true - case 18442: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number, true - case 18443: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case 18444: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition, true - case 18445: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id, true - case 18446: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name, true - case 18447: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number, true - case 18448: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime, true - case 18449: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case 18450: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates, true - case 18451: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions, true - case 18452: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime, true - case 18454: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments, true - case 18457: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedOrShelved, true - case 18458: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_MaxTimeShelved, true - case 18459: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleEnabled, true - case 18460: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound, true - case 18461: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_ListId, true - case 18462: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_AgencyId, true - case 18463: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_VersionId, true - case 18464: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState, true - case 18465: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Id, true - case 18466: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Name, true - case 18467: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Number, true - case 18468: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName, true - case 18469: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TransitionTime, true - case 18470: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime, true - case 18471: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TrueState, true - case 18472: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_FalseState, true - case 18473: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OnDelay, true - case 18474: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OffDelay, true - case 18475: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_FirstInGroupFlag, true - case 18477: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState, true - case 18478: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Id, true - case 18479: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Name, true - case 18480: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Number, true - case 18481: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName, true - case 18482: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TransitionTime, true - case 18483: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime, true - case 18484: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TrueState, true - case 18485: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_FalseState, true - case 18487: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmTime, true - case 18488: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmRepeatCount, true - case 18495: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_NormalState, true - case 24469: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Suppress2_InputArguments, true - case 24471: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments, true - case 24473: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments, true - case 24475: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments, true - case 24477: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Reset2_InputArguments, true - case 24939: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case 24941: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments, true - case 24943: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case 25172: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments, true - case 32240: - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SupportsFilteredRetain, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableInstrumentByName(value string) (enum OpcuaNodeIdServicesVariableInstrument, ok bool) { - switch value { - case "InstrumentDiagnosticAlarmType_EventId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventId, true - case "InstrumentDiagnosticAlarmType_EventType": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventType, true - case "InstrumentDiagnosticAlarmType_SourceNode": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceNode, true - case "InstrumentDiagnosticAlarmType_SourceName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceName, true - case "InstrumentDiagnosticAlarmType_Time": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Time, true - case "InstrumentDiagnosticAlarmType_ReceiveTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReceiveTime, true - case "InstrumentDiagnosticAlarmType_LocalTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LocalTime, true - case "InstrumentDiagnosticAlarmType_Message": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Message, true - case "InstrumentDiagnosticAlarmType_Severity": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Severity, true - case "InstrumentDiagnosticAlarmType_ConditionClassId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassId, true - case "InstrumentDiagnosticAlarmType_ConditionClassName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassName, true - case "InstrumentDiagnosticAlarmType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassId, true - case "InstrumentDiagnosticAlarmType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassName, true - case "InstrumentDiagnosticAlarmType_ConditionName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionName, true - case "InstrumentDiagnosticAlarmType_BranchId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_BranchId, true - case "InstrumentDiagnosticAlarmType_Retain": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Retain, true - case "InstrumentDiagnosticAlarmType_EnabledState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState, true - case "InstrumentDiagnosticAlarmType_EnabledState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Id, true - case "InstrumentDiagnosticAlarmType_EnabledState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Name, true - case "InstrumentDiagnosticAlarmType_EnabledState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Number, true - case "InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_EnabledState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_EnabledState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TrueState, true - case "InstrumentDiagnosticAlarmType_EnabledState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_FalseState, true - case "InstrumentDiagnosticAlarmType_Quality": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality, true - case "InstrumentDiagnosticAlarmType_Quality_SourceTimestamp": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality_SourceTimestamp, true - case "InstrumentDiagnosticAlarmType_LastSeverity": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity, true - case "InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp, true - case "InstrumentDiagnosticAlarmType_Comment": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment, true - case "InstrumentDiagnosticAlarmType_Comment_SourceTimestamp": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment_SourceTimestamp, true - case "InstrumentDiagnosticAlarmType_ClientUserId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ClientUserId, true - case "InstrumentDiagnosticAlarmType_AddComment_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AddComment_InputArguments, true - case "InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments, true - case "InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments, true - case "InstrumentDiagnosticAlarmType_AckedState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState, true - case "InstrumentDiagnosticAlarmType_AckedState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Id, true - case "InstrumentDiagnosticAlarmType_AckedState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Name, true - case "InstrumentDiagnosticAlarmType_AckedState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Number, true - case "InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_AckedState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_AckedState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TrueState, true - case "InstrumentDiagnosticAlarmType_AckedState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_FalseState, true - case "InstrumentDiagnosticAlarmType_ConfirmedState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Id, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Name, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Number, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TrueState, true - case "InstrumentDiagnosticAlarmType_ConfirmedState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_FalseState, true - case "InstrumentDiagnosticAlarmType_Acknowledge_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Acknowledge_InputArguments, true - case "InstrumentDiagnosticAlarmType_Confirm_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Confirm_InputArguments, true - case "InstrumentDiagnosticAlarmType_ActiveState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState, true - case "InstrumentDiagnosticAlarmType_ActiveState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Id, true - case "InstrumentDiagnosticAlarmType_ActiveState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Name, true - case "InstrumentDiagnosticAlarmType_ActiveState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Number, true - case "InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_ActiveState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_ActiveState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TrueState, true - case "InstrumentDiagnosticAlarmType_ActiveState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_FalseState, true - case "InstrumentDiagnosticAlarmType_InputNode": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_InputNode, true - case "InstrumentDiagnosticAlarmType_SuppressedState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState, true - case "InstrumentDiagnosticAlarmType_SuppressedState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Id, true - case "InstrumentDiagnosticAlarmType_SuppressedState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Name, true - case "InstrumentDiagnosticAlarmType_SuppressedState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Number, true - case "InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_SuppressedState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TrueState, true - case "InstrumentDiagnosticAlarmType_SuppressedState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_FalseState, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Id, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Name, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Number, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState, true - case "InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState, true - case "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState, true - case "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id, true - case "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name, true - case "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number, true - case "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime, true - case "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates, true - case "InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions, true - case "InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime, true - case "InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments, true - case "InstrumentDiagnosticAlarmType_SuppressedOrShelved": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedOrShelved, true - case "InstrumentDiagnosticAlarmType_MaxTimeShelved": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_MaxTimeShelved, true - case "InstrumentDiagnosticAlarmType_AudibleEnabled": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleEnabled, true - case "InstrumentDiagnosticAlarmType_AudibleSound": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound, true - case "InstrumentDiagnosticAlarmType_AudibleSound_ListId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_ListId, true - case "InstrumentDiagnosticAlarmType_AudibleSound_AgencyId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_AgencyId, true - case "InstrumentDiagnosticAlarmType_AudibleSound_VersionId": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_VersionId, true - case "InstrumentDiagnosticAlarmType_SilenceState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState, true - case "InstrumentDiagnosticAlarmType_SilenceState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Id, true - case "InstrumentDiagnosticAlarmType_SilenceState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Name, true - case "InstrumentDiagnosticAlarmType_SilenceState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Number, true - case "InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_SilenceState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_SilenceState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TrueState, true - case "InstrumentDiagnosticAlarmType_SilenceState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_FalseState, true - case "InstrumentDiagnosticAlarmType_OnDelay": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OnDelay, true - case "InstrumentDiagnosticAlarmType_OffDelay": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OffDelay, true - case "InstrumentDiagnosticAlarmType_FirstInGroupFlag": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_FirstInGroupFlag, true - case "InstrumentDiagnosticAlarmType_LatchedState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState, true - case "InstrumentDiagnosticAlarmType_LatchedState_Id": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Id, true - case "InstrumentDiagnosticAlarmType_LatchedState_Name": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Name, true - case "InstrumentDiagnosticAlarmType_LatchedState_Number": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Number, true - case "InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName, true - case "InstrumentDiagnosticAlarmType_LatchedState_TransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TransitionTime, true - case "InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime, true - case "InstrumentDiagnosticAlarmType_LatchedState_TrueState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TrueState, true - case "InstrumentDiagnosticAlarmType_LatchedState_FalseState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_FalseState, true - case "InstrumentDiagnosticAlarmType_ReAlarmTime": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmTime, true - case "InstrumentDiagnosticAlarmType_ReAlarmRepeatCount": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmRepeatCount, true - case "InstrumentDiagnosticAlarmType_NormalState": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_NormalState, true - case "InstrumentDiagnosticAlarmType_Suppress2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Suppress2_InputArguments, true - case "InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments, true - case "InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments, true - case "InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments, true - case "InstrumentDiagnosticAlarmType_Reset2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Reset2_InputArguments, true - case "InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case "InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments, true - case "InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case "InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments, true - case "InstrumentDiagnosticAlarmType_SupportsFilteredRetain": - return OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SupportsFilteredRetain, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableInstrumentKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableInstrumentValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableInstrument(structType any) OpcuaNodeIdServicesVariableInstrument { - castFunc := func(typ any) OpcuaNodeIdServicesVariableInstrument { - if sOpcuaNodeIdServicesVariableInstrument, ok := typ.(OpcuaNodeIdServicesVariableInstrument); ok { - return sOpcuaNodeIdServicesVariableInstrument - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableInstrument) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableInstrument) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableInstrumentParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableInstrument, error) { - return OpcuaNodeIdServicesVariableInstrumentParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableInstrumentParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableInstrument, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableInstrument", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableInstrument") - } - if enum, ok := OpcuaNodeIdServicesVariableInstrumentByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableInstrument") - return OpcuaNodeIdServicesVariableInstrument(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableInstrument) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableInstrument) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableInstrument", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableInstrument) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventId: - return "InstrumentDiagnosticAlarmType_EventId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EventType: - return "InstrumentDiagnosticAlarmType_EventType" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceNode: - return "InstrumentDiagnosticAlarmType_SourceNode" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SourceName: - return "InstrumentDiagnosticAlarmType_SourceName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Time: - return "InstrumentDiagnosticAlarmType_Time" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReceiveTime: - return "InstrumentDiagnosticAlarmType_ReceiveTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LocalTime: - return "InstrumentDiagnosticAlarmType_LocalTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Message: - return "InstrumentDiagnosticAlarmType_Message" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Severity: - return "InstrumentDiagnosticAlarmType_Severity" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassId: - return "InstrumentDiagnosticAlarmType_ConditionClassId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionClassName: - return "InstrumentDiagnosticAlarmType_ConditionClassName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassId: - return "InstrumentDiagnosticAlarmType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionSubClassName: - return "InstrumentDiagnosticAlarmType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionName: - return "InstrumentDiagnosticAlarmType_ConditionName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_BranchId: - return "InstrumentDiagnosticAlarmType_BranchId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Retain: - return "InstrumentDiagnosticAlarmType_Retain" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState: - return "InstrumentDiagnosticAlarmType_EnabledState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Id: - return "InstrumentDiagnosticAlarmType_EnabledState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Name: - return "InstrumentDiagnosticAlarmType_EnabledState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_Number: - return "InstrumentDiagnosticAlarmType_EnabledState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_EnabledState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TransitionTime: - return "InstrumentDiagnosticAlarmType_EnabledState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_EnabledState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_TrueState: - return "InstrumentDiagnosticAlarmType_EnabledState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_EnabledState_FalseState: - return "InstrumentDiagnosticAlarmType_EnabledState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality: - return "InstrumentDiagnosticAlarmType_Quality" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Quality_SourceTimestamp: - return "InstrumentDiagnosticAlarmType_Quality_SourceTimestamp" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity: - return "InstrumentDiagnosticAlarmType_LastSeverity" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp: - return "InstrumentDiagnosticAlarmType_LastSeverity_SourceTimestamp" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment: - return "InstrumentDiagnosticAlarmType_Comment" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Comment_SourceTimestamp: - return "InstrumentDiagnosticAlarmType_Comment_SourceTimestamp" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ClientUserId: - return "InstrumentDiagnosticAlarmType_ClientUserId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AddComment_InputArguments: - return "InstrumentDiagnosticAlarmType_AddComment_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments: - return "InstrumentDiagnosticAlarmType_ConditionRefresh_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments: - return "InstrumentDiagnosticAlarmType_ConditionRefresh2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState: - return "InstrumentDiagnosticAlarmType_AckedState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Id: - return "InstrumentDiagnosticAlarmType_AckedState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Name: - return "InstrumentDiagnosticAlarmType_AckedState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_Number: - return "InstrumentDiagnosticAlarmType_AckedState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_AckedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TransitionTime: - return "InstrumentDiagnosticAlarmType_AckedState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_AckedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_TrueState: - return "InstrumentDiagnosticAlarmType_AckedState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AckedState_FalseState: - return "InstrumentDiagnosticAlarmType_AckedState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState: - return "InstrumentDiagnosticAlarmType_ConfirmedState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Id: - return "InstrumentDiagnosticAlarmType_ConfirmedState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Name: - return "InstrumentDiagnosticAlarmType_ConfirmedState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_Number: - return "InstrumentDiagnosticAlarmType_ConfirmedState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime: - return "InstrumentDiagnosticAlarmType_ConfirmedState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_ConfirmedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_TrueState: - return "InstrumentDiagnosticAlarmType_ConfirmedState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ConfirmedState_FalseState: - return "InstrumentDiagnosticAlarmType_ConfirmedState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Acknowledge_InputArguments: - return "InstrumentDiagnosticAlarmType_Acknowledge_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Confirm_InputArguments: - return "InstrumentDiagnosticAlarmType_Confirm_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState: - return "InstrumentDiagnosticAlarmType_ActiveState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Id: - return "InstrumentDiagnosticAlarmType_ActiveState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Name: - return "InstrumentDiagnosticAlarmType_ActiveState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_Number: - return "InstrumentDiagnosticAlarmType_ActiveState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_ActiveState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TransitionTime: - return "InstrumentDiagnosticAlarmType_ActiveState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_ActiveState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_TrueState: - return "InstrumentDiagnosticAlarmType_ActiveState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ActiveState_FalseState: - return "InstrumentDiagnosticAlarmType_ActiveState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_InputNode: - return "InstrumentDiagnosticAlarmType_InputNode" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState: - return "InstrumentDiagnosticAlarmType_SuppressedState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Id: - return "InstrumentDiagnosticAlarmType_SuppressedState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Name: - return "InstrumentDiagnosticAlarmType_SuppressedState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_Number: - return "InstrumentDiagnosticAlarmType_SuppressedState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_SuppressedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime: - return "InstrumentDiagnosticAlarmType_SuppressedState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_SuppressedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_TrueState: - return "InstrumentDiagnosticAlarmType_SuppressedState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedState_FalseState: - return "InstrumentDiagnosticAlarmType_SuppressedState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState: - return "InstrumentDiagnosticAlarmType_OutOfServiceState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Id: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Name: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_Number: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState: - return "InstrumentDiagnosticAlarmType_OutOfServiceState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState: - return "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id: - return "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name: - return "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number: - return "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_ShelvingState_CurrentState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates: - return "InstrumentDiagnosticAlarmType_ShelvingState_AvailableStates" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions: - return "InstrumentDiagnosticAlarmType_ShelvingState_AvailableTransitions" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime: - return "InstrumentDiagnosticAlarmType_ShelvingState_UnshelveTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments: - return "InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SuppressedOrShelved: - return "InstrumentDiagnosticAlarmType_SuppressedOrShelved" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_MaxTimeShelved: - return "InstrumentDiagnosticAlarmType_MaxTimeShelved" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleEnabled: - return "InstrumentDiagnosticAlarmType_AudibleEnabled" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound: - return "InstrumentDiagnosticAlarmType_AudibleSound" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_ListId: - return "InstrumentDiagnosticAlarmType_AudibleSound_ListId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_AgencyId: - return "InstrumentDiagnosticAlarmType_AudibleSound_AgencyId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_AudibleSound_VersionId: - return "InstrumentDiagnosticAlarmType_AudibleSound_VersionId" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState: - return "InstrumentDiagnosticAlarmType_SilenceState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Id: - return "InstrumentDiagnosticAlarmType_SilenceState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Name: - return "InstrumentDiagnosticAlarmType_SilenceState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_Number: - return "InstrumentDiagnosticAlarmType_SilenceState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_SilenceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TransitionTime: - return "InstrumentDiagnosticAlarmType_SilenceState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_SilenceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_TrueState: - return "InstrumentDiagnosticAlarmType_SilenceState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SilenceState_FalseState: - return "InstrumentDiagnosticAlarmType_SilenceState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OnDelay: - return "InstrumentDiagnosticAlarmType_OnDelay" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_OffDelay: - return "InstrumentDiagnosticAlarmType_OffDelay" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_FirstInGroupFlag: - return "InstrumentDiagnosticAlarmType_FirstInGroupFlag" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState: - return "InstrumentDiagnosticAlarmType_LatchedState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Id: - return "InstrumentDiagnosticAlarmType_LatchedState_Id" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Name: - return "InstrumentDiagnosticAlarmType_LatchedState_Name" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_Number: - return "InstrumentDiagnosticAlarmType_LatchedState_Number" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName: - return "InstrumentDiagnosticAlarmType_LatchedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TransitionTime: - return "InstrumentDiagnosticAlarmType_LatchedState_TransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime: - return "InstrumentDiagnosticAlarmType_LatchedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_TrueState: - return "InstrumentDiagnosticAlarmType_LatchedState_TrueState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_LatchedState_FalseState: - return "InstrumentDiagnosticAlarmType_LatchedState_FalseState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmTime: - return "InstrumentDiagnosticAlarmType_ReAlarmTime" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ReAlarmRepeatCount: - return "InstrumentDiagnosticAlarmType_ReAlarmRepeatCount" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_NormalState: - return "InstrumentDiagnosticAlarmType_NormalState" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Suppress2_InputArguments: - return "InstrumentDiagnosticAlarmType_Suppress2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments: - return "InstrumentDiagnosticAlarmType_Unsuppress2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments: - return "InstrumentDiagnosticAlarmType_RemoveFromService2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments: - return "InstrumentDiagnosticAlarmType_PlaceInService2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_Reset2_InputArguments: - return "InstrumentDiagnosticAlarmType_Reset2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments: - return "InstrumentDiagnosticAlarmType_ShelvingState_TimedShelve2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments: - return "InstrumentDiagnosticAlarmType_ShelvingState_Unshelve2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments: - return "InstrumentDiagnosticAlarmType_ShelvingState_OneShotShelve2_InputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments: - return "InstrumentDiagnosticAlarmType_GetGroupMemberships_OutputArguments" - case OpcuaNodeIdServicesVariableInstrument_InstrumentDiagnosticAlarmType_SupportsFilteredRetain: - return "InstrumentDiagnosticAlarmType_SupportsFilteredRetain" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableInstrument) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableRefresh.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableRefresh.go deleted file mode 100644 index 36a93aae005..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableRefresh.go +++ /dev/null @@ -1,447 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableRefresh is an enum -type OpcuaNodeIdServicesVariableRefresh int32 - -type IOpcuaNodeIdServicesVariableRefresh interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventId OpcuaNodeIdServicesVariableRefresh = 3969 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventType OpcuaNodeIdServicesVariableRefresh = 3970 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceNode OpcuaNodeIdServicesVariableRefresh = 3971 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceName OpcuaNodeIdServicesVariableRefresh = 3972 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Time OpcuaNodeIdServicesVariableRefresh = 3973 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ReceiveTime OpcuaNodeIdServicesVariableRefresh = 3974 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_LocalTime OpcuaNodeIdServicesVariableRefresh = 3975 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Message OpcuaNodeIdServicesVariableRefresh = 3976 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Severity OpcuaNodeIdServicesVariableRefresh = 3977 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventId OpcuaNodeIdServicesVariableRefresh = 3978 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventType OpcuaNodeIdServicesVariableRefresh = 3979 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceNode OpcuaNodeIdServicesVariableRefresh = 3980 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceName OpcuaNodeIdServicesVariableRefresh = 3981 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Time OpcuaNodeIdServicesVariableRefresh = 3982 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ReceiveTime OpcuaNodeIdServicesVariableRefresh = 3983 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_LocalTime OpcuaNodeIdServicesVariableRefresh = 3984 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Message OpcuaNodeIdServicesVariableRefresh = 3985 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Severity OpcuaNodeIdServicesVariableRefresh = 3986 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventId OpcuaNodeIdServicesVariableRefresh = 3987 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventType OpcuaNodeIdServicesVariableRefresh = 3988 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceNode OpcuaNodeIdServicesVariableRefresh = 3989 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceName OpcuaNodeIdServicesVariableRefresh = 3990 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Time OpcuaNodeIdServicesVariableRefresh = 3991 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ReceiveTime OpcuaNodeIdServicesVariableRefresh = 3992 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_LocalTime OpcuaNodeIdServicesVariableRefresh = 3993 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Message OpcuaNodeIdServicesVariableRefresh = 3994 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Severity OpcuaNodeIdServicesVariableRefresh = 3995 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassId OpcuaNodeIdServicesVariableRefresh = 31975 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassName OpcuaNodeIdServicesVariableRefresh = 31976 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassId OpcuaNodeIdServicesVariableRefresh = 31977 - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassName OpcuaNodeIdServicesVariableRefresh = 31978 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassId OpcuaNodeIdServicesVariableRefresh = 31979 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassName OpcuaNodeIdServicesVariableRefresh = 31980 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassId OpcuaNodeIdServicesVariableRefresh = 31981 - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassName OpcuaNodeIdServicesVariableRefresh = 31982 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassId OpcuaNodeIdServicesVariableRefresh = 31983 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassName OpcuaNodeIdServicesVariableRefresh = 31984 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassId OpcuaNodeIdServicesVariableRefresh = 31985 - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassName OpcuaNodeIdServicesVariableRefresh = 31986 -) - -var OpcuaNodeIdServicesVariableRefreshValues []OpcuaNodeIdServicesVariableRefresh - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableRefreshValues = []OpcuaNodeIdServicesVariableRefresh{ - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventId, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventType, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceNode, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceName, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Time, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ReceiveTime, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_LocalTime, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Message, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Severity, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventId, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventType, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceNode, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceName, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Time, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ReceiveTime, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_LocalTime, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Message, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Severity, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventId, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventType, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceNode, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceName, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Time, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ReceiveTime, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_LocalTime, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Message, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Severity, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassName, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassName, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassName, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassName, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassName, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassId, - OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassName, - } -} - -func OpcuaNodeIdServicesVariableRefreshByValue(value int32) (enum OpcuaNodeIdServicesVariableRefresh, ok bool) { - switch value { - case 31975: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassId, true - case 31976: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassName, true - case 31977: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassId, true - case 31978: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassName, true - case 31979: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassId, true - case 31980: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassName, true - case 31981: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassId, true - case 31982: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassName, true - case 31983: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassId, true - case 31984: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassName, true - case 31985: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassId, true - case 31986: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassName, true - case 3969: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventId, true - case 3970: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventType, true - case 3971: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceNode, true - case 3972: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceName, true - case 3973: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Time, true - case 3974: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ReceiveTime, true - case 3975: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_LocalTime, true - case 3976: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Message, true - case 3977: - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Severity, true - case 3978: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventId, true - case 3979: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventType, true - case 3980: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceNode, true - case 3981: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceName, true - case 3982: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Time, true - case 3983: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ReceiveTime, true - case 3984: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_LocalTime, true - case 3985: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Message, true - case 3986: - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Severity, true - case 3987: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventId, true - case 3988: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventType, true - case 3989: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceNode, true - case 3990: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceName, true - case 3991: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Time, true - case 3992: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ReceiveTime, true - case 3993: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_LocalTime, true - case 3994: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Message, true - case 3995: - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Severity, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableRefreshByName(value string) (enum OpcuaNodeIdServicesVariableRefresh, ok bool) { - switch value { - case "RefreshStartEventType_ConditionClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassId, true - case "RefreshStartEventType_ConditionClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassName, true - case "RefreshStartEventType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassId, true - case "RefreshStartEventType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassName, true - case "RefreshEndEventType_ConditionClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassId, true - case "RefreshEndEventType_ConditionClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassName, true - case "RefreshEndEventType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassId, true - case "RefreshEndEventType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassName, true - case "RefreshRequiredEventType_ConditionClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassId, true - case "RefreshRequiredEventType_ConditionClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassName, true - case "RefreshRequiredEventType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassId, true - case "RefreshRequiredEventType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassName, true - case "RefreshStartEventType_EventId": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventId, true - case "RefreshStartEventType_EventType": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventType, true - case "RefreshStartEventType_SourceNode": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceNode, true - case "RefreshStartEventType_SourceName": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceName, true - case "RefreshStartEventType_Time": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Time, true - case "RefreshStartEventType_ReceiveTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ReceiveTime, true - case "RefreshStartEventType_LocalTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_LocalTime, true - case "RefreshStartEventType_Message": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Message, true - case "RefreshStartEventType_Severity": - return OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Severity, true - case "RefreshEndEventType_EventId": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventId, true - case "RefreshEndEventType_EventType": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventType, true - case "RefreshEndEventType_SourceNode": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceNode, true - case "RefreshEndEventType_SourceName": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceName, true - case "RefreshEndEventType_Time": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Time, true - case "RefreshEndEventType_ReceiveTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ReceiveTime, true - case "RefreshEndEventType_LocalTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_LocalTime, true - case "RefreshEndEventType_Message": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Message, true - case "RefreshEndEventType_Severity": - return OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Severity, true - case "RefreshRequiredEventType_EventId": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventId, true - case "RefreshRequiredEventType_EventType": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventType, true - case "RefreshRequiredEventType_SourceNode": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceNode, true - case "RefreshRequiredEventType_SourceName": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceName, true - case "RefreshRequiredEventType_Time": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Time, true - case "RefreshRequiredEventType_ReceiveTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ReceiveTime, true - case "RefreshRequiredEventType_LocalTime": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_LocalTime, true - case "RefreshRequiredEventType_Message": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Message, true - case "RefreshRequiredEventType_Severity": - return OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Severity, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableRefreshKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableRefreshValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableRefresh(structType any) OpcuaNodeIdServicesVariableRefresh { - castFunc := func(typ any) OpcuaNodeIdServicesVariableRefresh { - if sOpcuaNodeIdServicesVariableRefresh, ok := typ.(OpcuaNodeIdServicesVariableRefresh); ok { - return sOpcuaNodeIdServicesVariableRefresh - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableRefresh) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableRefresh) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableRefreshParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableRefresh, error) { - return OpcuaNodeIdServicesVariableRefreshParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableRefreshParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableRefresh, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableRefresh", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableRefresh") - } - if enum, ok := OpcuaNodeIdServicesVariableRefreshByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableRefresh") - return OpcuaNodeIdServicesVariableRefresh(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableRefresh) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableRefresh) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableRefresh", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableRefresh) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassId: - return "RefreshStartEventType_ConditionClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionClassName: - return "RefreshStartEventType_ConditionClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassId: - return "RefreshStartEventType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ConditionSubClassName: - return "RefreshStartEventType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassId: - return "RefreshEndEventType_ConditionClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionClassName: - return "RefreshEndEventType_ConditionClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassId: - return "RefreshEndEventType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ConditionSubClassName: - return "RefreshEndEventType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassId: - return "RefreshRequiredEventType_ConditionClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionClassName: - return "RefreshRequiredEventType_ConditionClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassId: - return "RefreshRequiredEventType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ConditionSubClassName: - return "RefreshRequiredEventType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventId: - return "RefreshStartEventType_EventId" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_EventType: - return "RefreshStartEventType_EventType" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceNode: - return "RefreshStartEventType_SourceNode" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_SourceName: - return "RefreshStartEventType_SourceName" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Time: - return "RefreshStartEventType_Time" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_ReceiveTime: - return "RefreshStartEventType_ReceiveTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_LocalTime: - return "RefreshStartEventType_LocalTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Message: - return "RefreshStartEventType_Message" - case OpcuaNodeIdServicesVariableRefresh_RefreshStartEventType_Severity: - return "RefreshStartEventType_Severity" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventId: - return "RefreshEndEventType_EventId" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_EventType: - return "RefreshEndEventType_EventType" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceNode: - return "RefreshEndEventType_SourceNode" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_SourceName: - return "RefreshEndEventType_SourceName" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Time: - return "RefreshEndEventType_Time" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_ReceiveTime: - return "RefreshEndEventType_ReceiveTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_LocalTime: - return "RefreshEndEventType_LocalTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Message: - return "RefreshEndEventType_Message" - case OpcuaNodeIdServicesVariableRefresh_RefreshEndEventType_Severity: - return "RefreshEndEventType_Severity" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventId: - return "RefreshRequiredEventType_EventId" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_EventType: - return "RefreshRequiredEventType_EventType" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceNode: - return "RefreshRequiredEventType_SourceNode" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_SourceName: - return "RefreshRequiredEventType_SourceName" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Time: - return "RefreshRequiredEventType_Time" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_ReceiveTime: - return "RefreshRequiredEventType_ReceiveTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_LocalTime: - return "RefreshRequiredEventType_LocalTime" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Message: - return "RefreshRequiredEventType_Message" - case OpcuaNodeIdServicesVariableRefresh_RefreshRequiredEventType_Severity: - return "RefreshRequiredEventType_Severity" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableRefresh) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableTrip.go b/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableTrip.go deleted file mode 100644 index c4a9a57c920..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaNodeIdServicesVariableTrip.go +++ /dev/null @@ -1,1247 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// OpcuaNodeIdServicesVariableTrip is an enum -type OpcuaNodeIdServicesVariableTrip int32 - -type IOpcuaNodeIdServicesVariableTrip interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -const ( - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventId OpcuaNodeIdServicesVariableTrip = 10752 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventType OpcuaNodeIdServicesVariableTrip = 10753 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceNode OpcuaNodeIdServicesVariableTrip = 10754 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceName OpcuaNodeIdServicesVariableTrip = 10755 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Time OpcuaNodeIdServicesVariableTrip = 10756 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReceiveTime OpcuaNodeIdServicesVariableTrip = 10757 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LocalTime OpcuaNodeIdServicesVariableTrip = 10758 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Message OpcuaNodeIdServicesVariableTrip = 10759 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Severity OpcuaNodeIdServicesVariableTrip = 10760 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionName OpcuaNodeIdServicesVariableTrip = 10761 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_BranchId OpcuaNodeIdServicesVariableTrip = 10762 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Retain OpcuaNodeIdServicesVariableTrip = 10763 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState OpcuaNodeIdServicesVariableTrip = 10764 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Id OpcuaNodeIdServicesVariableTrip = 10765 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Name OpcuaNodeIdServicesVariableTrip = 10766 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Number OpcuaNodeIdServicesVariableTrip = 10767 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10768 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TransitionTime OpcuaNodeIdServicesVariableTrip = 10769 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 10770 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TrueState OpcuaNodeIdServicesVariableTrip = 10771 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_FalseState OpcuaNodeIdServicesVariableTrip = 10772 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality OpcuaNodeIdServicesVariableTrip = 10773 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality_SourceTimestamp OpcuaNodeIdServicesVariableTrip = 10774 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity OpcuaNodeIdServicesVariableTrip = 10775 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity_SourceTimestamp OpcuaNodeIdServicesVariableTrip = 10776 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment OpcuaNodeIdServicesVariableTrip = 10777 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment_SourceTimestamp OpcuaNodeIdServicesVariableTrip = 10778 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ClientUserId OpcuaNodeIdServicesVariableTrip = 10779 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AddComment_InputArguments OpcuaNodeIdServicesVariableTrip = 10783 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh_InputArguments OpcuaNodeIdServicesVariableTrip = 10785 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState OpcuaNodeIdServicesVariableTrip = 10786 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Id OpcuaNodeIdServicesVariableTrip = 10787 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Name OpcuaNodeIdServicesVariableTrip = 10788 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Number OpcuaNodeIdServicesVariableTrip = 10789 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10790 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TransitionTime OpcuaNodeIdServicesVariableTrip = 10791 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 10792 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TrueState OpcuaNodeIdServicesVariableTrip = 10793 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_FalseState OpcuaNodeIdServicesVariableTrip = 10794 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState OpcuaNodeIdServicesVariableTrip = 10795 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Id OpcuaNodeIdServicesVariableTrip = 10796 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Name OpcuaNodeIdServicesVariableTrip = 10797 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Number OpcuaNodeIdServicesVariableTrip = 10798 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10799 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TransitionTime OpcuaNodeIdServicesVariableTrip = 10800 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 10801 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TrueState OpcuaNodeIdServicesVariableTrip = 10802 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_FalseState OpcuaNodeIdServicesVariableTrip = 10803 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Acknowledge_InputArguments OpcuaNodeIdServicesVariableTrip = 10805 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Confirm_InputArguments OpcuaNodeIdServicesVariableTrip = 10807 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState OpcuaNodeIdServicesVariableTrip = 10808 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Id OpcuaNodeIdServicesVariableTrip = 10809 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Name OpcuaNodeIdServicesVariableTrip = 10810 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Number OpcuaNodeIdServicesVariableTrip = 10811 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10812 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TransitionTime OpcuaNodeIdServicesVariableTrip = 10813 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 10814 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TrueState OpcuaNodeIdServicesVariableTrip = 10815 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_FalseState OpcuaNodeIdServicesVariableTrip = 10816 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState OpcuaNodeIdServicesVariableTrip = 10817 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Id OpcuaNodeIdServicesVariableTrip = 10818 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Name OpcuaNodeIdServicesVariableTrip = 10819 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Number OpcuaNodeIdServicesVariableTrip = 10820 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10821 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TransitionTime OpcuaNodeIdServicesVariableTrip = 10822 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 10823 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TrueState OpcuaNodeIdServicesVariableTrip = 10824 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_FalseState OpcuaNodeIdServicesVariableTrip = 10825 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState OpcuaNodeIdServicesVariableTrip = 10827 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Id OpcuaNodeIdServicesVariableTrip = 10828 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Name OpcuaNodeIdServicesVariableTrip = 10829 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Number OpcuaNodeIdServicesVariableTrip = 10830 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 10831 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition OpcuaNodeIdServicesVariableTrip = 10832 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Id OpcuaNodeIdServicesVariableTrip = 10833 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Name OpcuaNodeIdServicesVariableTrip = 10834 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Number OpcuaNodeIdServicesVariableTrip = 10835 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_TransitionTime OpcuaNodeIdServicesVariableTrip = 10836 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_UnshelveTime OpcuaNodeIdServicesVariableTrip = 10837 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve_InputArguments OpcuaNodeIdServicesVariableTrip = 10862 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedOrShelved OpcuaNodeIdServicesVariableTrip = 10863 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_MaxTimeShelved OpcuaNodeIdServicesVariableTrip = 10864 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassId OpcuaNodeIdServicesVariableTrip = 11159 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassName OpcuaNodeIdServicesVariableTrip = 11160 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_InputNode OpcuaNodeIdServicesVariableTrip = 11161 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_NormalState OpcuaNodeIdServicesVariableTrip = 11162 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 11483 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh2_InputArguments OpcuaNodeIdServicesVariableTrip = 13011 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassId OpcuaNodeIdServicesVariableTrip = 17008 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassName OpcuaNodeIdServicesVariableTrip = 17009 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState OpcuaNodeIdServicesVariableTrip = 17010 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Id OpcuaNodeIdServicesVariableTrip = 17011 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Name OpcuaNodeIdServicesVariableTrip = 17012 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Number OpcuaNodeIdServicesVariableTrip = 17013 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 17014 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TransitionTime OpcuaNodeIdServicesVariableTrip = 17015 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 17016 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TrueState OpcuaNodeIdServicesVariableTrip = 17017 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_FalseState OpcuaNodeIdServicesVariableTrip = 17018 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState OpcuaNodeIdServicesVariableTrip = 17019 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Id OpcuaNodeIdServicesVariableTrip = 17020 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Name OpcuaNodeIdServicesVariableTrip = 17021 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Number OpcuaNodeIdServicesVariableTrip = 17022 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 17023 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TransitionTime OpcuaNodeIdServicesVariableTrip = 17024 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 17025 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TrueState OpcuaNodeIdServicesVariableTrip = 17026 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_FalseState OpcuaNodeIdServicesVariableTrip = 17027 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleEnabled OpcuaNodeIdServicesVariableTrip = 17028 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound OpcuaNodeIdServicesVariableTrip = 17029 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OnDelay OpcuaNodeIdServicesVariableTrip = 17034 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OffDelay OpcuaNodeIdServicesVariableTrip = 17035 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_FirstInGroupFlag OpcuaNodeIdServicesVariableTrip = 17036 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmTime OpcuaNodeIdServicesVariableTrip = 17039 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmRepeatCount OpcuaNodeIdServicesVariableTrip = 17040 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableStates OpcuaNodeIdServicesVariableTrip = 17698 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableTransitions OpcuaNodeIdServicesVariableTrip = 17699 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_ListId OpcuaNodeIdServicesVariableTrip = 17963 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_AgencyId OpcuaNodeIdServicesVariableTrip = 17964 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_VersionId OpcuaNodeIdServicesVariableTrip = 17965 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState OpcuaNodeIdServicesVariableTrip = 18337 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Id OpcuaNodeIdServicesVariableTrip = 18338 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Name OpcuaNodeIdServicesVariableTrip = 18339 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Number OpcuaNodeIdServicesVariableTrip = 18340 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveDisplayName OpcuaNodeIdServicesVariableTrip = 18341 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TransitionTime OpcuaNodeIdServicesVariableTrip = 18342 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveTransitionTime OpcuaNodeIdServicesVariableTrip = 18343 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TrueState OpcuaNodeIdServicesVariableTrip = 18344 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_FalseState OpcuaNodeIdServicesVariableTrip = 18345 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Suppress2_InputArguments OpcuaNodeIdServicesVariableTrip = 24459 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Unsuppress2_InputArguments OpcuaNodeIdServicesVariableTrip = 24461 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_RemoveFromService2_InputArguments OpcuaNodeIdServicesVariableTrip = 24463 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_PlaceInService2_InputArguments OpcuaNodeIdServicesVariableTrip = 24465 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Reset2_InputArguments OpcuaNodeIdServicesVariableTrip = 24467 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve2_InputArguments OpcuaNodeIdServicesVariableTrip = 24931 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_Unshelve2_InputArguments OpcuaNodeIdServicesVariableTrip = 24933 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_OneShotShelve2_InputArguments OpcuaNodeIdServicesVariableTrip = 24935 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_GetGroupMemberships_OutputArguments OpcuaNodeIdServicesVariableTrip = 25171 - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SupportsFilteredRetain OpcuaNodeIdServicesVariableTrip = 32239 -) - -var OpcuaNodeIdServicesVariableTripValues []OpcuaNodeIdServicesVariableTrip - -func init() { - _ = errors.New - OpcuaNodeIdServicesVariableTripValues = []OpcuaNodeIdServicesVariableTrip{ - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventType, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceNode, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Time, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReceiveTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LocalTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Message, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Severity, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_BranchId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Retain, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality_SourceTimestamp, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity_SourceTimestamp, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment_SourceTimestamp, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ClientUserId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AddComment_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Acknowledge_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Confirm_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_UnshelveTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedOrShelved, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_MaxTimeShelved, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_InputNode, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_NormalState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleEnabled, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OnDelay, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_OffDelay, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_FirstInGroupFlag, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmRepeatCount, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableStates, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableTransitions, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_ListId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_AgencyId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_VersionId, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Id, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Name, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Number, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveDisplayName, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveTransitionTime, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TrueState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_FalseState, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Suppress2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Unsuppress2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_RemoveFromService2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_PlaceInService2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_Reset2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_Unshelve2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_OneShotShelve2_InputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_GetGroupMemberships_OutputArguments, - OpcuaNodeIdServicesVariableTrip_TripAlarmType_SupportsFilteredRetain, - } -} - -func OpcuaNodeIdServicesVariableTripByValue(value int32) (enum OpcuaNodeIdServicesVariableTrip, ok bool) { - switch value { - case 10752: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventId, true - case 10753: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventType, true - case 10754: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceNode, true - case 10755: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceName, true - case 10756: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Time, true - case 10757: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReceiveTime, true - case 10758: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LocalTime, true - case 10759: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Message, true - case 10760: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Severity, true - case 10761: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionName, true - case 10762: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_BranchId, true - case 10763: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Retain, true - case 10764: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState, true - case 10765: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Id, true - case 10766: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Name, true - case 10767: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Number, true - case 10768: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveDisplayName, true - case 10769: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TransitionTime, true - case 10770: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveTransitionTime, true - case 10771: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TrueState, true - case 10772: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_FalseState, true - case 10773: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality, true - case 10774: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality_SourceTimestamp, true - case 10775: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity, true - case 10776: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity_SourceTimestamp, true - case 10777: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment, true - case 10778: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment_SourceTimestamp, true - case 10779: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ClientUserId, true - case 10783: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AddComment_InputArguments, true - case 10785: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh_InputArguments, true - case 10786: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState, true - case 10787: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Id, true - case 10788: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Name, true - case 10789: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Number, true - case 10790: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveDisplayName, true - case 10791: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TransitionTime, true - case 10792: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveTransitionTime, true - case 10793: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TrueState, true - case 10794: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_FalseState, true - case 10795: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState, true - case 10796: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Id, true - case 10797: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Name, true - case 10798: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Number, true - case 10799: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveDisplayName, true - case 10800: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TransitionTime, true - case 10801: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveTransitionTime, true - case 10802: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TrueState, true - case 10803: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_FalseState, true - case 10805: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Acknowledge_InputArguments, true - case 10807: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Confirm_InputArguments, true - case 10808: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState, true - case 10809: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Id, true - case 10810: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Name, true - case 10811: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Number, true - case 10812: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveDisplayName, true - case 10813: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TransitionTime, true - case 10814: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveTransitionTime, true - case 10815: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TrueState, true - case 10816: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_FalseState, true - case 10817: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState, true - case 10818: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Id, true - case 10819: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Name, true - case 10820: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Number, true - case 10821: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveDisplayName, true - case 10822: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TransitionTime, true - case 10823: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveTransitionTime, true - case 10824: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TrueState, true - case 10825: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_FalseState, true - case 10827: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState, true - case 10828: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Id, true - case 10829: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Name, true - case 10830: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Number, true - case 10831: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case 10832: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition, true - case 10833: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Id, true - case 10834: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Name, true - case 10835: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Number, true - case 10836: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_TransitionTime, true - case 10837: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_UnshelveTime, true - case 10862: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve_InputArguments, true - case 10863: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedOrShelved, true - case 10864: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_MaxTimeShelved, true - case 11159: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassId, true - case 11160: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassName, true - case 11161: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_InputNode, true - case 11162: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_NormalState, true - case 11483: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case 13011: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh2_InputArguments, true - case 17008: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassId, true - case 17009: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassName, true - case 17010: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState, true - case 17011: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Id, true - case 17012: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Name, true - case 17013: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Number, true - case 17014: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveDisplayName, true - case 17015: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TransitionTime, true - case 17016: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case 17017: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TrueState, true - case 17018: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_FalseState, true - case 17019: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState, true - case 17020: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Id, true - case 17021: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Name, true - case 17022: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Number, true - case 17023: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveDisplayName, true - case 17024: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TransitionTime, true - case 17025: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveTransitionTime, true - case 17026: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TrueState, true - case 17027: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_FalseState, true - case 17028: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleEnabled, true - case 17029: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound, true - case 17034: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OnDelay, true - case 17035: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OffDelay, true - case 17036: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_FirstInGroupFlag, true - case 17039: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmTime, true - case 17040: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmRepeatCount, true - case 17698: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableStates, true - case 17699: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableTransitions, true - case 17963: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_ListId, true - case 17964: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_AgencyId, true - case 17965: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_VersionId, true - case 18337: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState, true - case 18338: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Id, true - case 18339: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Name, true - case 18340: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Number, true - case 18341: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveDisplayName, true - case 18342: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TransitionTime, true - case 18343: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveTransitionTime, true - case 18344: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TrueState, true - case 18345: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_FalseState, true - case 24459: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Suppress2_InputArguments, true - case 24461: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Unsuppress2_InputArguments, true - case 24463: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_RemoveFromService2_InputArguments, true - case 24465: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_PlaceInService2_InputArguments, true - case 24467: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Reset2_InputArguments, true - case 24931: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case 24933: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_Unshelve2_InputArguments, true - case 24935: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case 25171: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_GetGroupMemberships_OutputArguments, true - case 32239: - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SupportsFilteredRetain, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableTripByName(value string) (enum OpcuaNodeIdServicesVariableTrip, ok bool) { - switch value { - case "TripAlarmType_EventId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventId, true - case "TripAlarmType_EventType": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventType, true - case "TripAlarmType_SourceNode": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceNode, true - case "TripAlarmType_SourceName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceName, true - case "TripAlarmType_Time": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Time, true - case "TripAlarmType_ReceiveTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReceiveTime, true - case "TripAlarmType_LocalTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LocalTime, true - case "TripAlarmType_Message": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Message, true - case "TripAlarmType_Severity": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Severity, true - case "TripAlarmType_ConditionName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionName, true - case "TripAlarmType_BranchId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_BranchId, true - case "TripAlarmType_Retain": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Retain, true - case "TripAlarmType_EnabledState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState, true - case "TripAlarmType_EnabledState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Id, true - case "TripAlarmType_EnabledState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Name, true - case "TripAlarmType_EnabledState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Number, true - case "TripAlarmType_EnabledState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveDisplayName, true - case "TripAlarmType_EnabledState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TransitionTime, true - case "TripAlarmType_EnabledState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveTransitionTime, true - case "TripAlarmType_EnabledState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TrueState, true - case "TripAlarmType_EnabledState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_FalseState, true - case "TripAlarmType_Quality": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality, true - case "TripAlarmType_Quality_SourceTimestamp": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality_SourceTimestamp, true - case "TripAlarmType_LastSeverity": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity, true - case "TripAlarmType_LastSeverity_SourceTimestamp": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity_SourceTimestamp, true - case "TripAlarmType_Comment": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment, true - case "TripAlarmType_Comment_SourceTimestamp": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment_SourceTimestamp, true - case "TripAlarmType_ClientUserId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ClientUserId, true - case "TripAlarmType_AddComment_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AddComment_InputArguments, true - case "TripAlarmType_ConditionRefresh_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh_InputArguments, true - case "TripAlarmType_AckedState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState, true - case "TripAlarmType_AckedState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Id, true - case "TripAlarmType_AckedState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Name, true - case "TripAlarmType_AckedState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Number, true - case "TripAlarmType_AckedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveDisplayName, true - case "TripAlarmType_AckedState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TransitionTime, true - case "TripAlarmType_AckedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveTransitionTime, true - case "TripAlarmType_AckedState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TrueState, true - case "TripAlarmType_AckedState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_FalseState, true - case "TripAlarmType_ConfirmedState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState, true - case "TripAlarmType_ConfirmedState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Id, true - case "TripAlarmType_ConfirmedState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Name, true - case "TripAlarmType_ConfirmedState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Number, true - case "TripAlarmType_ConfirmedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveDisplayName, true - case "TripAlarmType_ConfirmedState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TransitionTime, true - case "TripAlarmType_ConfirmedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveTransitionTime, true - case "TripAlarmType_ConfirmedState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TrueState, true - case "TripAlarmType_ConfirmedState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_FalseState, true - case "TripAlarmType_Acknowledge_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Acknowledge_InputArguments, true - case "TripAlarmType_Confirm_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Confirm_InputArguments, true - case "TripAlarmType_ActiveState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState, true - case "TripAlarmType_ActiveState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Id, true - case "TripAlarmType_ActiveState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Name, true - case "TripAlarmType_ActiveState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Number, true - case "TripAlarmType_ActiveState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveDisplayName, true - case "TripAlarmType_ActiveState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TransitionTime, true - case "TripAlarmType_ActiveState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveTransitionTime, true - case "TripAlarmType_ActiveState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TrueState, true - case "TripAlarmType_ActiveState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_FalseState, true - case "TripAlarmType_SuppressedState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState, true - case "TripAlarmType_SuppressedState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Id, true - case "TripAlarmType_SuppressedState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Name, true - case "TripAlarmType_SuppressedState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Number, true - case "TripAlarmType_SuppressedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveDisplayName, true - case "TripAlarmType_SuppressedState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TransitionTime, true - case "TripAlarmType_SuppressedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveTransitionTime, true - case "TripAlarmType_SuppressedState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TrueState, true - case "TripAlarmType_SuppressedState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_FalseState, true - case "TripAlarmType_ShelvingState_CurrentState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState, true - case "TripAlarmType_ShelvingState_CurrentState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Id, true - case "TripAlarmType_ShelvingState_CurrentState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Name, true - case "TripAlarmType_ShelvingState_CurrentState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Number, true - case "TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName, true - case "TripAlarmType_ShelvingState_LastTransition": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition, true - case "TripAlarmType_ShelvingState_LastTransition_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Id, true - case "TripAlarmType_ShelvingState_LastTransition_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Name, true - case "TripAlarmType_ShelvingState_LastTransition_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Number, true - case "TripAlarmType_ShelvingState_LastTransition_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_TransitionTime, true - case "TripAlarmType_ShelvingState_UnshelveTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_UnshelveTime, true - case "TripAlarmType_ShelvingState_TimedShelve_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve_InputArguments, true - case "TripAlarmType_SuppressedOrShelved": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedOrShelved, true - case "TripAlarmType_MaxTimeShelved": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_MaxTimeShelved, true - case "TripAlarmType_ConditionClassId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassId, true - case "TripAlarmType_ConditionClassName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassName, true - case "TripAlarmType_InputNode": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_InputNode, true - case "TripAlarmType_NormalState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_NormalState, true - case "TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime, true - case "TripAlarmType_ConditionRefresh2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh2_InputArguments, true - case "TripAlarmType_ConditionSubClassId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassId, true - case "TripAlarmType_ConditionSubClassName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassName, true - case "TripAlarmType_OutOfServiceState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState, true - case "TripAlarmType_OutOfServiceState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Id, true - case "TripAlarmType_OutOfServiceState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Name, true - case "TripAlarmType_OutOfServiceState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Number, true - case "TripAlarmType_OutOfServiceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveDisplayName, true - case "TripAlarmType_OutOfServiceState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TransitionTime, true - case "TripAlarmType_OutOfServiceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveTransitionTime, true - case "TripAlarmType_OutOfServiceState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TrueState, true - case "TripAlarmType_OutOfServiceState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_FalseState, true - case "TripAlarmType_SilenceState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState, true - case "TripAlarmType_SilenceState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Id, true - case "TripAlarmType_SilenceState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Name, true - case "TripAlarmType_SilenceState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Number, true - case "TripAlarmType_SilenceState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveDisplayName, true - case "TripAlarmType_SilenceState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TransitionTime, true - case "TripAlarmType_SilenceState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveTransitionTime, true - case "TripAlarmType_SilenceState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TrueState, true - case "TripAlarmType_SilenceState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_FalseState, true - case "TripAlarmType_AudibleEnabled": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleEnabled, true - case "TripAlarmType_AudibleSound": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound, true - case "TripAlarmType_OnDelay": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OnDelay, true - case "TripAlarmType_OffDelay": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_OffDelay, true - case "TripAlarmType_FirstInGroupFlag": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_FirstInGroupFlag, true - case "TripAlarmType_ReAlarmTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmTime, true - case "TripAlarmType_ReAlarmRepeatCount": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmRepeatCount, true - case "TripAlarmType_ShelvingState_AvailableStates": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableStates, true - case "TripAlarmType_ShelvingState_AvailableTransitions": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableTransitions, true - case "TripAlarmType_AudibleSound_ListId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_ListId, true - case "TripAlarmType_AudibleSound_AgencyId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_AgencyId, true - case "TripAlarmType_AudibleSound_VersionId": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_VersionId, true - case "TripAlarmType_LatchedState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState, true - case "TripAlarmType_LatchedState_Id": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Id, true - case "TripAlarmType_LatchedState_Name": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Name, true - case "TripAlarmType_LatchedState_Number": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Number, true - case "TripAlarmType_LatchedState_EffectiveDisplayName": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveDisplayName, true - case "TripAlarmType_LatchedState_TransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TransitionTime, true - case "TripAlarmType_LatchedState_EffectiveTransitionTime": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveTransitionTime, true - case "TripAlarmType_LatchedState_TrueState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TrueState, true - case "TripAlarmType_LatchedState_FalseState": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_FalseState, true - case "TripAlarmType_Suppress2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Suppress2_InputArguments, true - case "TripAlarmType_Unsuppress2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Unsuppress2_InputArguments, true - case "TripAlarmType_RemoveFromService2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_RemoveFromService2_InputArguments, true - case "TripAlarmType_PlaceInService2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_PlaceInService2_InputArguments, true - case "TripAlarmType_Reset2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_Reset2_InputArguments, true - case "TripAlarmType_ShelvingState_TimedShelve2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve2_InputArguments, true - case "TripAlarmType_ShelvingState_Unshelve2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_Unshelve2_InputArguments, true - case "TripAlarmType_ShelvingState_OneShotShelve2_InputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_OneShotShelve2_InputArguments, true - case "TripAlarmType_GetGroupMemberships_OutputArguments": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_GetGroupMemberships_OutputArguments, true - case "TripAlarmType_SupportsFilteredRetain": - return OpcuaNodeIdServicesVariableTrip_TripAlarmType_SupportsFilteredRetain, true - } - return 0, false -} - -func OpcuaNodeIdServicesVariableTripKnows(value int32) bool { - for _, typeValue := range OpcuaNodeIdServicesVariableTripValues { - if int32(typeValue) == value { - return true - } - } - return false -} - -func CastOpcuaNodeIdServicesVariableTrip(structType any) OpcuaNodeIdServicesVariableTrip { - castFunc := func(typ any) OpcuaNodeIdServicesVariableTrip { - if sOpcuaNodeIdServicesVariableTrip, ok := typ.(OpcuaNodeIdServicesVariableTrip); ok { - return sOpcuaNodeIdServicesVariableTrip - } - return 0 - } - return castFunc(structType) -} - -func (m OpcuaNodeIdServicesVariableTrip) GetLengthInBits(ctx context.Context) uint16 { - return 32 -} - -func (m OpcuaNodeIdServicesVariableTrip) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func OpcuaNodeIdServicesVariableTripParse(ctx context.Context, theBytes []byte) (OpcuaNodeIdServicesVariableTrip, error) { - return OpcuaNodeIdServicesVariableTripParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func OpcuaNodeIdServicesVariableTripParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (OpcuaNodeIdServicesVariableTrip, error) { - log := zerolog.Ctx(ctx) - _ = log - val, err := readBuffer.ReadInt32("OpcuaNodeIdServicesVariableTrip", 32) - if err != nil { - return 0, errors.Wrap(err, "error reading OpcuaNodeIdServicesVariableTrip") - } - if enum, ok := OpcuaNodeIdServicesVariableTripByValue(val); !ok { - log.Debug().Interface("val", val).Msg("no value val found for OpcuaNodeIdServicesVariableTrip") - return OpcuaNodeIdServicesVariableTrip(val), nil - } else { - return enum, nil - } -} - -func (e OpcuaNodeIdServicesVariableTrip) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased() - if err := e.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (e OpcuaNodeIdServicesVariableTrip) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { - log := zerolog.Ctx(ctx) - _ = log - return writeBuffer.WriteInt32("OpcuaNodeIdServicesVariableTrip", 32, int32(int32(e)), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) -} - -// PLC4XEnumName returns the name that is used in code to identify this enum -func (e OpcuaNodeIdServicesVariableTrip) PLC4XEnumName() string { - switch e { - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventId: - return "TripAlarmType_EventId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EventType: - return "TripAlarmType_EventType" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceNode: - return "TripAlarmType_SourceNode" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SourceName: - return "TripAlarmType_SourceName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Time: - return "TripAlarmType_Time" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReceiveTime: - return "TripAlarmType_ReceiveTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LocalTime: - return "TripAlarmType_LocalTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Message: - return "TripAlarmType_Message" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Severity: - return "TripAlarmType_Severity" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionName: - return "TripAlarmType_ConditionName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_BranchId: - return "TripAlarmType_BranchId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Retain: - return "TripAlarmType_Retain" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState: - return "TripAlarmType_EnabledState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Id: - return "TripAlarmType_EnabledState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Name: - return "TripAlarmType_EnabledState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_Number: - return "TripAlarmType_EnabledState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveDisplayName: - return "TripAlarmType_EnabledState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TransitionTime: - return "TripAlarmType_EnabledState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_EffectiveTransitionTime: - return "TripAlarmType_EnabledState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_TrueState: - return "TripAlarmType_EnabledState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_EnabledState_FalseState: - return "TripAlarmType_EnabledState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality: - return "TripAlarmType_Quality" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Quality_SourceTimestamp: - return "TripAlarmType_Quality_SourceTimestamp" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity: - return "TripAlarmType_LastSeverity" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LastSeverity_SourceTimestamp: - return "TripAlarmType_LastSeverity_SourceTimestamp" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment: - return "TripAlarmType_Comment" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Comment_SourceTimestamp: - return "TripAlarmType_Comment_SourceTimestamp" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ClientUserId: - return "TripAlarmType_ClientUserId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AddComment_InputArguments: - return "TripAlarmType_AddComment_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh_InputArguments: - return "TripAlarmType_ConditionRefresh_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState: - return "TripAlarmType_AckedState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Id: - return "TripAlarmType_AckedState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Name: - return "TripAlarmType_AckedState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_Number: - return "TripAlarmType_AckedState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveDisplayName: - return "TripAlarmType_AckedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TransitionTime: - return "TripAlarmType_AckedState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_EffectiveTransitionTime: - return "TripAlarmType_AckedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_TrueState: - return "TripAlarmType_AckedState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AckedState_FalseState: - return "TripAlarmType_AckedState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState: - return "TripAlarmType_ConfirmedState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Id: - return "TripAlarmType_ConfirmedState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Name: - return "TripAlarmType_ConfirmedState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_Number: - return "TripAlarmType_ConfirmedState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveDisplayName: - return "TripAlarmType_ConfirmedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TransitionTime: - return "TripAlarmType_ConfirmedState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_EffectiveTransitionTime: - return "TripAlarmType_ConfirmedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_TrueState: - return "TripAlarmType_ConfirmedState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConfirmedState_FalseState: - return "TripAlarmType_ConfirmedState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Acknowledge_InputArguments: - return "TripAlarmType_Acknowledge_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Confirm_InputArguments: - return "TripAlarmType_Confirm_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState: - return "TripAlarmType_ActiveState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Id: - return "TripAlarmType_ActiveState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Name: - return "TripAlarmType_ActiveState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_Number: - return "TripAlarmType_ActiveState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveDisplayName: - return "TripAlarmType_ActiveState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TransitionTime: - return "TripAlarmType_ActiveState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_EffectiveTransitionTime: - return "TripAlarmType_ActiveState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_TrueState: - return "TripAlarmType_ActiveState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ActiveState_FalseState: - return "TripAlarmType_ActiveState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState: - return "TripAlarmType_SuppressedState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Id: - return "TripAlarmType_SuppressedState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Name: - return "TripAlarmType_SuppressedState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_Number: - return "TripAlarmType_SuppressedState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveDisplayName: - return "TripAlarmType_SuppressedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TransitionTime: - return "TripAlarmType_SuppressedState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_EffectiveTransitionTime: - return "TripAlarmType_SuppressedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_TrueState: - return "TripAlarmType_SuppressedState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedState_FalseState: - return "TripAlarmType_SuppressedState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState: - return "TripAlarmType_ShelvingState_CurrentState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Id: - return "TripAlarmType_ShelvingState_CurrentState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Name: - return "TripAlarmType_ShelvingState_CurrentState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_Number: - return "TripAlarmType_ShelvingState_CurrentState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName: - return "TripAlarmType_ShelvingState_CurrentState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition: - return "TripAlarmType_ShelvingState_LastTransition" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Id: - return "TripAlarmType_ShelvingState_LastTransition_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Name: - return "TripAlarmType_ShelvingState_LastTransition_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_Number: - return "TripAlarmType_ShelvingState_LastTransition_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_TransitionTime: - return "TripAlarmType_ShelvingState_LastTransition_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_UnshelveTime: - return "TripAlarmType_ShelvingState_UnshelveTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve_InputArguments: - return "TripAlarmType_ShelvingState_TimedShelve_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SuppressedOrShelved: - return "TripAlarmType_SuppressedOrShelved" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_MaxTimeShelved: - return "TripAlarmType_MaxTimeShelved" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassId: - return "TripAlarmType_ConditionClassId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionClassName: - return "TripAlarmType_ConditionClassName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_InputNode: - return "TripAlarmType_InputNode" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_NormalState: - return "TripAlarmType_NormalState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime: - return "TripAlarmType_ShelvingState_LastTransition_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionRefresh2_InputArguments: - return "TripAlarmType_ConditionRefresh2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassId: - return "TripAlarmType_ConditionSubClassId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ConditionSubClassName: - return "TripAlarmType_ConditionSubClassName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState: - return "TripAlarmType_OutOfServiceState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Id: - return "TripAlarmType_OutOfServiceState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Name: - return "TripAlarmType_OutOfServiceState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_Number: - return "TripAlarmType_OutOfServiceState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveDisplayName: - return "TripAlarmType_OutOfServiceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TransitionTime: - return "TripAlarmType_OutOfServiceState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_EffectiveTransitionTime: - return "TripAlarmType_OutOfServiceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_TrueState: - return "TripAlarmType_OutOfServiceState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OutOfServiceState_FalseState: - return "TripAlarmType_OutOfServiceState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState: - return "TripAlarmType_SilenceState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Id: - return "TripAlarmType_SilenceState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Name: - return "TripAlarmType_SilenceState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_Number: - return "TripAlarmType_SilenceState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveDisplayName: - return "TripAlarmType_SilenceState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TransitionTime: - return "TripAlarmType_SilenceState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_EffectiveTransitionTime: - return "TripAlarmType_SilenceState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_TrueState: - return "TripAlarmType_SilenceState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SilenceState_FalseState: - return "TripAlarmType_SilenceState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleEnabled: - return "TripAlarmType_AudibleEnabled" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound: - return "TripAlarmType_AudibleSound" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OnDelay: - return "TripAlarmType_OnDelay" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_OffDelay: - return "TripAlarmType_OffDelay" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_FirstInGroupFlag: - return "TripAlarmType_FirstInGroupFlag" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmTime: - return "TripAlarmType_ReAlarmTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ReAlarmRepeatCount: - return "TripAlarmType_ReAlarmRepeatCount" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableStates: - return "TripAlarmType_ShelvingState_AvailableStates" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_AvailableTransitions: - return "TripAlarmType_ShelvingState_AvailableTransitions" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_ListId: - return "TripAlarmType_AudibleSound_ListId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_AgencyId: - return "TripAlarmType_AudibleSound_AgencyId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_AudibleSound_VersionId: - return "TripAlarmType_AudibleSound_VersionId" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState: - return "TripAlarmType_LatchedState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Id: - return "TripAlarmType_LatchedState_Id" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Name: - return "TripAlarmType_LatchedState_Name" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_Number: - return "TripAlarmType_LatchedState_Number" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveDisplayName: - return "TripAlarmType_LatchedState_EffectiveDisplayName" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TransitionTime: - return "TripAlarmType_LatchedState_TransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_EffectiveTransitionTime: - return "TripAlarmType_LatchedState_EffectiveTransitionTime" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_TrueState: - return "TripAlarmType_LatchedState_TrueState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_LatchedState_FalseState: - return "TripAlarmType_LatchedState_FalseState" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Suppress2_InputArguments: - return "TripAlarmType_Suppress2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Unsuppress2_InputArguments: - return "TripAlarmType_Unsuppress2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_RemoveFromService2_InputArguments: - return "TripAlarmType_RemoveFromService2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_PlaceInService2_InputArguments: - return "TripAlarmType_PlaceInService2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_Reset2_InputArguments: - return "TripAlarmType_Reset2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_TimedShelve2_InputArguments: - return "TripAlarmType_ShelvingState_TimedShelve2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_Unshelve2_InputArguments: - return "TripAlarmType_ShelvingState_Unshelve2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_ShelvingState_OneShotShelve2_InputArguments: - return "TripAlarmType_ShelvingState_OneShotShelve2_InputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_GetGroupMemberships_OutputArguments: - return "TripAlarmType_GetGroupMemberships_OutputArguments" - case OpcuaNodeIdServicesVariableTrip_TripAlarmType_SupportsFilteredRetain: - return "TripAlarmType_SupportsFilteredRetain" - } - return fmt.Sprintf("Unknown(%v)", int32(e)) -} - -func (e OpcuaNodeIdServicesVariableTrip) String() string { - return e.PLC4XEnumName() -} diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaOpenRequest.go b/plc4go/protocols/opcua/readwrite/model/OpcuaOpenRequest.go index 5c378fd5bb2..9977e83dfa0 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaOpenRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaOpenRequest.go @@ -64,7 +64,7 @@ var _ OpcuaOpenRequest = (*_OpcuaOpenRequest)(nil) var _ MessagePDURequirements = (*_OpcuaOpenRequest)(nil) // NewOpcuaOpenRequest factory function for _OpcuaOpenRequest -func NewOpcuaOpenRequest(chunk ChunkType, openRequest OpenChannelMessage, message Payload, totalLength uint32) *_OpcuaOpenRequest { +func NewOpcuaOpenRequest(chunk ChunkType, openRequest OpenChannelMessage, message Payload, totalLength uint32, binary bool) *_OpcuaOpenRequest { if openRequest == nil { panic("openRequest of type OpenChannelMessage for OpcuaOpenRequest must not be nil") } @@ -72,7 +72,7 @@ func NewOpcuaOpenRequest(chunk ChunkType, openRequest OpenChannelMessage, messag panic("message of type Payload for OpcuaOpenRequest must not be nil") } _result := &_OpcuaOpenRequest{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), OpenRequest: openRequest, Message: message, } @@ -291,7 +291,7 @@ func (m *_OpcuaOpenRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaOpenRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool) (__opcuaOpenRequest OpcuaOpenRequest, err error) { +func (m *_OpcuaOpenRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool, binary bool) (__opcuaOpenRequest OpcuaOpenRequest, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer @@ -308,7 +308,7 @@ func (m *_OpcuaOpenRequest) parse(ctx context.Context, readBuffer utils.ReadBuff } m.OpenRequest = openRequest - message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(bool(false)), (uint32)(uint32(uint32(totalLength)-uint32(openRequest.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) + message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(binary), (uint32)(uint32(uint32(totalLength)-uint32(openRequest.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaOpenResponse.go b/plc4go/protocols/opcua/readwrite/model/OpcuaOpenResponse.go index be8da42bff8..d2571cb87bb 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaOpenResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaOpenResponse.go @@ -64,7 +64,7 @@ var _ OpcuaOpenResponse = (*_OpcuaOpenResponse)(nil) var _ MessagePDURequirements = (*_OpcuaOpenResponse)(nil) // NewOpcuaOpenResponse factory function for _OpcuaOpenResponse -func NewOpcuaOpenResponse(chunk ChunkType, openResponse OpenChannelMessage, message Payload, totalLength uint32) *_OpcuaOpenResponse { +func NewOpcuaOpenResponse(chunk ChunkType, openResponse OpenChannelMessage, message Payload, totalLength uint32, binary bool) *_OpcuaOpenResponse { if openResponse == nil { panic("openResponse of type OpenChannelMessage for OpcuaOpenResponse must not be nil") } @@ -72,7 +72,7 @@ func NewOpcuaOpenResponse(chunk ChunkType, openResponse OpenChannelMessage, mess panic("message of type Payload for OpcuaOpenResponse must not be nil") } _result := &_OpcuaOpenResponse{ - MessagePDUContract: NewMessagePDU(chunk), + MessagePDUContract: NewMessagePDU(chunk, binary), OpenResponse: openResponse, Message: message, } @@ -291,7 +291,7 @@ func (m *_OpcuaOpenResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaOpenResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool) (__opcuaOpenResponse OpcuaOpenResponse, err error) { +func (m *_OpcuaOpenResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_MessagePDU, totalLength uint32, response bool, binary bool) (__opcuaOpenResponse OpcuaOpenResponse, err error) { m.MessagePDUContract = parent parent._SubType = m positionAware := readBuffer @@ -308,7 +308,7 @@ func (m *_OpcuaOpenResponse) parse(ctx context.Context, readBuffer utils.ReadBuf } m.OpenResponse = openResponse - message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(bool(false)), (uint32)(uint32(uint32(totalLength)-uint32(openResponse.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) + message, err := ReadSimpleField[Payload](ctx, "message", ReadComplex[Payload](PayloadParseWithBufferProducer[Payload]((bool)(binary), (uint32)(uint32(uint32(totalLength)-uint32(openResponse.GetLengthInBytes(ctx)))-uint32(uint32(16)))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'message' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/OpcuaVector.go b/plc4go/protocols/opcua/readwrite/model/OpcuaVector.go index c7e25132755..f7bfc2f5d1b 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpcuaVector.go +++ b/plc4go/protocols/opcua/readwrite/model/OpcuaVector.go @@ -150,8 +150,8 @@ func (b *_OpcuaVector) CreateOpcuaVectorBuilder() OpcuaVectorBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_OpcuaVector) GetIdentifier() string { - return "18809" +func (m *_OpcuaVector) GetExtensionId() int32 { + return int32(18809) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_OpcuaVector) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OpcuaVector) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__opcuaVector OpcuaVector, err error) { +func (m *_OpcuaVector) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__opcuaVector OpcuaVector, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelRequest.go b/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelRequest.go index f83cf3ed2a4..500e7830089 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelRequest.go @@ -41,7 +41,7 @@ type OpenSecureChannelRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetClientProtocolVersion returns ClientProtocolVersion (property field) GetClientProtocolVersion() uint32 // GetRequestType returns RequestType (property field) @@ -61,7 +61,7 @@ type OpenSecureChannelRequest interface { // _OpenSecureChannelRequest is the data-structure of this message type _OpenSecureChannelRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader ClientProtocolVersion uint32 RequestType SecurityTokenRequestType SecurityMode MessageSecurityMode @@ -73,9 +73,9 @@ var _ OpenSecureChannelRequest = (*_OpenSecureChannelRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_OpenSecureChannelRequest)(nil) // NewOpenSecureChannelRequest factory function for _OpenSecureChannelRequest -func NewOpenSecureChannelRequest(requestHeader ExtensionObjectDefinition, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) *_OpenSecureChannelRequest { +func NewOpenSecureChannelRequest(requestHeader RequestHeader, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) *_OpenSecureChannelRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for OpenSecureChannelRequest must not be nil") + panic("requestHeader of type RequestHeader for OpenSecureChannelRequest must not be nil") } if clientNonce == nil { panic("clientNonce of type PascalByteString for OpenSecureChannelRequest must not be nil") @@ -102,11 +102,11 @@ func NewOpenSecureChannelRequest(requestHeader ExtensionObjectDefinition, client type OpenSecureChannelRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) OpenSecureChannelRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) OpenSecureChannelRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) OpenSecureChannelRequestBuilder + WithRequestHeader(RequestHeader) OpenSecureChannelRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) OpenSecureChannelRequestBuilder // WithClientProtocolVersion adds ClientProtocolVersion (property field) WithClientProtocolVersion(uint32) OpenSecureChannelRequestBuilder // WithRequestType adds RequestType (property field) @@ -144,24 +144,24 @@ func (b *_OpenSecureChannelRequestBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_OpenSecureChannelRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) OpenSecureChannelRequestBuilder { +func (b *_OpenSecureChannelRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, clientProtocolVersion uint32, requestType SecurityTokenRequestType, securityMode MessageSecurityMode, clientNonce PascalByteString, requestedLifetime uint32) OpenSecureChannelRequestBuilder { return b.WithRequestHeader(requestHeader).WithClientProtocolVersion(clientProtocolVersion).WithRequestType(requestType).WithSecurityMode(securityMode).WithClientNonce(clientNonce).WithRequestedLifetime(requestedLifetime) } -func (b *_OpenSecureChannelRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) OpenSecureChannelRequestBuilder { +func (b *_OpenSecureChannelRequestBuilder) WithRequestHeader(requestHeader RequestHeader) OpenSecureChannelRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_OpenSecureChannelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_OpenSecureChannelRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) OpenSecureChannelRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -266,8 +266,8 @@ func (b *_OpenSecureChannelRequest) CreateOpenSecureChannelRequestBuilder() Open /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_OpenSecureChannelRequest) GetIdentifier() string { - return "446" +func (m *_OpenSecureChannelRequest) GetExtensionId() int32 { + return int32(446) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_OpenSecureChannelRequest) GetParent() ExtensionObjectDefinitionContrac /////////////////////// Accessors for property fields. /////////////////////// -func (m *_OpenSecureChannelRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_OpenSecureChannelRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -356,7 +356,7 @@ func (m *_OpenSecureChannelRequest) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_OpenSecureChannelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__openSecureChannelRequest OpenSecureChannelRequest, err error) { +func (m *_OpenSecureChannelRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__openSecureChannelRequest OpenSecureChannelRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -367,7 +367,7 @@ func (m *_OpenSecureChannelRequest) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -428,7 +428,7 @@ func (m *_OpenSecureChannelRequest) SerializeWithWriteBuffer(ctx context.Context return errors.Wrap(pushErr, "Error pushing for OpenSecureChannelRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -472,7 +472,7 @@ func (m *_OpenSecureChannelRequest) deepCopy() *_OpenSecureChannelRequest { } _OpenSecureChannelRequestCopy := &_OpenSecureChannelRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.ClientProtocolVersion, m.RequestType, m.SecurityMode, diff --git a/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelResponse.go b/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelResponse.go index 64be1cfcc63..4d9c9039845 100644 --- a/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/OpenSecureChannelResponse.go @@ -41,11 +41,11 @@ type OpenSecureChannelResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetServerProtocolVersion returns ServerProtocolVersion (property field) GetServerProtocolVersion() uint32 // GetSecurityToken returns SecurityToken (property field) - GetSecurityToken() ExtensionObjectDefinition + GetSecurityToken() ChannelSecurityToken // GetServerNonce returns ServerNonce (property field) GetServerNonce() PascalByteString // IsOpenSecureChannelResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,9 +57,9 @@ type OpenSecureChannelResponse interface { // _OpenSecureChannelResponse is the data-structure of this message type _OpenSecureChannelResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader ServerProtocolVersion uint32 - SecurityToken ExtensionObjectDefinition + SecurityToken ChannelSecurityToken ServerNonce PascalByteString } @@ -67,12 +67,12 @@ var _ OpenSecureChannelResponse = (*_OpenSecureChannelResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_OpenSecureChannelResponse)(nil) // NewOpenSecureChannelResponse factory function for _OpenSecureChannelResponse -func NewOpenSecureChannelResponse(responseHeader ExtensionObjectDefinition, serverProtocolVersion uint32, securityToken ExtensionObjectDefinition, serverNonce PascalByteString) *_OpenSecureChannelResponse { +func NewOpenSecureChannelResponse(responseHeader ResponseHeader, serverProtocolVersion uint32, securityToken ChannelSecurityToken, serverNonce PascalByteString) *_OpenSecureChannelResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for OpenSecureChannelResponse must not be nil") + panic("responseHeader of type ResponseHeader for OpenSecureChannelResponse must not be nil") } if securityToken == nil { - panic("securityToken of type ExtensionObjectDefinition for OpenSecureChannelResponse must not be nil") + panic("securityToken of type ChannelSecurityToken for OpenSecureChannelResponse must not be nil") } if serverNonce == nil { panic("serverNonce of type PascalByteString for OpenSecureChannelResponse must not be nil") @@ -97,17 +97,17 @@ func NewOpenSecureChannelResponse(responseHeader ExtensionObjectDefinition, serv type OpenSecureChannelResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, serverProtocolVersion uint32, securityToken ExtensionObjectDefinition, serverNonce PascalByteString) OpenSecureChannelResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, serverProtocolVersion uint32, securityToken ChannelSecurityToken, serverNonce PascalByteString) OpenSecureChannelResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) OpenSecureChannelResponseBuilder + WithResponseHeader(ResponseHeader) OpenSecureChannelResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) OpenSecureChannelResponseBuilder // WithServerProtocolVersion adds ServerProtocolVersion (property field) WithServerProtocolVersion(uint32) OpenSecureChannelResponseBuilder // WithSecurityToken adds SecurityToken (property field) - WithSecurityToken(ExtensionObjectDefinition) OpenSecureChannelResponseBuilder + WithSecurityToken(ChannelSecurityToken) OpenSecureChannelResponseBuilder // WithSecurityTokenBuilder adds SecurityToken (property field) which is build by the builder - WithSecurityTokenBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelResponseBuilder + WithSecurityTokenBuilder(func(ChannelSecurityTokenBuilder) ChannelSecurityTokenBuilder) OpenSecureChannelResponseBuilder // WithServerNonce adds ServerNonce (property field) WithServerNonce(PascalByteString) OpenSecureChannelResponseBuilder // WithServerNonceBuilder adds ServerNonce (property field) which is build by the builder @@ -137,24 +137,24 @@ func (b *_OpenSecureChannelResponseBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_OpenSecureChannelResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, serverProtocolVersion uint32, securityToken ExtensionObjectDefinition, serverNonce PascalByteString) OpenSecureChannelResponseBuilder { +func (b *_OpenSecureChannelResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, serverProtocolVersion uint32, securityToken ChannelSecurityToken, serverNonce PascalByteString) OpenSecureChannelResponseBuilder { return b.WithResponseHeader(responseHeader).WithServerProtocolVersion(serverProtocolVersion).WithSecurityToken(securityToken).WithServerNonce(serverNonce) } -func (b *_OpenSecureChannelResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) OpenSecureChannelResponseBuilder { +func (b *_OpenSecureChannelResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) OpenSecureChannelResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_OpenSecureChannelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_OpenSecureChannelResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) OpenSecureChannelResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -164,20 +164,20 @@ func (b *_OpenSecureChannelResponseBuilder) WithServerProtocolVersion(serverProt return b } -func (b *_OpenSecureChannelResponseBuilder) WithSecurityToken(securityToken ExtensionObjectDefinition) OpenSecureChannelResponseBuilder { +func (b *_OpenSecureChannelResponseBuilder) WithSecurityToken(securityToken ChannelSecurityToken) OpenSecureChannelResponseBuilder { b.SecurityToken = securityToken return b } -func (b *_OpenSecureChannelResponseBuilder) WithSecurityTokenBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) OpenSecureChannelResponseBuilder { - builder := builderSupplier(b.SecurityToken.CreateExtensionObjectDefinitionBuilder()) +func (b *_OpenSecureChannelResponseBuilder) WithSecurityTokenBuilder(builderSupplier func(ChannelSecurityTokenBuilder) ChannelSecurityTokenBuilder) OpenSecureChannelResponseBuilder { + builder := builderSupplier(b.SecurityToken.CreateChannelSecurityTokenBuilder()) var err error b.SecurityToken, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ChannelSecurityTokenBuilder failed")) } return b } @@ -268,8 +268,8 @@ func (b *_OpenSecureChannelResponse) CreateOpenSecureChannelResponseBuilder() Op /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_OpenSecureChannelResponse) GetIdentifier() string { - return "449" +func (m *_OpenSecureChannelResponse) GetExtensionId() int32 { + return int32(449) } /////////////////////// @@ -286,7 +286,7 @@ func (m *_OpenSecureChannelResponse) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_OpenSecureChannelResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_OpenSecureChannelResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -294,7 +294,7 @@ func (m *_OpenSecureChannelResponse) GetServerProtocolVersion() uint32 { return m.ServerProtocolVersion } -func (m *_OpenSecureChannelResponse) GetSecurityToken() ExtensionObjectDefinition { +func (m *_OpenSecureChannelResponse) GetSecurityToken() ChannelSecurityToken { return m.SecurityToken } @@ -344,7 +344,7 @@ func (m *_OpenSecureChannelResponse) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_OpenSecureChannelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__openSecureChannelResponse OpenSecureChannelResponse, err error) { +func (m *_OpenSecureChannelResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__openSecureChannelResponse OpenSecureChannelResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -355,7 +355,7 @@ func (m *_OpenSecureChannelResponse) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -367,7 +367,7 @@ func (m *_OpenSecureChannelResponse) parse(ctx context.Context, readBuffer utils } m.ServerProtocolVersion = serverProtocolVersion - securityToken, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "securityToken", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("443")), readBuffer)) + securityToken, err := ReadSimpleField[ChannelSecurityToken](ctx, "securityToken", ReadComplex[ChannelSecurityToken](ExtensionObjectDefinitionParseWithBufferProducer[ChannelSecurityToken]((int32)(int32(443))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityToken' field")) } @@ -404,7 +404,7 @@ func (m *_OpenSecureChannelResponse) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for OpenSecureChannelResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -412,7 +412,7 @@ func (m *_OpenSecureChannelResponse) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(err, "Error serializing 'serverProtocolVersion' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "securityToken", m.GetSecurityToken(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ChannelSecurityToken](ctx, "securityToken", m.GetSecurityToken(), WriteComplex[ChannelSecurityToken](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'securityToken' field") } @@ -440,9 +440,9 @@ func (m *_OpenSecureChannelResponse) deepCopy() *_OpenSecureChannelResponse { } _OpenSecureChannelResponseCopy := &_OpenSecureChannelResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.ServerProtocolVersion, - m.SecurityToken.DeepCopy().(ExtensionObjectDefinition), + m.SecurityToken.DeepCopy().(ChannelSecurityToken), m.ServerNonce.DeepCopy().(PascalByteString), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/OptionSet.go b/plc4go/protocols/opcua/readwrite/model/OptionSet.go index 2d8683d91f7..a22e77ca025 100644 --- a/plc4go/protocols/opcua/readwrite/model/OptionSet.go +++ b/plc4go/protocols/opcua/readwrite/model/OptionSet.go @@ -222,8 +222,8 @@ func (b *_OptionSet) CreateOptionSetBuilder() OptionSetBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_OptionSet) GetIdentifier() string { - return "12757" +func (m *_OptionSet) GetExtensionId() int32 { + return int32(12757) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_OptionSet) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_OptionSet) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__optionSet OptionSet, err error) { +func (m *_OptionSet) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__optionSet OptionSet, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/Orientation.go b/plc4go/protocols/opcua/readwrite/model/Orientation.go index 8e876b94e20..efadd199fd0 100644 --- a/plc4go/protocols/opcua/readwrite/model/Orientation.go +++ b/plc4go/protocols/opcua/readwrite/model/Orientation.go @@ -150,8 +150,8 @@ func (b *_Orientation) CreateOrientationBuilder() OrientationBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Orientation) GetIdentifier() string { - return "18813" +func (m *_Orientation) GetExtensionId() int32 { + return int32(18813) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_Orientation) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Orientation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__orientation Orientation, err error) { +func (m *_Orientation) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__orientation Orientation, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ParsingResult.go b/plc4go/protocols/opcua/readwrite/model/ParsingResult.go index 6b0e4230134..b7cce5fbe4c 100644 --- a/plc4go/protocols/opcua/readwrite/model/ParsingResult.go +++ b/plc4go/protocols/opcua/readwrite/model/ParsingResult.go @@ -42,12 +42,8 @@ type ParsingResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfDataStatusCodes returns NoOfDataStatusCodes (property field) - GetNoOfDataStatusCodes() int32 // GetDataStatusCodes returns DataStatusCodes (property field) GetDataStatusCodes() []StatusCode - // GetNoOfDataDiagnosticInfos returns NoOfDataDiagnosticInfos (property field) - GetNoOfDataDiagnosticInfos() int32 // GetDataDiagnosticInfos returns DataDiagnosticInfos (property field) GetDataDiagnosticInfos() []DiagnosticInfo // IsParsingResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type ParsingResult interface { // _ParsingResult is the data-structure of this message type _ParsingResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfDataStatusCodes int32 - DataStatusCodes []StatusCode - NoOfDataDiagnosticInfos int32 - DataDiagnosticInfos []DiagnosticInfo + StatusCode StatusCode + DataStatusCodes []StatusCode + DataDiagnosticInfos []DiagnosticInfo } var _ ParsingResult = (*_ParsingResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ParsingResult)(nil) // NewParsingResult factory function for _ParsingResult -func NewParsingResult(statusCode StatusCode, noOfDataStatusCodes int32, dataStatusCodes []StatusCode, noOfDataDiagnosticInfos int32, dataDiagnosticInfos []DiagnosticInfo) *_ParsingResult { +func NewParsingResult(statusCode StatusCode, dataStatusCodes []StatusCode, dataDiagnosticInfos []DiagnosticInfo) *_ParsingResult { if statusCode == nil { panic("statusCode of type StatusCode for ParsingResult must not be nil") } _result := &_ParsingResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfDataStatusCodes: noOfDataStatusCodes, DataStatusCodes: dataStatusCodes, - NoOfDataDiagnosticInfos: noOfDataDiagnosticInfos, DataDiagnosticInfos: dataDiagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewParsingResult(statusCode StatusCode, noOfDataStatusCodes int32, dataStat type ParsingResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfDataStatusCodes int32, dataStatusCodes []StatusCode, noOfDataDiagnosticInfos int32, dataDiagnosticInfos []DiagnosticInfo) ParsingResultBuilder + WithMandatoryFields(statusCode StatusCode, dataStatusCodes []StatusCode, dataDiagnosticInfos []DiagnosticInfo) ParsingResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) ParsingResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) ParsingResultBuilder - // WithNoOfDataStatusCodes adds NoOfDataStatusCodes (property field) - WithNoOfDataStatusCodes(int32) ParsingResultBuilder // WithDataStatusCodes adds DataStatusCodes (property field) WithDataStatusCodes(...StatusCode) ParsingResultBuilder - // WithNoOfDataDiagnosticInfos adds NoOfDataDiagnosticInfos (property field) - WithNoOfDataDiagnosticInfos(int32) ParsingResultBuilder // WithDataDiagnosticInfos adds DataDiagnosticInfos (property field) WithDataDiagnosticInfos(...DiagnosticInfo) ParsingResultBuilder // Build builds the ParsingResult or returns an error if something is wrong @@ -133,8 +121,8 @@ func (b *_ParsingResultBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_ParsingResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfDataStatusCodes int32, dataStatusCodes []StatusCode, noOfDataDiagnosticInfos int32, dataDiagnosticInfos []DiagnosticInfo) ParsingResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfDataStatusCodes(noOfDataStatusCodes).WithDataStatusCodes(dataStatusCodes...).WithNoOfDataDiagnosticInfos(noOfDataDiagnosticInfos).WithDataDiagnosticInfos(dataDiagnosticInfos...) +func (b *_ParsingResultBuilder) WithMandatoryFields(statusCode StatusCode, dataStatusCodes []StatusCode, dataDiagnosticInfos []DiagnosticInfo) ParsingResultBuilder { + return b.WithStatusCode(statusCode).WithDataStatusCodes(dataStatusCodes...).WithDataDiagnosticInfos(dataDiagnosticInfos...) } func (b *_ParsingResultBuilder) WithStatusCode(statusCode StatusCode) ParsingResultBuilder { @@ -155,21 +143,11 @@ func (b *_ParsingResultBuilder) WithStatusCodeBuilder(builderSupplier func(Statu return b } -func (b *_ParsingResultBuilder) WithNoOfDataStatusCodes(noOfDataStatusCodes int32) ParsingResultBuilder { - b.NoOfDataStatusCodes = noOfDataStatusCodes - return b -} - func (b *_ParsingResultBuilder) WithDataStatusCodes(dataStatusCodes ...StatusCode) ParsingResultBuilder { b.DataStatusCodes = dataStatusCodes return b } -func (b *_ParsingResultBuilder) WithNoOfDataDiagnosticInfos(noOfDataDiagnosticInfos int32) ParsingResultBuilder { - b.NoOfDataDiagnosticInfos = noOfDataDiagnosticInfos - return b -} - func (b *_ParsingResultBuilder) WithDataDiagnosticInfos(dataDiagnosticInfos ...DiagnosticInfo) ParsingResultBuilder { b.DataDiagnosticInfos = dataDiagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_ParsingResult) CreateParsingResultBuilder() ParsingResultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ParsingResult) GetIdentifier() string { - return "612" +func (m *_ParsingResult) GetExtensionId() int32 { + return int32(612) } /////////////////////// @@ -253,18 +231,10 @@ func (m *_ParsingResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_ParsingResult) GetNoOfDataStatusCodes() int32 { - return m.NoOfDataStatusCodes -} - func (m *_ParsingResult) GetDataStatusCodes() []StatusCode { return m.DataStatusCodes } -func (m *_ParsingResult) GetNoOfDataDiagnosticInfos() int32 { - return m.NoOfDataDiagnosticInfos -} - func (m *_ParsingResult) GetDataDiagnosticInfos() []DiagnosticInfo { return m.DataDiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_ParsingResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfDataStatusCodes) + // Implicit Field (noOfDataStatusCodes) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_ParsingResult) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDataDiagnosticInfos) + // Implicit Field (noOfDataDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_ParsingResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ParsingResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__parsingResult ParsingResult, err error) { +func (m *_ParsingResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__parsingResult ParsingResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -345,11 +315,11 @@ func (m *_ParsingResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.StatusCode = statusCode - noOfDataStatusCodes, err := ReadSimpleField(ctx, "noOfDataStatusCodes", ReadSignedInt(readBuffer, uint8(32))) + noOfDataStatusCodes, err := ReadImplicitField[int32](ctx, "noOfDataStatusCodes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataStatusCodes' field")) } - m.NoOfDataStatusCodes = noOfDataStatusCodes + _ = noOfDataStatusCodes dataStatusCodes, err := ReadCountArrayField[StatusCode](ctx, "dataStatusCodes", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfDataStatusCodes)) if err != nil { @@ -357,11 +327,11 @@ func (m *_ParsingResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.DataStatusCodes = dataStatusCodes - noOfDataDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDataDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDataDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDataDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataDiagnosticInfos' field")) } - m.NoOfDataDiagnosticInfos = noOfDataDiagnosticInfos + _ = noOfDataDiagnosticInfos dataDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "dataDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDataDiagnosticInfos)) if err != nil { @@ -397,16 +367,16 @@ func (m *_ParsingResult) SerializeWithWriteBuffer(ctx context.Context, writeBuff if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDataStatusCodes", m.GetNoOfDataStatusCodes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDataStatusCodes := int32(utils.InlineIf(bool((m.GetDataStatusCodes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataStatusCodes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataStatusCodes", noOfDataStatusCodes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDataStatusCodes' field") } if err := WriteComplexTypeArrayField(ctx, "dataStatusCodes", m.GetDataStatusCodes(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'dataStatusCodes' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDataDiagnosticInfos", m.GetNoOfDataDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDataDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDataDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataDiagnosticInfos", noOfDataDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDataDiagnosticInfos' field") } @@ -435,9 +405,7 @@ func (m *_ParsingResult) deepCopy() *_ParsingResult { _ParsingResultCopy := &_ParsingResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfDataStatusCodes, utils.DeepCopySlice[StatusCode, StatusCode](m.DataStatusCodes), - m.NoOfDataDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DataDiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/PascalString.go b/plc4go/protocols/opcua/readwrite/model/PascalString.go index b8690659db0..f8465b37116 100644 --- a/plc4go/protocols/opcua/readwrite/model/PascalString.go +++ b/plc4go/protocols/opcua/readwrite/model/PascalString.go @@ -40,7 +40,7 @@ type PascalString interface { utils.Serializable utils.Copyable // GetStringValue returns StringValue (property field) - GetStringValue() string + GetStringValue() *string // GetStringLength returns StringLength (virtual field) GetStringLength() int32 // IsPascalString is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -51,13 +51,13 @@ type PascalString interface { // _PascalString is the data-structure of this message type _PascalString struct { - StringValue string + StringValue *string } var _ PascalString = (*_PascalString)(nil) // NewPascalString factory function for _PascalString -func NewPascalString(stringValue string) *_PascalString { +func NewPascalString(stringValue *string) *_PascalString { return &_PascalString{StringValue: stringValue} } @@ -70,9 +70,9 @@ func NewPascalString(stringValue string) *_PascalString { type PascalStringBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(stringValue string) PascalStringBuilder + WithMandatoryFields() PascalStringBuilder // WithStringValue adds StringValue (property field) - WithStringValue(string) PascalStringBuilder + WithOptionalStringValue(string) PascalStringBuilder // Build builds the PascalString or returns an error if something is wrong Build() (PascalString, error) // MustBuild does the same as Build but panics on error @@ -92,12 +92,12 @@ type _PascalStringBuilder struct { var _ (PascalStringBuilder) = (*_PascalStringBuilder)(nil) -func (b *_PascalStringBuilder) WithMandatoryFields(stringValue string) PascalStringBuilder { - return b.WithStringValue(stringValue) +func (b *_PascalStringBuilder) WithMandatoryFields() PascalStringBuilder { + return b } -func (b *_PascalStringBuilder) WithStringValue(stringValue string) PascalStringBuilder { - b.StringValue = stringValue +func (b *_PascalStringBuilder) WithOptionalStringValue(stringValue string) PascalStringBuilder { + b.StringValue = &stringValue return b } @@ -142,7 +142,7 @@ func (b *_PascalString) CreatePascalStringBuilder() PascalStringBuilder { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_PascalString) GetStringValue() string { +func (m *_PascalString) GetStringValue() *string { return m.StringValue } @@ -158,7 +158,9 @@ func (m *_PascalString) GetStringValue() string { func (m *_PascalString) GetStringLength() int32 { ctx := context.Background() _ = ctx - return int32(PascalLengthToUtf8Length(ctx, Utf8LengthToPascalLength(ctx, m.GetStringValue()))) + stringValue := m.GetStringValue() + _ = stringValue + return int32(PascalLengthToUtf8Length(ctx, Utf8LengthToPascalLength(ctx, (*m.GetStringValue())))) } /////////////////////// @@ -189,8 +191,10 @@ func (m *_PascalString) GetLengthInBits(ctx context.Context) uint16 { // A virtual field doesn't have any in- or output. - // Simple field (stringValue) - lengthInBits += uint16(int32(m.GetStringLength()) * int32(int32(8))) + // Optional Field (stringValue) + if m.StringValue != nil { + lengthInBits += 0 + } return lengthInBits } @@ -238,7 +242,8 @@ func (m *_PascalString) parse(ctx context.Context, readBuffer utils.ReadBuffer) } _ = stringLength - stringValue, err := ReadSimpleField(ctx, "stringValue", ReadString(readBuffer, uint32(int32(stringLength)*int32(int32(8))))) + var stringValue *string + stringValue, err = ReadOptionalField[string](ctx, "stringValue", ReadString(readBuffer, uint32(int32(stringLength)*int32(int32(8)))), bool((sLength) != (-(1)))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'stringValue' field")) } @@ -267,7 +272,7 @@ func (m *_PascalString) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if pushErr := writeBuffer.PushContext("PascalString"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for PascalString") } - sLength := int32(Utf8LengthToPascalLength(ctx, m.GetStringValue())) + sLength := int32(Utf8LengthToPascalLength(ctx, (*m.GetStringValue()))) if err := WriteImplicitField(ctx, "sLength", sLength, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'sLength' field") } @@ -278,7 +283,7 @@ func (m *_PascalString) SerializeWithWriteBuffer(ctx context.Context, writeBuffe return errors.Wrap(_stringLengthErr, "Error serializing 'stringLength' field") } - if err := WriteSimpleField[string](ctx, "stringValue", m.GetStringValue(), WriteString(writeBuffer, int32(int32(m.GetStringLength())*int32(int32(8))))); err != nil { + if err := WriteOptionalField[string](ctx, "stringValue", m.GetStringValue(), WriteString(writeBuffer, int32(int32(m.GetStringLength())*int32(int32(8)))), true); err != nil { return errors.Wrap(err, "Error serializing 'stringValue' field") } @@ -299,7 +304,7 @@ func (m *_PascalString) deepCopy() *_PascalString { return nil } _PascalStringCopy := &_PascalString{ - m.StringValue, + utils.CopyPtr[string](m.StringValue), } return _PascalStringCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/Payload.go b/plc4go/protocols/opcua/readwrite/model/Payload.go index 9626eeec3cc..5c310182e5b 100644 --- a/plc4go/protocols/opcua/readwrite/model/Payload.go +++ b/plc4go/protocols/opcua/readwrite/model/Payload.go @@ -63,8 +63,8 @@ type PayloadContract interface { type PayloadRequirements interface { GetLengthInBits(ctx context.Context) uint16 GetLengthInBytes(ctx context.Context) uint16 - // GetExtensible returns Extensible (discriminator field) - GetExtensible() bool + // GetBinary returns Binary (discriminator field) + GetBinary() bool } // _Payload is the data-structure of this message @@ -308,13 +308,13 @@ func (m *_Payload) GetLengthInBytes(ctx context.Context) uint16 { return m._SubType.GetLengthInBits(ctx) / 8 } -func PayloadParse[T Payload](ctx context.Context, theBytes []byte, extensible bool, byteCount uint32) (T, error) { - return PayloadParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), extensible, byteCount) +func PayloadParse[T Payload](ctx context.Context, theBytes []byte, binary bool, byteCount uint32) (T, error) { + return PayloadParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), binary, byteCount) } -func PayloadParseWithBufferProducer[T Payload](extensible bool, byteCount uint32) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { +func PayloadParseWithBufferProducer[T Payload](binary bool, byteCount uint32) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { return func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { - v, err := PayloadParseWithBuffer[T](ctx, readBuffer, extensible, byteCount) + v, err := PayloadParseWithBuffer[T](ctx, readBuffer, binary, byteCount) if err != nil { var zero T return zero, err @@ -323,8 +323,8 @@ func PayloadParseWithBufferProducer[T Payload](extensible bool, byteCount uint32 } } -func PayloadParseWithBuffer[T Payload](ctx context.Context, readBuffer utils.ReadBuffer, extensible bool, byteCount uint32) (T, error) { - v, err := (&_Payload{ByteCount: byteCount}).parse(ctx, readBuffer, extensible, byteCount) +func PayloadParseWithBuffer[T Payload](ctx context.Context, readBuffer utils.ReadBuffer, binary bool, byteCount uint32) (T, error) { + v, err := (&_Payload{ByteCount: byteCount}).parse(ctx, readBuffer, binary, byteCount) if err != nil { var zero T return zero, err @@ -337,7 +337,7 @@ func PayloadParseWithBuffer[T Payload](ctx context.Context, readBuffer utils.Rea return vc, nil } -func (m *_Payload) parse(ctx context.Context, readBuffer utils.ReadBuffer, extensible bool, byteCount uint32) (__payload Payload, err error) { +func (m *_Payload) parse(ctx context.Context, readBuffer utils.ReadBuffer, binary bool, byteCount uint32) (__payload Payload, err error) { positionAware := readBuffer _ = positionAware if pullErr := readBuffer.PullContext("Payload"); pullErr != nil { @@ -355,16 +355,16 @@ func (m *_Payload) parse(ctx context.Context, readBuffer utils.ReadBuffer, exten // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) var _child Payload switch { - case extensible == bool(true): // ExtensiblePayload - if _child, err = new(_ExtensiblePayload).parse(ctx, readBuffer, m, extensible, byteCount); err != nil { + case binary == bool(false): // ExtensiblePayload + if _child, err = new(_ExtensiblePayload).parse(ctx, readBuffer, m, binary, byteCount); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type ExtensiblePayload for type-switch of Payload") } - case extensible == bool(false): // BinaryPayload - if _child, err = new(_BinaryPayload).parse(ctx, readBuffer, m, extensible, byteCount); err != nil { + case binary == bool(true): // BinaryPayload + if _child, err = new(_BinaryPayload).parse(ctx, readBuffer, m, binary, byteCount); err != nil { return nil, errors.Wrap(err, "Error parsing sub-type BinaryPayload for type-switch of Payload") } default: - return nil, errors.Errorf("Unmapped type for parameters [extensible=%v]", extensible) + return nil, errors.Errorf("Unmapped type for parameters [binary=%v]", binary) } if closeErr := readBuffer.CloseContext("Payload"); closeErr != nil { diff --git a/plc4go/protocols/opcua/readwrite/model/PortableNodeId.go b/plc4go/protocols/opcua/readwrite/model/PortableNodeId.go new file mode 100644 index 00000000000..505909e8704 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PortableNodeId.go @@ -0,0 +1,383 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PortableNodeId is the corresponding interface of PortableNodeId +type PortableNodeId interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNamespaceUri returns NamespaceUri (property field) + GetNamespaceUri() PascalString + // GetIdentifier returns Identifier (property field) + GetIdentifier() NodeId + // IsPortableNodeId is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPortableNodeId() + // CreateBuilder creates a PortableNodeIdBuilder + CreatePortableNodeIdBuilder() PortableNodeIdBuilder +} + +// _PortableNodeId is the data-structure of this message +type _PortableNodeId struct { + ExtensionObjectDefinitionContract + NamespaceUri PascalString + Identifier NodeId +} + +var _ PortableNodeId = (*_PortableNodeId)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PortableNodeId)(nil) + +// NewPortableNodeId factory function for _PortableNodeId +func NewPortableNodeId(namespaceUri PascalString, identifier NodeId) *_PortableNodeId { + if namespaceUri == nil { + panic("namespaceUri of type PascalString for PortableNodeId must not be nil") + } + if identifier == nil { + panic("identifier of type NodeId for PortableNodeId must not be nil") + } + _result := &_PortableNodeId{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NamespaceUri: namespaceUri, + Identifier: identifier, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PortableNodeIdBuilder is a builder for PortableNodeId +type PortableNodeIdBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(namespaceUri PascalString, identifier NodeId) PortableNodeIdBuilder + // WithNamespaceUri adds NamespaceUri (property field) + WithNamespaceUri(PascalString) PortableNodeIdBuilder + // WithNamespaceUriBuilder adds NamespaceUri (property field) which is build by the builder + WithNamespaceUriBuilder(func(PascalStringBuilder) PascalStringBuilder) PortableNodeIdBuilder + // WithIdentifier adds Identifier (property field) + WithIdentifier(NodeId) PortableNodeIdBuilder + // WithIdentifierBuilder adds Identifier (property field) which is build by the builder + WithIdentifierBuilder(func(NodeIdBuilder) NodeIdBuilder) PortableNodeIdBuilder + // Build builds the PortableNodeId or returns an error if something is wrong + Build() (PortableNodeId, error) + // MustBuild does the same as Build but panics on error + MustBuild() PortableNodeId +} + +// NewPortableNodeIdBuilder() creates a PortableNodeIdBuilder +func NewPortableNodeIdBuilder() PortableNodeIdBuilder { + return &_PortableNodeIdBuilder{_PortableNodeId: new(_PortableNodeId)} +} + +type _PortableNodeIdBuilder struct { + *_PortableNodeId + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PortableNodeIdBuilder) = (*_PortableNodeIdBuilder)(nil) + +func (b *_PortableNodeIdBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PortableNodeIdBuilder) WithMandatoryFields(namespaceUri PascalString, identifier NodeId) PortableNodeIdBuilder { + return b.WithNamespaceUri(namespaceUri).WithIdentifier(identifier) +} + +func (b *_PortableNodeIdBuilder) WithNamespaceUri(namespaceUri PascalString) PortableNodeIdBuilder { + b.NamespaceUri = namespaceUri + return b +} + +func (b *_PortableNodeIdBuilder) WithNamespaceUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) PortableNodeIdBuilder { + builder := builderSupplier(b.NamespaceUri.CreatePascalStringBuilder()) + var err error + b.NamespaceUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_PortableNodeIdBuilder) WithIdentifier(identifier NodeId) PortableNodeIdBuilder { + b.Identifier = identifier + return b +} + +func (b *_PortableNodeIdBuilder) WithIdentifierBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) PortableNodeIdBuilder { + builder := builderSupplier(b.Identifier.CreateNodeIdBuilder()) + var err error + b.Identifier, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_PortableNodeIdBuilder) Build() (PortableNodeId, error) { + if b.NamespaceUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'namespaceUri' not set")) + } + if b.Identifier == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'identifier' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PortableNodeId.deepCopy(), nil +} + +func (b *_PortableNodeIdBuilder) MustBuild() PortableNodeId { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PortableNodeIdBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PortableNodeIdBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PortableNodeIdBuilder) DeepCopy() any { + _copy := b.CreatePortableNodeIdBuilder().(*_PortableNodeIdBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePortableNodeIdBuilder creates a PortableNodeIdBuilder +func (b *_PortableNodeId) CreatePortableNodeIdBuilder() PortableNodeIdBuilder { + if b == nil { + return NewPortableNodeIdBuilder() + } + return &_PortableNodeIdBuilder{_PortableNodeId: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PortableNodeId) GetExtensionId() int32 { + return int32(24108) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PortableNodeId) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PortableNodeId) GetNamespaceUri() PascalString { + return m.NamespaceUri +} + +func (m *_PortableNodeId) GetIdentifier() NodeId { + return m.Identifier +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPortableNodeId(structType any) PortableNodeId { + if casted, ok := structType.(PortableNodeId); ok { + return casted + } + if casted, ok := structType.(*PortableNodeId); ok { + return *casted + } + return nil +} + +func (m *_PortableNodeId) GetTypeName() string { + return "PortableNodeId" +} + +func (m *_PortableNodeId) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (namespaceUri) + lengthInBits += m.NamespaceUri.GetLengthInBits(ctx) + + // Simple field (identifier) + lengthInBits += m.Identifier.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_PortableNodeId) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PortableNodeId) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__portableNodeId PortableNodeId, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PortableNodeId"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PortableNodeId") + } + currentPos := positionAware.GetPos() + _ = currentPos + + namespaceUri, err := ReadSimpleField[PascalString](ctx, "namespaceUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespaceUri' field")) + } + m.NamespaceUri = namespaceUri + + identifier, err := ReadSimpleField[NodeId](ctx, "identifier", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'identifier' field")) + } + m.Identifier = identifier + + if closeErr := readBuffer.CloseContext("PortableNodeId"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PortableNodeId") + } + + return m, nil +} + +func (m *_PortableNodeId) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PortableNodeId) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PortableNodeId"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PortableNodeId") + } + + if err := WriteSimpleField[PascalString](ctx, "namespaceUri", m.GetNamespaceUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'namespaceUri' field") + } + + if err := WriteSimpleField[NodeId](ctx, "identifier", m.GetIdentifier(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'identifier' field") + } + + if popErr := writeBuffer.PopContext("PortableNodeId"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PortableNodeId") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PortableNodeId) IsPortableNodeId() {} + +func (m *_PortableNodeId) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PortableNodeId) deepCopy() *_PortableNodeId { + if m == nil { + return nil + } + _PortableNodeIdCopy := &_PortableNodeId{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NamespaceUri.DeepCopy().(PascalString), + m.Identifier.DeepCopy().(NodeId), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PortableNodeIdCopy +} + +func (m *_PortableNodeId) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PortableQualifiedName.go b/plc4go/protocols/opcua/readwrite/model/PortableQualifiedName.go index 2c3ebfd7c57..8698f817ccc 100644 --- a/plc4go/protocols/opcua/readwrite/model/PortableQualifiedName.go +++ b/plc4go/protocols/opcua/readwrite/model/PortableQualifiedName.go @@ -222,8 +222,8 @@ func (b *_PortableQualifiedName) CreatePortableQualifiedNameBuilder() PortableQu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PortableQualifiedName) GetIdentifier() string { - return "24107" +func (m *_PortableQualifiedName) GetExtensionId() int32 { + return int32(24107) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_PortableQualifiedName) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_PortableQualifiedName) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__portableQualifiedName PortableQualifiedName, err error) { +func (m *_PortableQualifiedName) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__portableQualifiedName PortableQualifiedName, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/PriorityMappingEntryType.go b/plc4go/protocols/opcua/readwrite/model/PriorityMappingEntryType.go index 00a52cd77cf..d3a011da4d2 100644 --- a/plc4go/protocols/opcua/readwrite/model/PriorityMappingEntryType.go +++ b/plc4go/protocols/opcua/readwrite/model/PriorityMappingEntryType.go @@ -244,8 +244,8 @@ func (b *_PriorityMappingEntryType) CreatePriorityMappingEntryTypeBuilder() Prio /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PriorityMappingEntryType) GetIdentifier() string { - return "25222" +func (m *_PriorityMappingEntryType) GetExtensionId() int32 { + return int32(25222) } /////////////////////// @@ -320,7 +320,7 @@ func (m *_PriorityMappingEntryType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_PriorityMappingEntryType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__priorityMappingEntryType PriorityMappingEntryType, err error) { +func (m *_PriorityMappingEntryType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__priorityMappingEntryType PriorityMappingEntryType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ProgramDiagnostic2DataType.go b/plc4go/protocols/opcua/readwrite/model/ProgramDiagnostic2DataType.go index 0e9e4952af5..d802d0358ef 100644 --- a/plc4go/protocols/opcua/readwrite/model/ProgramDiagnostic2DataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ProgramDiagnostic2DataType.go @@ -52,20 +52,12 @@ type ProgramDiagnostic2DataType interface { GetLastMethodCall() PascalString // GetLastMethodSessionId returns LastMethodSessionId (property field) GetLastMethodSessionId() NodeId - // GetNoOfLastMethodInputArguments returns NoOfLastMethodInputArguments (property field) - GetNoOfLastMethodInputArguments() int32 // GetLastMethodInputArguments returns LastMethodInputArguments (property field) - GetLastMethodInputArguments() []ExtensionObjectDefinition - // GetNoOfLastMethodOutputArguments returns NoOfLastMethodOutputArguments (property field) - GetNoOfLastMethodOutputArguments() int32 + GetLastMethodInputArguments() []Argument // GetLastMethodOutputArguments returns LastMethodOutputArguments (property field) - GetLastMethodOutputArguments() []ExtensionObjectDefinition - // GetNoOfLastMethodInputValues returns NoOfLastMethodInputValues (property field) - GetNoOfLastMethodInputValues() int32 + GetLastMethodOutputArguments() []Argument // GetLastMethodInputValues returns LastMethodInputValues (property field) GetLastMethodInputValues() []Variant - // GetNoOfLastMethodOutputValues returns NoOfLastMethodOutputValues (property field) - GetNoOfLastMethodOutputValues() int32 // GetLastMethodOutputValues returns LastMethodOutputValues (property field) GetLastMethodOutputValues() []Variant // GetLastMethodCallTime returns LastMethodCallTime (property field) @@ -81,29 +73,25 @@ type ProgramDiagnostic2DataType interface { // _ProgramDiagnostic2DataType is the data-structure of this message type _ProgramDiagnostic2DataType struct { ExtensionObjectDefinitionContract - CreateSessionId NodeId - CreateClientName PascalString - InvocationCreationTime int64 - LastTransitionTime int64 - LastMethodCall PascalString - LastMethodSessionId NodeId - NoOfLastMethodInputArguments int32 - LastMethodInputArguments []ExtensionObjectDefinition - NoOfLastMethodOutputArguments int32 - LastMethodOutputArguments []ExtensionObjectDefinition - NoOfLastMethodInputValues int32 - LastMethodInputValues []Variant - NoOfLastMethodOutputValues int32 - LastMethodOutputValues []Variant - LastMethodCallTime int64 - LastMethodReturnStatus StatusCode + CreateSessionId NodeId + CreateClientName PascalString + InvocationCreationTime int64 + LastTransitionTime int64 + LastMethodCall PascalString + LastMethodSessionId NodeId + LastMethodInputArguments []Argument + LastMethodOutputArguments []Argument + LastMethodInputValues []Variant + LastMethodOutputValues []Variant + LastMethodCallTime int64 + LastMethodReturnStatus StatusCode } var _ ProgramDiagnostic2DataType = (*_ProgramDiagnostic2DataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ProgramDiagnostic2DataType)(nil) // NewProgramDiagnostic2DataType factory function for _ProgramDiagnostic2DataType -func NewProgramDiagnostic2DataType(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, noOfLastMethodInputValues int32, lastMethodInputValues []Variant, noOfLastMethodOutputValues int32, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) *_ProgramDiagnostic2DataType { +func NewProgramDiagnostic2DataType(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodInputValues []Variant, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) *_ProgramDiagnostic2DataType { if createSessionId == nil { panic("createSessionId of type NodeId for ProgramDiagnostic2DataType must not be nil") } @@ -127,13 +115,9 @@ func NewProgramDiagnostic2DataType(createSessionId NodeId, createClientName Pasc LastTransitionTime: lastTransitionTime, LastMethodCall: lastMethodCall, LastMethodSessionId: lastMethodSessionId, - NoOfLastMethodInputArguments: noOfLastMethodInputArguments, LastMethodInputArguments: lastMethodInputArguments, - NoOfLastMethodOutputArguments: noOfLastMethodOutputArguments, LastMethodOutputArguments: lastMethodOutputArguments, - NoOfLastMethodInputValues: noOfLastMethodInputValues, LastMethodInputValues: lastMethodInputValues, - NoOfLastMethodOutputValues: noOfLastMethodOutputValues, LastMethodOutputValues: lastMethodOutputValues, LastMethodCallTime: lastMethodCallTime, LastMethodReturnStatus: lastMethodReturnStatus, @@ -151,7 +135,7 @@ func NewProgramDiagnostic2DataType(createSessionId NodeId, createClientName Pasc type ProgramDiagnostic2DataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, noOfLastMethodInputValues int32, lastMethodInputValues []Variant, noOfLastMethodOutputValues int32, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) ProgramDiagnostic2DataTypeBuilder + WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodInputValues []Variant, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) ProgramDiagnostic2DataTypeBuilder // WithCreateSessionId adds CreateSessionId (property field) WithCreateSessionId(NodeId) ProgramDiagnostic2DataTypeBuilder // WithCreateSessionIdBuilder adds CreateSessionId (property field) which is build by the builder @@ -172,20 +156,12 @@ type ProgramDiagnostic2DataTypeBuilder interface { WithLastMethodSessionId(NodeId) ProgramDiagnostic2DataTypeBuilder // WithLastMethodSessionIdBuilder adds LastMethodSessionId (property field) which is build by the builder WithLastMethodSessionIdBuilder(func(NodeIdBuilder) NodeIdBuilder) ProgramDiagnostic2DataTypeBuilder - // WithNoOfLastMethodInputArguments adds NoOfLastMethodInputArguments (property field) - WithNoOfLastMethodInputArguments(int32) ProgramDiagnostic2DataTypeBuilder // WithLastMethodInputArguments adds LastMethodInputArguments (property field) - WithLastMethodInputArguments(...ExtensionObjectDefinition) ProgramDiagnostic2DataTypeBuilder - // WithNoOfLastMethodOutputArguments adds NoOfLastMethodOutputArguments (property field) - WithNoOfLastMethodOutputArguments(int32) ProgramDiagnostic2DataTypeBuilder + WithLastMethodInputArguments(...Argument) ProgramDiagnostic2DataTypeBuilder // WithLastMethodOutputArguments adds LastMethodOutputArguments (property field) - WithLastMethodOutputArguments(...ExtensionObjectDefinition) ProgramDiagnostic2DataTypeBuilder - // WithNoOfLastMethodInputValues adds NoOfLastMethodInputValues (property field) - WithNoOfLastMethodInputValues(int32) ProgramDiagnostic2DataTypeBuilder + WithLastMethodOutputArguments(...Argument) ProgramDiagnostic2DataTypeBuilder // WithLastMethodInputValues adds LastMethodInputValues (property field) WithLastMethodInputValues(...Variant) ProgramDiagnostic2DataTypeBuilder - // WithNoOfLastMethodOutputValues adds NoOfLastMethodOutputValues (property field) - WithNoOfLastMethodOutputValues(int32) ProgramDiagnostic2DataTypeBuilder // WithLastMethodOutputValues adds LastMethodOutputValues (property field) WithLastMethodOutputValues(...Variant) ProgramDiagnostic2DataTypeBuilder // WithLastMethodCallTime adds LastMethodCallTime (property field) @@ -219,8 +195,8 @@ func (b *_ProgramDiagnostic2DataTypeBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_ProgramDiagnostic2DataTypeBuilder) WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, noOfLastMethodInputValues int32, lastMethodInputValues []Variant, noOfLastMethodOutputValues int32, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) ProgramDiagnostic2DataTypeBuilder { - return b.WithCreateSessionId(createSessionId).WithCreateClientName(createClientName).WithInvocationCreationTime(invocationCreationTime).WithLastTransitionTime(lastTransitionTime).WithLastMethodCall(lastMethodCall).WithLastMethodSessionId(lastMethodSessionId).WithNoOfLastMethodInputArguments(noOfLastMethodInputArguments).WithLastMethodInputArguments(lastMethodInputArguments...).WithNoOfLastMethodOutputArguments(noOfLastMethodOutputArguments).WithLastMethodOutputArguments(lastMethodOutputArguments...).WithNoOfLastMethodInputValues(noOfLastMethodInputValues).WithLastMethodInputValues(lastMethodInputValues...).WithNoOfLastMethodOutputValues(noOfLastMethodOutputValues).WithLastMethodOutputValues(lastMethodOutputValues...).WithLastMethodCallTime(lastMethodCallTime).WithLastMethodReturnStatus(lastMethodReturnStatus) +func (b *_ProgramDiagnostic2DataTypeBuilder) WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodInputValues []Variant, lastMethodOutputValues []Variant, lastMethodCallTime int64, lastMethodReturnStatus StatusCode) ProgramDiagnostic2DataTypeBuilder { + return b.WithCreateSessionId(createSessionId).WithCreateClientName(createClientName).WithInvocationCreationTime(invocationCreationTime).WithLastTransitionTime(lastTransitionTime).WithLastMethodCall(lastMethodCall).WithLastMethodSessionId(lastMethodSessionId).WithLastMethodInputArguments(lastMethodInputArguments...).WithLastMethodOutputArguments(lastMethodOutputArguments...).WithLastMethodInputValues(lastMethodInputValues...).WithLastMethodOutputValues(lastMethodOutputValues...).WithLastMethodCallTime(lastMethodCallTime).WithLastMethodReturnStatus(lastMethodReturnStatus) } func (b *_ProgramDiagnostic2DataTypeBuilder) WithCreateSessionId(createSessionId NodeId) ProgramDiagnostic2DataTypeBuilder { @@ -305,41 +281,21 @@ func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodSessionIdBuilder(buil return b } -func (b *_ProgramDiagnostic2DataTypeBuilder) WithNoOfLastMethodInputArguments(noOfLastMethodInputArguments int32) ProgramDiagnostic2DataTypeBuilder { - b.NoOfLastMethodInputArguments = noOfLastMethodInputArguments - return b -} - -func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodInputArguments(lastMethodInputArguments ...ExtensionObjectDefinition) ProgramDiagnostic2DataTypeBuilder { +func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodInputArguments(lastMethodInputArguments ...Argument) ProgramDiagnostic2DataTypeBuilder { b.LastMethodInputArguments = lastMethodInputArguments return b } -func (b *_ProgramDiagnostic2DataTypeBuilder) WithNoOfLastMethodOutputArguments(noOfLastMethodOutputArguments int32) ProgramDiagnostic2DataTypeBuilder { - b.NoOfLastMethodOutputArguments = noOfLastMethodOutputArguments - return b -} - -func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodOutputArguments(lastMethodOutputArguments ...ExtensionObjectDefinition) ProgramDiagnostic2DataTypeBuilder { +func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodOutputArguments(lastMethodOutputArguments ...Argument) ProgramDiagnostic2DataTypeBuilder { b.LastMethodOutputArguments = lastMethodOutputArguments return b } -func (b *_ProgramDiagnostic2DataTypeBuilder) WithNoOfLastMethodInputValues(noOfLastMethodInputValues int32) ProgramDiagnostic2DataTypeBuilder { - b.NoOfLastMethodInputValues = noOfLastMethodInputValues - return b -} - func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodInputValues(lastMethodInputValues ...Variant) ProgramDiagnostic2DataTypeBuilder { b.LastMethodInputValues = lastMethodInputValues return b } -func (b *_ProgramDiagnostic2DataTypeBuilder) WithNoOfLastMethodOutputValues(noOfLastMethodOutputValues int32) ProgramDiagnostic2DataTypeBuilder { - b.NoOfLastMethodOutputValues = noOfLastMethodOutputValues - return b -} - func (b *_ProgramDiagnostic2DataTypeBuilder) WithLastMethodOutputValues(lastMethodOutputValues ...Variant) ProgramDiagnostic2DataTypeBuilder { b.LastMethodOutputValues = lastMethodOutputValues return b @@ -448,8 +404,8 @@ func (b *_ProgramDiagnostic2DataType) CreateProgramDiagnostic2DataTypeBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ProgramDiagnostic2DataType) GetIdentifier() string { - return "24035" +func (m *_ProgramDiagnostic2DataType) GetExtensionId() int32 { + return int32(24035) } /////////////////////// @@ -490,34 +446,18 @@ func (m *_ProgramDiagnostic2DataType) GetLastMethodSessionId() NodeId { return m.LastMethodSessionId } -func (m *_ProgramDiagnostic2DataType) GetNoOfLastMethodInputArguments() int32 { - return m.NoOfLastMethodInputArguments -} - -func (m *_ProgramDiagnostic2DataType) GetLastMethodInputArguments() []ExtensionObjectDefinition { +func (m *_ProgramDiagnostic2DataType) GetLastMethodInputArguments() []Argument { return m.LastMethodInputArguments } -func (m *_ProgramDiagnostic2DataType) GetNoOfLastMethodOutputArguments() int32 { - return m.NoOfLastMethodOutputArguments -} - -func (m *_ProgramDiagnostic2DataType) GetLastMethodOutputArguments() []ExtensionObjectDefinition { +func (m *_ProgramDiagnostic2DataType) GetLastMethodOutputArguments() []Argument { return m.LastMethodOutputArguments } -func (m *_ProgramDiagnostic2DataType) GetNoOfLastMethodInputValues() int32 { - return m.NoOfLastMethodInputValues -} - func (m *_ProgramDiagnostic2DataType) GetLastMethodInputValues() []Variant { return m.LastMethodInputValues } -func (m *_ProgramDiagnostic2DataType) GetNoOfLastMethodOutputValues() int32 { - return m.NoOfLastMethodOutputValues -} - func (m *_ProgramDiagnostic2DataType) GetLastMethodOutputValues() []Variant { return m.LastMethodOutputValues } @@ -571,7 +511,7 @@ func (m *_ProgramDiagnostic2DataType) GetLengthInBits(ctx context.Context) uint1 // Simple field (lastMethodSessionId) lengthInBits += m.LastMethodSessionId.GetLengthInBits(ctx) - // Simple field (noOfLastMethodInputArguments) + // Implicit Field (noOfLastMethodInputArguments) lengthInBits += 32 // Array field @@ -584,7 +524,7 @@ func (m *_ProgramDiagnostic2DataType) GetLengthInBits(ctx context.Context) uint1 } } - // Simple field (noOfLastMethodOutputArguments) + // Implicit Field (noOfLastMethodOutputArguments) lengthInBits += 32 // Array field @@ -597,7 +537,7 @@ func (m *_ProgramDiagnostic2DataType) GetLengthInBits(ctx context.Context) uint1 } } - // Simple field (noOfLastMethodInputValues) + // Implicit Field (noOfLastMethodInputValues) lengthInBits += 32 // Array field @@ -610,7 +550,7 @@ func (m *_ProgramDiagnostic2DataType) GetLengthInBits(ctx context.Context) uint1 } } - // Simple field (noOfLastMethodOutputValues) + // Implicit Field (noOfLastMethodOutputValues) lengthInBits += 32 // Array field @@ -636,7 +576,7 @@ func (m *_ProgramDiagnostic2DataType) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_ProgramDiagnostic2DataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__programDiagnostic2DataType ProgramDiagnostic2DataType, err error) { +func (m *_ProgramDiagnostic2DataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__programDiagnostic2DataType ProgramDiagnostic2DataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -683,35 +623,35 @@ func (m *_ProgramDiagnostic2DataType) parse(ctx context.Context, readBuffer util } m.LastMethodSessionId = lastMethodSessionId - noOfLastMethodInputArguments, err := ReadSimpleField(ctx, "noOfLastMethodInputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodInputArguments, err := ReadImplicitField[int32](ctx, "noOfLastMethodInputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodInputArguments' field")) } - m.NoOfLastMethodInputArguments = noOfLastMethodInputArguments + _ = noOfLastMethodInputArguments - lastMethodInputArguments, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "lastMethodInputArguments", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("298")), readBuffer), uint64(noOfLastMethodInputArguments)) + lastMethodInputArguments, err := ReadCountArrayField[Argument](ctx, "lastMethodInputArguments", ReadComplex[Argument](ExtensionObjectDefinitionParseWithBufferProducer[Argument]((int32)(int32(298))), readBuffer), uint64(noOfLastMethodInputArguments)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'lastMethodInputArguments' field")) } m.LastMethodInputArguments = lastMethodInputArguments - noOfLastMethodOutputArguments, err := ReadSimpleField(ctx, "noOfLastMethodOutputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodOutputArguments, err := ReadImplicitField[int32](ctx, "noOfLastMethodOutputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodOutputArguments' field")) } - m.NoOfLastMethodOutputArguments = noOfLastMethodOutputArguments + _ = noOfLastMethodOutputArguments - lastMethodOutputArguments, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "lastMethodOutputArguments", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("298")), readBuffer), uint64(noOfLastMethodOutputArguments)) + lastMethodOutputArguments, err := ReadCountArrayField[Argument](ctx, "lastMethodOutputArguments", ReadComplex[Argument](ExtensionObjectDefinitionParseWithBufferProducer[Argument]((int32)(int32(298))), readBuffer), uint64(noOfLastMethodOutputArguments)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'lastMethodOutputArguments' field")) } m.LastMethodOutputArguments = lastMethodOutputArguments - noOfLastMethodInputValues, err := ReadSimpleField(ctx, "noOfLastMethodInputValues", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodInputValues, err := ReadImplicitField[int32](ctx, "noOfLastMethodInputValues", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodInputValues' field")) } - m.NoOfLastMethodInputValues = noOfLastMethodInputValues + _ = noOfLastMethodInputValues lastMethodInputValues, err := ReadCountArrayField[Variant](ctx, "lastMethodInputValues", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfLastMethodInputValues)) if err != nil { @@ -719,11 +659,11 @@ func (m *_ProgramDiagnostic2DataType) parse(ctx context.Context, readBuffer util } m.LastMethodInputValues = lastMethodInputValues - noOfLastMethodOutputValues, err := ReadSimpleField(ctx, "noOfLastMethodOutputValues", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodOutputValues, err := ReadImplicitField[int32](ctx, "noOfLastMethodOutputValues", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodOutputValues' field")) } - m.NoOfLastMethodOutputValues = noOfLastMethodOutputValues + _ = noOfLastMethodOutputValues lastMethodOutputValues, err := ReadCountArrayField[Variant](ctx, "lastMethodOutputValues", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfLastMethodOutputValues)) if err != nil { @@ -791,32 +731,32 @@ func (m *_ProgramDiagnostic2DataType) SerializeWithWriteBuffer(ctx context.Conte if err := WriteSimpleField[NodeId](ctx, "lastMethodSessionId", m.GetLastMethodSessionId(), WriteComplex[NodeId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodSessionId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodInputArguments", m.GetNoOfLastMethodInputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodInputArguments := int32(utils.InlineIf(bool((m.GetLastMethodInputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodInputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodInputArguments", noOfLastMethodInputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodInputArguments' field") } if err := WriteComplexTypeArrayField(ctx, "lastMethodInputArguments", m.GetLastMethodInputArguments(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodInputArguments' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodOutputArguments", m.GetNoOfLastMethodOutputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodOutputArguments := int32(utils.InlineIf(bool((m.GetLastMethodOutputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodOutputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodOutputArguments", noOfLastMethodOutputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodOutputArguments' field") } if err := WriteComplexTypeArrayField(ctx, "lastMethodOutputArguments", m.GetLastMethodOutputArguments(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodOutputArguments' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodInputValues", m.GetNoOfLastMethodInputValues(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodInputValues := int32(utils.InlineIf(bool((m.GetLastMethodInputValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodInputValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodInputValues", noOfLastMethodInputValues, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodInputValues' field") } if err := WriteComplexTypeArrayField(ctx, "lastMethodInputValues", m.GetLastMethodInputValues(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodInputValues' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodOutputValues", m.GetNoOfLastMethodOutputValues(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodOutputValues := int32(utils.InlineIf(bool((m.GetLastMethodOutputValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodOutputValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodOutputValues", noOfLastMethodOutputValues, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodOutputValues' field") } @@ -858,13 +798,9 @@ func (m *_ProgramDiagnostic2DataType) deepCopy() *_ProgramDiagnostic2DataType { m.LastTransitionTime, m.LastMethodCall.DeepCopy().(PascalString), m.LastMethodSessionId.DeepCopy().(NodeId), - m.NoOfLastMethodInputArguments, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.LastMethodInputArguments), - m.NoOfLastMethodOutputArguments, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.LastMethodOutputArguments), - m.NoOfLastMethodInputValues, + utils.DeepCopySlice[Argument, Argument](m.LastMethodInputArguments), + utils.DeepCopySlice[Argument, Argument](m.LastMethodOutputArguments), utils.DeepCopySlice[Variant, Variant](m.LastMethodInputValues), - m.NoOfLastMethodOutputValues, utils.DeepCopySlice[Variant, Variant](m.LastMethodOutputValues), m.LastMethodCallTime, m.LastMethodReturnStatus.DeepCopy().(StatusCode), diff --git a/plc4go/protocols/opcua/readwrite/model/ProgramDiagnosticDataType.go b/plc4go/protocols/opcua/readwrite/model/ProgramDiagnosticDataType.go index 598bf853722..ed0ff4935d6 100644 --- a/plc4go/protocols/opcua/readwrite/model/ProgramDiagnosticDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ProgramDiagnosticDataType.go @@ -52,18 +52,14 @@ type ProgramDiagnosticDataType interface { GetLastMethodCall() PascalString // GetLastMethodSessionId returns LastMethodSessionId (property field) GetLastMethodSessionId() NodeId - // GetNoOfLastMethodInputArguments returns NoOfLastMethodInputArguments (property field) - GetNoOfLastMethodInputArguments() int32 // GetLastMethodInputArguments returns LastMethodInputArguments (property field) - GetLastMethodInputArguments() []ExtensionObjectDefinition - // GetNoOfLastMethodOutputArguments returns NoOfLastMethodOutputArguments (property field) - GetNoOfLastMethodOutputArguments() int32 + GetLastMethodInputArguments() []Argument // GetLastMethodOutputArguments returns LastMethodOutputArguments (property field) - GetLastMethodOutputArguments() []ExtensionObjectDefinition + GetLastMethodOutputArguments() []Argument // GetLastMethodCallTime returns LastMethodCallTime (property field) GetLastMethodCallTime() int64 // GetLastMethodReturnStatus returns LastMethodReturnStatus (property field) - GetLastMethodReturnStatus() ExtensionObjectDefinition + GetLastMethodReturnStatus() StatusResult // IsProgramDiagnosticDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsProgramDiagnosticDataType() // CreateBuilder creates a ProgramDiagnosticDataTypeBuilder @@ -73,25 +69,23 @@ type ProgramDiagnosticDataType interface { // _ProgramDiagnosticDataType is the data-structure of this message type _ProgramDiagnosticDataType struct { ExtensionObjectDefinitionContract - CreateSessionId NodeId - CreateClientName PascalString - InvocationCreationTime int64 - LastTransitionTime int64 - LastMethodCall PascalString - LastMethodSessionId NodeId - NoOfLastMethodInputArguments int32 - LastMethodInputArguments []ExtensionObjectDefinition - NoOfLastMethodOutputArguments int32 - LastMethodOutputArguments []ExtensionObjectDefinition - LastMethodCallTime int64 - LastMethodReturnStatus ExtensionObjectDefinition + CreateSessionId NodeId + CreateClientName PascalString + InvocationCreationTime int64 + LastTransitionTime int64 + LastMethodCall PascalString + LastMethodSessionId NodeId + LastMethodInputArguments []Argument + LastMethodOutputArguments []Argument + LastMethodCallTime int64 + LastMethodReturnStatus StatusResult } var _ ProgramDiagnosticDataType = (*_ProgramDiagnosticDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ProgramDiagnosticDataType)(nil) // NewProgramDiagnosticDataType factory function for _ProgramDiagnosticDataType -func NewProgramDiagnosticDataType(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, lastMethodCallTime int64, lastMethodReturnStatus ExtensionObjectDefinition) *_ProgramDiagnosticDataType { +func NewProgramDiagnosticDataType(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodCallTime int64, lastMethodReturnStatus StatusResult) *_ProgramDiagnosticDataType { if createSessionId == nil { panic("createSessionId of type NodeId for ProgramDiagnosticDataType must not be nil") } @@ -105,7 +99,7 @@ func NewProgramDiagnosticDataType(createSessionId NodeId, createClientName Pasca panic("lastMethodSessionId of type NodeId for ProgramDiagnosticDataType must not be nil") } if lastMethodReturnStatus == nil { - panic("lastMethodReturnStatus of type ExtensionObjectDefinition for ProgramDiagnosticDataType must not be nil") + panic("lastMethodReturnStatus of type StatusResult for ProgramDiagnosticDataType must not be nil") } _result := &_ProgramDiagnosticDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -115,9 +109,7 @@ func NewProgramDiagnosticDataType(createSessionId NodeId, createClientName Pasca LastTransitionTime: lastTransitionTime, LastMethodCall: lastMethodCall, LastMethodSessionId: lastMethodSessionId, - NoOfLastMethodInputArguments: noOfLastMethodInputArguments, LastMethodInputArguments: lastMethodInputArguments, - NoOfLastMethodOutputArguments: noOfLastMethodOutputArguments, LastMethodOutputArguments: lastMethodOutputArguments, LastMethodCallTime: lastMethodCallTime, LastMethodReturnStatus: lastMethodReturnStatus, @@ -135,7 +127,7 @@ func NewProgramDiagnosticDataType(createSessionId NodeId, createClientName Pasca type ProgramDiagnosticDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, lastMethodCallTime int64, lastMethodReturnStatus ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder + WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodCallTime int64, lastMethodReturnStatus StatusResult) ProgramDiagnosticDataTypeBuilder // WithCreateSessionId adds CreateSessionId (property field) WithCreateSessionId(NodeId) ProgramDiagnosticDataTypeBuilder // WithCreateSessionIdBuilder adds CreateSessionId (property field) which is build by the builder @@ -156,20 +148,16 @@ type ProgramDiagnosticDataTypeBuilder interface { WithLastMethodSessionId(NodeId) ProgramDiagnosticDataTypeBuilder // WithLastMethodSessionIdBuilder adds LastMethodSessionId (property field) which is build by the builder WithLastMethodSessionIdBuilder(func(NodeIdBuilder) NodeIdBuilder) ProgramDiagnosticDataTypeBuilder - // WithNoOfLastMethodInputArguments adds NoOfLastMethodInputArguments (property field) - WithNoOfLastMethodInputArguments(int32) ProgramDiagnosticDataTypeBuilder // WithLastMethodInputArguments adds LastMethodInputArguments (property field) - WithLastMethodInputArguments(...ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder - // WithNoOfLastMethodOutputArguments adds NoOfLastMethodOutputArguments (property field) - WithNoOfLastMethodOutputArguments(int32) ProgramDiagnosticDataTypeBuilder + WithLastMethodInputArguments(...Argument) ProgramDiagnosticDataTypeBuilder // WithLastMethodOutputArguments adds LastMethodOutputArguments (property field) - WithLastMethodOutputArguments(...ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder + WithLastMethodOutputArguments(...Argument) ProgramDiagnosticDataTypeBuilder // WithLastMethodCallTime adds LastMethodCallTime (property field) WithLastMethodCallTime(int64) ProgramDiagnosticDataTypeBuilder // WithLastMethodReturnStatus adds LastMethodReturnStatus (property field) - WithLastMethodReturnStatus(ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder + WithLastMethodReturnStatus(StatusResult) ProgramDiagnosticDataTypeBuilder // WithLastMethodReturnStatusBuilder adds LastMethodReturnStatus (property field) which is build by the builder - WithLastMethodReturnStatusBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ProgramDiagnosticDataTypeBuilder + WithLastMethodReturnStatusBuilder(func(StatusResultBuilder) StatusResultBuilder) ProgramDiagnosticDataTypeBuilder // Build builds the ProgramDiagnosticDataType or returns an error if something is wrong Build() (ProgramDiagnosticDataType, error) // MustBuild does the same as Build but panics on error @@ -195,8 +183,8 @@ func (b *_ProgramDiagnosticDataTypeBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_ProgramDiagnosticDataTypeBuilder) WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, noOfLastMethodInputArguments int32, lastMethodInputArguments []ExtensionObjectDefinition, noOfLastMethodOutputArguments int32, lastMethodOutputArguments []ExtensionObjectDefinition, lastMethodCallTime int64, lastMethodReturnStatus ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder { - return b.WithCreateSessionId(createSessionId).WithCreateClientName(createClientName).WithInvocationCreationTime(invocationCreationTime).WithLastTransitionTime(lastTransitionTime).WithLastMethodCall(lastMethodCall).WithLastMethodSessionId(lastMethodSessionId).WithNoOfLastMethodInputArguments(noOfLastMethodInputArguments).WithLastMethodInputArguments(lastMethodInputArguments...).WithNoOfLastMethodOutputArguments(noOfLastMethodOutputArguments).WithLastMethodOutputArguments(lastMethodOutputArguments...).WithLastMethodCallTime(lastMethodCallTime).WithLastMethodReturnStatus(lastMethodReturnStatus) +func (b *_ProgramDiagnosticDataTypeBuilder) WithMandatoryFields(createSessionId NodeId, createClientName PascalString, invocationCreationTime int64, lastTransitionTime int64, lastMethodCall PascalString, lastMethodSessionId NodeId, lastMethodInputArguments []Argument, lastMethodOutputArguments []Argument, lastMethodCallTime int64, lastMethodReturnStatus StatusResult) ProgramDiagnosticDataTypeBuilder { + return b.WithCreateSessionId(createSessionId).WithCreateClientName(createClientName).WithInvocationCreationTime(invocationCreationTime).WithLastTransitionTime(lastTransitionTime).WithLastMethodCall(lastMethodCall).WithLastMethodSessionId(lastMethodSessionId).WithLastMethodInputArguments(lastMethodInputArguments...).WithLastMethodOutputArguments(lastMethodOutputArguments...).WithLastMethodCallTime(lastMethodCallTime).WithLastMethodReturnStatus(lastMethodReturnStatus) } func (b *_ProgramDiagnosticDataTypeBuilder) WithCreateSessionId(createSessionId NodeId) ProgramDiagnosticDataTypeBuilder { @@ -281,22 +269,12 @@ func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodSessionIdBuilder(build return b } -func (b *_ProgramDiagnosticDataTypeBuilder) WithNoOfLastMethodInputArguments(noOfLastMethodInputArguments int32) ProgramDiagnosticDataTypeBuilder { - b.NoOfLastMethodInputArguments = noOfLastMethodInputArguments - return b -} - -func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodInputArguments(lastMethodInputArguments ...ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder { +func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodInputArguments(lastMethodInputArguments ...Argument) ProgramDiagnosticDataTypeBuilder { b.LastMethodInputArguments = lastMethodInputArguments return b } -func (b *_ProgramDiagnosticDataTypeBuilder) WithNoOfLastMethodOutputArguments(noOfLastMethodOutputArguments int32) ProgramDiagnosticDataTypeBuilder { - b.NoOfLastMethodOutputArguments = noOfLastMethodOutputArguments - return b -} - -func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodOutputArguments(lastMethodOutputArguments ...ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder { +func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodOutputArguments(lastMethodOutputArguments ...Argument) ProgramDiagnosticDataTypeBuilder { b.LastMethodOutputArguments = lastMethodOutputArguments return b } @@ -306,20 +284,20 @@ func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodCallTime(lastMethodCal return b } -func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodReturnStatus(lastMethodReturnStatus ExtensionObjectDefinition) ProgramDiagnosticDataTypeBuilder { +func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodReturnStatus(lastMethodReturnStatus StatusResult) ProgramDiagnosticDataTypeBuilder { b.LastMethodReturnStatus = lastMethodReturnStatus return b } -func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodReturnStatusBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ProgramDiagnosticDataTypeBuilder { - builder := builderSupplier(b.LastMethodReturnStatus.CreateExtensionObjectDefinitionBuilder()) +func (b *_ProgramDiagnosticDataTypeBuilder) WithLastMethodReturnStatusBuilder(builderSupplier func(StatusResultBuilder) StatusResultBuilder) ProgramDiagnosticDataTypeBuilder { + builder := builderSupplier(b.LastMethodReturnStatus.CreateStatusResultBuilder()) var err error b.LastMethodReturnStatus, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "StatusResultBuilder failed")) } return b } @@ -404,8 +382,8 @@ func (b *_ProgramDiagnosticDataType) CreateProgramDiagnosticDataTypeBuilder() Pr /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ProgramDiagnosticDataType) GetIdentifier() string { - return "896" +func (m *_ProgramDiagnosticDataType) GetExtensionId() int32 { + return int32(896) } /////////////////////// @@ -446,19 +424,11 @@ func (m *_ProgramDiagnosticDataType) GetLastMethodSessionId() NodeId { return m.LastMethodSessionId } -func (m *_ProgramDiagnosticDataType) GetNoOfLastMethodInputArguments() int32 { - return m.NoOfLastMethodInputArguments -} - -func (m *_ProgramDiagnosticDataType) GetLastMethodInputArguments() []ExtensionObjectDefinition { +func (m *_ProgramDiagnosticDataType) GetLastMethodInputArguments() []Argument { return m.LastMethodInputArguments } -func (m *_ProgramDiagnosticDataType) GetNoOfLastMethodOutputArguments() int32 { - return m.NoOfLastMethodOutputArguments -} - -func (m *_ProgramDiagnosticDataType) GetLastMethodOutputArguments() []ExtensionObjectDefinition { +func (m *_ProgramDiagnosticDataType) GetLastMethodOutputArguments() []Argument { return m.LastMethodOutputArguments } @@ -466,7 +436,7 @@ func (m *_ProgramDiagnosticDataType) GetLastMethodCallTime() int64 { return m.LastMethodCallTime } -func (m *_ProgramDiagnosticDataType) GetLastMethodReturnStatus() ExtensionObjectDefinition { +func (m *_ProgramDiagnosticDataType) GetLastMethodReturnStatus() StatusResult { return m.LastMethodReturnStatus } @@ -511,7 +481,7 @@ func (m *_ProgramDiagnosticDataType) GetLengthInBits(ctx context.Context) uint16 // Simple field (lastMethodSessionId) lengthInBits += m.LastMethodSessionId.GetLengthInBits(ctx) - // Simple field (noOfLastMethodInputArguments) + // Implicit Field (noOfLastMethodInputArguments) lengthInBits += 32 // Array field @@ -524,7 +494,7 @@ func (m *_ProgramDiagnosticDataType) GetLengthInBits(ctx context.Context) uint16 } } - // Simple field (noOfLastMethodOutputArguments) + // Implicit Field (noOfLastMethodOutputArguments) lengthInBits += 32 // Array field @@ -550,7 +520,7 @@ func (m *_ProgramDiagnosticDataType) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_ProgramDiagnosticDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__programDiagnosticDataType ProgramDiagnosticDataType, err error) { +func (m *_ProgramDiagnosticDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__programDiagnosticDataType ProgramDiagnosticDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -597,25 +567,25 @@ func (m *_ProgramDiagnosticDataType) parse(ctx context.Context, readBuffer utils } m.LastMethodSessionId = lastMethodSessionId - noOfLastMethodInputArguments, err := ReadSimpleField(ctx, "noOfLastMethodInputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodInputArguments, err := ReadImplicitField[int32](ctx, "noOfLastMethodInputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodInputArguments' field")) } - m.NoOfLastMethodInputArguments = noOfLastMethodInputArguments + _ = noOfLastMethodInputArguments - lastMethodInputArguments, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "lastMethodInputArguments", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("298")), readBuffer), uint64(noOfLastMethodInputArguments)) + lastMethodInputArguments, err := ReadCountArrayField[Argument](ctx, "lastMethodInputArguments", ReadComplex[Argument](ExtensionObjectDefinitionParseWithBufferProducer[Argument]((int32)(int32(298))), readBuffer), uint64(noOfLastMethodInputArguments)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'lastMethodInputArguments' field")) } m.LastMethodInputArguments = lastMethodInputArguments - noOfLastMethodOutputArguments, err := ReadSimpleField(ctx, "noOfLastMethodOutputArguments", ReadSignedInt(readBuffer, uint8(32))) + noOfLastMethodOutputArguments, err := ReadImplicitField[int32](ctx, "noOfLastMethodOutputArguments", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLastMethodOutputArguments' field")) } - m.NoOfLastMethodOutputArguments = noOfLastMethodOutputArguments + _ = noOfLastMethodOutputArguments - lastMethodOutputArguments, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "lastMethodOutputArguments", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("298")), readBuffer), uint64(noOfLastMethodOutputArguments)) + lastMethodOutputArguments, err := ReadCountArrayField[Argument](ctx, "lastMethodOutputArguments", ReadComplex[Argument](ExtensionObjectDefinitionParseWithBufferProducer[Argument]((int32)(int32(298))), readBuffer), uint64(noOfLastMethodOutputArguments)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'lastMethodOutputArguments' field")) } @@ -627,7 +597,7 @@ func (m *_ProgramDiagnosticDataType) parse(ctx context.Context, readBuffer utils } m.LastMethodCallTime = lastMethodCallTime - lastMethodReturnStatus, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "lastMethodReturnStatus", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("301")), readBuffer)) + lastMethodReturnStatus, err := ReadSimpleField[StatusResult](ctx, "lastMethodReturnStatus", ReadComplex[StatusResult](ExtensionObjectDefinitionParseWithBufferProducer[StatusResult]((int32)(int32(301))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'lastMethodReturnStatus' field")) } @@ -681,16 +651,16 @@ func (m *_ProgramDiagnosticDataType) SerializeWithWriteBuffer(ctx context.Contex if err := WriteSimpleField[NodeId](ctx, "lastMethodSessionId", m.GetLastMethodSessionId(), WriteComplex[NodeId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodSessionId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodInputArguments", m.GetNoOfLastMethodInputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodInputArguments := int32(utils.InlineIf(bool((m.GetLastMethodInputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodInputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodInputArguments", noOfLastMethodInputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodInputArguments' field") } if err := WriteComplexTypeArrayField(ctx, "lastMethodInputArguments", m.GetLastMethodInputArguments(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodInputArguments' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLastMethodOutputArguments", m.GetNoOfLastMethodOutputArguments(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLastMethodOutputArguments := int32(utils.InlineIf(bool((m.GetLastMethodOutputArguments()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLastMethodOutputArguments()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLastMethodOutputArguments", noOfLastMethodOutputArguments, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLastMethodOutputArguments' field") } @@ -702,7 +672,7 @@ func (m *_ProgramDiagnosticDataType) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(err, "Error serializing 'lastMethodCallTime' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "lastMethodReturnStatus", m.GetLastMethodReturnStatus(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[StatusResult](ctx, "lastMethodReturnStatus", m.GetLastMethodReturnStatus(), WriteComplex[StatusResult](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'lastMethodReturnStatus' field") } @@ -732,12 +702,10 @@ func (m *_ProgramDiagnosticDataType) deepCopy() *_ProgramDiagnosticDataType { m.LastTransitionTime, m.LastMethodCall.DeepCopy().(PascalString), m.LastMethodSessionId.DeepCopy().(NodeId), - m.NoOfLastMethodInputArguments, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.LastMethodInputArguments), - m.NoOfLastMethodOutputArguments, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.LastMethodOutputArguments), + utils.DeepCopySlice[Argument, Argument](m.LastMethodInputArguments), + utils.DeepCopySlice[Argument, Argument](m.LastMethodOutputArguments), m.LastMethodCallTime, - m.LastMethodReturnStatus.DeepCopy().(ExtensionObjectDefinition), + m.LastMethodReturnStatus.DeepCopy().(StatusResult), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ProgramDiagnosticDataTypeCopy diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubConfiguration2DataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubConfiguration2DataType.go new file mode 100644 index 00000000000..c5d86311b29 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PubSubConfiguration2DataType.go @@ -0,0 +1,743 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PubSubConfiguration2DataType is the corresponding interface of PubSubConfiguration2DataType +type PubSubConfiguration2DataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetPublishedDataSets returns PublishedDataSets (property field) + GetPublishedDataSets() []PublishedDataSetDataType + // GetConnections returns Connections (property field) + GetConnections() []PubSubConnectionDataType + // GetEnabled returns Enabled (property field) + GetEnabled() bool + // GetSubscribedDataSets returns SubscribedDataSets (property field) + GetSubscribedDataSets() []StandaloneSubscribedDataSetDataType + // GetDataSetClasses returns DataSetClasses (property field) + GetDataSetClasses() []DataSetMetaDataType + // GetDefaultSecurityKeyServices returns DefaultSecurityKeyServices (property field) + GetDefaultSecurityKeyServices() []EndpointDescription + // GetSecurityGroups returns SecurityGroups (property field) + GetSecurityGroups() []SecurityGroupDataType + // GetPubSubKeyPushTargets returns PubSubKeyPushTargets (property field) + GetPubSubKeyPushTargets() []PubSubKeyPushTargetDataType + // GetConfigurationVersion returns ConfigurationVersion (property field) + GetConfigurationVersion() uint32 + // GetConfigurationProperties returns ConfigurationProperties (property field) + GetConfigurationProperties() []KeyValuePair + // IsPubSubConfiguration2DataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPubSubConfiguration2DataType() + // CreateBuilder creates a PubSubConfiguration2DataTypeBuilder + CreatePubSubConfiguration2DataTypeBuilder() PubSubConfiguration2DataTypeBuilder +} + +// _PubSubConfiguration2DataType is the data-structure of this message +type _PubSubConfiguration2DataType struct { + ExtensionObjectDefinitionContract + PublishedDataSets []PublishedDataSetDataType + Connections []PubSubConnectionDataType + Enabled bool + SubscribedDataSets []StandaloneSubscribedDataSetDataType + DataSetClasses []DataSetMetaDataType + DefaultSecurityKeyServices []EndpointDescription + SecurityGroups []SecurityGroupDataType + PubSubKeyPushTargets []PubSubKeyPushTargetDataType + ConfigurationVersion uint32 + ConfigurationProperties []KeyValuePair + // Reserved Fields + reservedField0 *uint8 +} + +var _ PubSubConfiguration2DataType = (*_PubSubConfiguration2DataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PubSubConfiguration2DataType)(nil) + +// NewPubSubConfiguration2DataType factory function for _PubSubConfiguration2DataType +func NewPubSubConfiguration2DataType(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool, subscribedDataSets []StandaloneSubscribedDataSetDataType, dataSetClasses []DataSetMetaDataType, defaultSecurityKeyServices []EndpointDescription, securityGroups []SecurityGroupDataType, pubSubKeyPushTargets []PubSubKeyPushTargetDataType, configurationVersion uint32, configurationProperties []KeyValuePair) *_PubSubConfiguration2DataType { + _result := &_PubSubConfiguration2DataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PublishedDataSets: publishedDataSets, + Connections: connections, + Enabled: enabled, + SubscribedDataSets: subscribedDataSets, + DataSetClasses: dataSetClasses, + DefaultSecurityKeyServices: defaultSecurityKeyServices, + SecurityGroups: securityGroups, + PubSubKeyPushTargets: pubSubKeyPushTargets, + ConfigurationVersion: configurationVersion, + ConfigurationProperties: configurationProperties, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PubSubConfiguration2DataTypeBuilder is a builder for PubSubConfiguration2DataType +type PubSubConfiguration2DataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool, subscribedDataSets []StandaloneSubscribedDataSetDataType, dataSetClasses []DataSetMetaDataType, defaultSecurityKeyServices []EndpointDescription, securityGroups []SecurityGroupDataType, pubSubKeyPushTargets []PubSubKeyPushTargetDataType, configurationVersion uint32, configurationProperties []KeyValuePair) PubSubConfiguration2DataTypeBuilder + // WithPublishedDataSets adds PublishedDataSets (property field) + WithPublishedDataSets(...PublishedDataSetDataType) PubSubConfiguration2DataTypeBuilder + // WithConnections adds Connections (property field) + WithConnections(...PubSubConnectionDataType) PubSubConfiguration2DataTypeBuilder + // WithEnabled adds Enabled (property field) + WithEnabled(bool) PubSubConfiguration2DataTypeBuilder + // WithSubscribedDataSets adds SubscribedDataSets (property field) + WithSubscribedDataSets(...StandaloneSubscribedDataSetDataType) PubSubConfiguration2DataTypeBuilder + // WithDataSetClasses adds DataSetClasses (property field) + WithDataSetClasses(...DataSetMetaDataType) PubSubConfiguration2DataTypeBuilder + // WithDefaultSecurityKeyServices adds DefaultSecurityKeyServices (property field) + WithDefaultSecurityKeyServices(...EndpointDescription) PubSubConfiguration2DataTypeBuilder + // WithSecurityGroups adds SecurityGroups (property field) + WithSecurityGroups(...SecurityGroupDataType) PubSubConfiguration2DataTypeBuilder + // WithPubSubKeyPushTargets adds PubSubKeyPushTargets (property field) + WithPubSubKeyPushTargets(...PubSubKeyPushTargetDataType) PubSubConfiguration2DataTypeBuilder + // WithConfigurationVersion adds ConfigurationVersion (property field) + WithConfigurationVersion(uint32) PubSubConfiguration2DataTypeBuilder + // WithConfigurationProperties adds ConfigurationProperties (property field) + WithConfigurationProperties(...KeyValuePair) PubSubConfiguration2DataTypeBuilder + // Build builds the PubSubConfiguration2DataType or returns an error if something is wrong + Build() (PubSubConfiguration2DataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PubSubConfiguration2DataType +} + +// NewPubSubConfiguration2DataTypeBuilder() creates a PubSubConfiguration2DataTypeBuilder +func NewPubSubConfiguration2DataTypeBuilder() PubSubConfiguration2DataTypeBuilder { + return &_PubSubConfiguration2DataTypeBuilder{_PubSubConfiguration2DataType: new(_PubSubConfiguration2DataType)} +} + +type _PubSubConfiguration2DataTypeBuilder struct { + *_PubSubConfiguration2DataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PubSubConfiguration2DataTypeBuilder) = (*_PubSubConfiguration2DataTypeBuilder)(nil) + +func (b *_PubSubConfiguration2DataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithMandatoryFields(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool, subscribedDataSets []StandaloneSubscribedDataSetDataType, dataSetClasses []DataSetMetaDataType, defaultSecurityKeyServices []EndpointDescription, securityGroups []SecurityGroupDataType, pubSubKeyPushTargets []PubSubKeyPushTargetDataType, configurationVersion uint32, configurationProperties []KeyValuePair) PubSubConfiguration2DataTypeBuilder { + return b.WithPublishedDataSets(publishedDataSets...).WithConnections(connections...).WithEnabled(enabled).WithSubscribedDataSets(subscribedDataSets...).WithDataSetClasses(dataSetClasses...).WithDefaultSecurityKeyServices(defaultSecurityKeyServices...).WithSecurityGroups(securityGroups...).WithPubSubKeyPushTargets(pubSubKeyPushTargets...).WithConfigurationVersion(configurationVersion).WithConfigurationProperties(configurationProperties...) +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithPublishedDataSets(publishedDataSets ...PublishedDataSetDataType) PubSubConfiguration2DataTypeBuilder { + b.PublishedDataSets = publishedDataSets + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithConnections(connections ...PubSubConnectionDataType) PubSubConfiguration2DataTypeBuilder { + b.Connections = connections + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithEnabled(enabled bool) PubSubConfiguration2DataTypeBuilder { + b.Enabled = enabled + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithSubscribedDataSets(subscribedDataSets ...StandaloneSubscribedDataSetDataType) PubSubConfiguration2DataTypeBuilder { + b.SubscribedDataSets = subscribedDataSets + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithDataSetClasses(dataSetClasses ...DataSetMetaDataType) PubSubConfiguration2DataTypeBuilder { + b.DataSetClasses = dataSetClasses + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithDefaultSecurityKeyServices(defaultSecurityKeyServices ...EndpointDescription) PubSubConfiguration2DataTypeBuilder { + b.DefaultSecurityKeyServices = defaultSecurityKeyServices + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithSecurityGroups(securityGroups ...SecurityGroupDataType) PubSubConfiguration2DataTypeBuilder { + b.SecurityGroups = securityGroups + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithPubSubKeyPushTargets(pubSubKeyPushTargets ...PubSubKeyPushTargetDataType) PubSubConfiguration2DataTypeBuilder { + b.PubSubKeyPushTargets = pubSubKeyPushTargets + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithConfigurationVersion(configurationVersion uint32) PubSubConfiguration2DataTypeBuilder { + b.ConfigurationVersion = configurationVersion + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) WithConfigurationProperties(configurationProperties ...KeyValuePair) PubSubConfiguration2DataTypeBuilder { + b.ConfigurationProperties = configurationProperties + return b +} + +func (b *_PubSubConfiguration2DataTypeBuilder) Build() (PubSubConfiguration2DataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PubSubConfiguration2DataType.deepCopy(), nil +} + +func (b *_PubSubConfiguration2DataTypeBuilder) MustBuild() PubSubConfiguration2DataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PubSubConfiguration2DataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PubSubConfiguration2DataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PubSubConfiguration2DataTypeBuilder) DeepCopy() any { + _copy := b.CreatePubSubConfiguration2DataTypeBuilder().(*_PubSubConfiguration2DataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePubSubConfiguration2DataTypeBuilder creates a PubSubConfiguration2DataTypeBuilder +func (b *_PubSubConfiguration2DataType) CreatePubSubConfiguration2DataTypeBuilder() PubSubConfiguration2DataTypeBuilder { + if b == nil { + return NewPubSubConfiguration2DataTypeBuilder() + } + return &_PubSubConfiguration2DataTypeBuilder{_PubSubConfiguration2DataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PubSubConfiguration2DataType) GetExtensionId() int32 { + return int32(23604) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PubSubConfiguration2DataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PubSubConfiguration2DataType) GetPublishedDataSets() []PublishedDataSetDataType { + return m.PublishedDataSets +} + +func (m *_PubSubConfiguration2DataType) GetConnections() []PubSubConnectionDataType { + return m.Connections +} + +func (m *_PubSubConfiguration2DataType) GetEnabled() bool { + return m.Enabled +} + +func (m *_PubSubConfiguration2DataType) GetSubscribedDataSets() []StandaloneSubscribedDataSetDataType { + return m.SubscribedDataSets +} + +func (m *_PubSubConfiguration2DataType) GetDataSetClasses() []DataSetMetaDataType { + return m.DataSetClasses +} + +func (m *_PubSubConfiguration2DataType) GetDefaultSecurityKeyServices() []EndpointDescription { + return m.DefaultSecurityKeyServices +} + +func (m *_PubSubConfiguration2DataType) GetSecurityGroups() []SecurityGroupDataType { + return m.SecurityGroups +} + +func (m *_PubSubConfiguration2DataType) GetPubSubKeyPushTargets() []PubSubKeyPushTargetDataType { + return m.PubSubKeyPushTargets +} + +func (m *_PubSubConfiguration2DataType) GetConfigurationVersion() uint32 { + return m.ConfigurationVersion +} + +func (m *_PubSubConfiguration2DataType) GetConfigurationProperties() []KeyValuePair { + return m.ConfigurationProperties +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPubSubConfiguration2DataType(structType any) PubSubConfiguration2DataType { + if casted, ok := structType.(PubSubConfiguration2DataType); ok { + return casted + } + if casted, ok := structType.(*PubSubConfiguration2DataType); ok { + return *casted + } + return nil +} + +func (m *_PubSubConfiguration2DataType) GetTypeName() string { + return "PubSubConfiguration2DataType" +} + +func (m *_PubSubConfiguration2DataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfPublishedDataSets) + lengthInBits += 32 + + // Array field + if len(m.PublishedDataSets) > 0 { + for _curItem, element := range m.PublishedDataSets { + arrayCtx := utils.CreateArrayContext(ctx, len(m.PublishedDataSets), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfConnections) + lengthInBits += 32 + + // Array field + if len(m.Connections) > 0 { + for _curItem, element := range m.Connections { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Connections), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (enabled) + lengthInBits += 1 + + // Implicit Field (noOfSubscribedDataSets) + lengthInBits += 32 + + // Array field + if len(m.SubscribedDataSets) > 0 { + for _curItem, element := range m.SubscribedDataSets { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SubscribedDataSets), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfDataSetClasses) + lengthInBits += 32 + + // Array field + if len(m.DataSetClasses) > 0 { + for _curItem, element := range m.DataSetClasses { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetClasses), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfDefaultSecurityKeyServices) + lengthInBits += 32 + + // Array field + if len(m.DefaultSecurityKeyServices) > 0 { + for _curItem, element := range m.DefaultSecurityKeyServices { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DefaultSecurityKeyServices), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfSecurityGroups) + lengthInBits += 32 + + // Array field + if len(m.SecurityGroups) > 0 { + for _curItem, element := range m.SecurityGroups { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SecurityGroups), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfPubSubKeyPushTargets) + lengthInBits += 32 + + // Array field + if len(m.PubSubKeyPushTargets) > 0 { + for _curItem, element := range m.PubSubKeyPushTargets { + arrayCtx := utils.CreateArrayContext(ctx, len(m.PubSubKeyPushTargets), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (configurationVersion) + lengthInBits += 32 + + // Implicit Field (noOfConfigurationProperties) + lengthInBits += 32 + + // Array field + if len(m.ConfigurationProperties) > 0 { + for _curItem, element := range m.ConfigurationProperties { + arrayCtx := utils.CreateArrayContext(ctx, len(m.ConfigurationProperties), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_PubSubConfiguration2DataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PubSubConfiguration2DataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubConfiguration2DataType PubSubConfiguration2DataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PubSubConfiguration2DataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PubSubConfiguration2DataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfPublishedDataSets, err := ReadImplicitField[int32](ctx, "noOfPublishedDataSets", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPublishedDataSets' field")) + } + _ = noOfPublishedDataSets + + publishedDataSets, err := ReadCountArrayField[PublishedDataSetDataType](ctx, "publishedDataSets", ReadComplex[PublishedDataSetDataType](ExtensionObjectDefinitionParseWithBufferProducer[PublishedDataSetDataType]((int32)(int32(15580))), readBuffer), uint64(noOfPublishedDataSets)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishedDataSets' field")) + } + m.PublishedDataSets = publishedDataSets + + noOfConnections, err := ReadImplicitField[int32](ctx, "noOfConnections", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfConnections' field")) + } + _ = noOfConnections + + connections, err := ReadCountArrayField[PubSubConnectionDataType](ctx, "connections", ReadComplex[PubSubConnectionDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubConnectionDataType]((int32)(int32(15619))), readBuffer), uint64(noOfConnections)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'connections' field")) + } + m.Connections = connections + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + enabled, err := ReadSimpleField(ctx, "enabled", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enabled' field")) + } + m.Enabled = enabled + + noOfSubscribedDataSets, err := ReadImplicitField[int32](ctx, "noOfSubscribedDataSets", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSubscribedDataSets' field")) + } + _ = noOfSubscribedDataSets + + subscribedDataSets, err := ReadCountArrayField[StandaloneSubscribedDataSetDataType](ctx, "subscribedDataSets", ReadComplex[StandaloneSubscribedDataSetDataType](ExtensionObjectDefinitionParseWithBufferProducer[StandaloneSubscribedDataSetDataType]((int32)(int32(23602))), readBuffer), uint64(noOfSubscribedDataSets)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'subscribedDataSets' field")) + } + m.SubscribedDataSets = subscribedDataSets + + noOfDataSetClasses, err := ReadImplicitField[int32](ctx, "noOfDataSetClasses", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetClasses' field")) + } + _ = noOfDataSetClasses + + dataSetClasses, err := ReadCountArrayField[DataSetMetaDataType](ctx, "dataSetClasses", ReadComplex[DataSetMetaDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetMetaDataType]((int32)(int32(14525))), readBuffer), uint64(noOfDataSetClasses)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetClasses' field")) + } + m.DataSetClasses = dataSetClasses + + noOfDefaultSecurityKeyServices, err := ReadImplicitField[int32](ctx, "noOfDefaultSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDefaultSecurityKeyServices' field")) + } + _ = noOfDefaultSecurityKeyServices + + defaultSecurityKeyServices, err := ReadCountArrayField[EndpointDescription](ctx, "defaultSecurityKeyServices", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfDefaultSecurityKeyServices)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'defaultSecurityKeyServices' field")) + } + m.DefaultSecurityKeyServices = defaultSecurityKeyServices + + noOfSecurityGroups, err := ReadImplicitField[int32](ctx, "noOfSecurityGroups", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityGroups' field")) + } + _ = noOfSecurityGroups + + securityGroups, err := ReadCountArrayField[SecurityGroupDataType](ctx, "securityGroups", ReadComplex[SecurityGroupDataType](ExtensionObjectDefinitionParseWithBufferProducer[SecurityGroupDataType]((int32)(int32(23603))), readBuffer), uint64(noOfSecurityGroups)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityGroups' field")) + } + m.SecurityGroups = securityGroups + + noOfPubSubKeyPushTargets, err := ReadImplicitField[int32](ctx, "noOfPubSubKeyPushTargets", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPubSubKeyPushTargets' field")) + } + _ = noOfPubSubKeyPushTargets + + pubSubKeyPushTargets, err := ReadCountArrayField[PubSubKeyPushTargetDataType](ctx, "pubSubKeyPushTargets", ReadComplex[PubSubKeyPushTargetDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubKeyPushTargetDataType]((int32)(int32(25272))), readBuffer), uint64(noOfPubSubKeyPushTargets)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'pubSubKeyPushTargets' field")) + } + m.PubSubKeyPushTargets = pubSubKeyPushTargets + + configurationVersion, err := ReadSimpleField(ctx, "configurationVersion", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'configurationVersion' field")) + } + m.ConfigurationVersion = configurationVersion + + noOfConfigurationProperties, err := ReadImplicitField[int32](ctx, "noOfConfigurationProperties", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfConfigurationProperties' field")) + } + _ = noOfConfigurationProperties + + configurationProperties, err := ReadCountArrayField[KeyValuePair](ctx, "configurationProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfConfigurationProperties)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'configurationProperties' field")) + } + m.ConfigurationProperties = configurationProperties + + if closeErr := readBuffer.CloseContext("PubSubConfiguration2DataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PubSubConfiguration2DataType") + } + + return m, nil +} + +func (m *_PubSubConfiguration2DataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PubSubConfiguration2DataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PubSubConfiguration2DataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PubSubConfiguration2DataType") + } + noOfPublishedDataSets := int32(utils.InlineIf(bool((m.GetPublishedDataSets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPublishedDataSets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPublishedDataSets", noOfPublishedDataSets, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfPublishedDataSets' field") + } + + if err := WriteComplexTypeArrayField(ctx, "publishedDataSets", m.GetPublishedDataSets(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'publishedDataSets' field") + } + noOfConnections := int32(utils.InlineIf(bool((m.GetConnections()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetConnections()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfConnections", noOfConnections, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfConnections' field") + } + + if err := WriteComplexTypeArrayField(ctx, "connections", m.GetConnections(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'connections' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "enabled", m.GetEnabled(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'enabled' field") + } + noOfSubscribedDataSets := int32(utils.InlineIf(bool((m.GetSubscribedDataSets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSubscribedDataSets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSubscribedDataSets", noOfSubscribedDataSets, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSubscribedDataSets' field") + } + + if err := WriteComplexTypeArrayField(ctx, "subscribedDataSets", m.GetSubscribedDataSets(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'subscribedDataSets' field") + } + noOfDataSetClasses := int32(utils.InlineIf(bool((m.GetDataSetClasses()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetClasses()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetClasses", noOfDataSetClasses, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetClasses' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetClasses", m.GetDataSetClasses(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetClasses' field") + } + noOfDefaultSecurityKeyServices := int32(utils.InlineIf(bool((m.GetDefaultSecurityKeyServices()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDefaultSecurityKeyServices()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDefaultSecurityKeyServices", noOfDefaultSecurityKeyServices, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDefaultSecurityKeyServices' field") + } + + if err := WriteComplexTypeArrayField(ctx, "defaultSecurityKeyServices", m.GetDefaultSecurityKeyServices(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'defaultSecurityKeyServices' field") + } + noOfSecurityGroups := int32(utils.InlineIf(bool((m.GetSecurityGroups()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityGroups()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityGroups", noOfSecurityGroups, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSecurityGroups' field") + } + + if err := WriteComplexTypeArrayField(ctx, "securityGroups", m.GetSecurityGroups(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'securityGroups' field") + } + noOfPubSubKeyPushTargets := int32(utils.InlineIf(bool((m.GetPubSubKeyPushTargets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPubSubKeyPushTargets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPubSubKeyPushTargets", noOfPubSubKeyPushTargets, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfPubSubKeyPushTargets' field") + } + + if err := WriteComplexTypeArrayField(ctx, "pubSubKeyPushTargets", m.GetPubSubKeyPushTargets(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'pubSubKeyPushTargets' field") + } + + if err := WriteSimpleField[uint32](ctx, "configurationVersion", m.GetConfigurationVersion(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'configurationVersion' field") + } + noOfConfigurationProperties := int32(utils.InlineIf(bool((m.GetConfigurationProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetConfigurationProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfConfigurationProperties", noOfConfigurationProperties, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfConfigurationProperties' field") + } + + if err := WriteComplexTypeArrayField(ctx, "configurationProperties", m.GetConfigurationProperties(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'configurationProperties' field") + } + + if popErr := writeBuffer.PopContext("PubSubConfiguration2DataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PubSubConfiguration2DataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PubSubConfiguration2DataType) IsPubSubConfiguration2DataType() {} + +func (m *_PubSubConfiguration2DataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PubSubConfiguration2DataType) deepCopy() *_PubSubConfiguration2DataType { + if m == nil { + return nil + } + _PubSubConfiguration2DataTypeCopy := &_PubSubConfiguration2DataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[PublishedDataSetDataType, PublishedDataSetDataType](m.PublishedDataSets), + utils.DeepCopySlice[PubSubConnectionDataType, PubSubConnectionDataType](m.Connections), + m.Enabled, + utils.DeepCopySlice[StandaloneSubscribedDataSetDataType, StandaloneSubscribedDataSetDataType](m.SubscribedDataSets), + utils.DeepCopySlice[DataSetMetaDataType, DataSetMetaDataType](m.DataSetClasses), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.DefaultSecurityKeyServices), + utils.DeepCopySlice[SecurityGroupDataType, SecurityGroupDataType](m.SecurityGroups), + utils.DeepCopySlice[PubSubKeyPushTargetDataType, PubSubKeyPushTargetDataType](m.PubSubKeyPushTargets), + m.ConfigurationVersion, + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.ConfigurationProperties), + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PubSubConfiguration2DataTypeCopy +} + +func (m *_PubSubConfiguration2DataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationDataType.go index a983f0a3a5e..b9a99d0bb3c 100644 --- a/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationDataType.go @@ -40,14 +40,10 @@ type PubSubConfigurationDataType interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfPublishedDataSets returns NoOfPublishedDataSets (property field) - GetNoOfPublishedDataSets() int32 // GetPublishedDataSets returns PublishedDataSets (property field) - GetPublishedDataSets() []ExtensionObjectDefinition - // GetNoOfConnections returns NoOfConnections (property field) - GetNoOfConnections() int32 + GetPublishedDataSets() []PublishedDataSetDataType // GetConnections returns Connections (property field) - GetConnections() []ExtensionObjectDefinition + GetConnections() []PubSubConnectionDataType // GetEnabled returns Enabled (property field) GetEnabled() bool // IsPubSubConfigurationDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,11 +55,9 @@ type PubSubConfigurationDataType interface { // _PubSubConfigurationDataType is the data-structure of this message type _PubSubConfigurationDataType struct { ExtensionObjectDefinitionContract - NoOfPublishedDataSets int32 - PublishedDataSets []ExtensionObjectDefinition - NoOfConnections int32 - Connections []ExtensionObjectDefinition - Enabled bool + PublishedDataSets []PublishedDataSetDataType + Connections []PubSubConnectionDataType + Enabled bool // Reserved Fields reservedField0 *uint8 } @@ -72,12 +66,10 @@ var _ PubSubConfigurationDataType = (*_PubSubConfigurationDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PubSubConfigurationDataType)(nil) // NewPubSubConfigurationDataType factory function for _PubSubConfigurationDataType -func NewPubSubConfigurationDataType(noOfPublishedDataSets int32, publishedDataSets []ExtensionObjectDefinition, noOfConnections int32, connections []ExtensionObjectDefinition, enabled bool) *_PubSubConfigurationDataType { +func NewPubSubConfigurationDataType(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool) *_PubSubConfigurationDataType { _result := &_PubSubConfigurationDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfPublishedDataSets: noOfPublishedDataSets, PublishedDataSets: publishedDataSets, - NoOfConnections: noOfConnections, Connections: connections, Enabled: enabled, } @@ -94,15 +86,11 @@ func NewPubSubConfigurationDataType(noOfPublishedDataSets int32, publishedDataSe type PubSubConfigurationDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfPublishedDataSets int32, publishedDataSets []ExtensionObjectDefinition, noOfConnections int32, connections []ExtensionObjectDefinition, enabled bool) PubSubConfigurationDataTypeBuilder - // WithNoOfPublishedDataSets adds NoOfPublishedDataSets (property field) - WithNoOfPublishedDataSets(int32) PubSubConfigurationDataTypeBuilder + WithMandatoryFields(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool) PubSubConfigurationDataTypeBuilder // WithPublishedDataSets adds PublishedDataSets (property field) - WithPublishedDataSets(...ExtensionObjectDefinition) PubSubConfigurationDataTypeBuilder - // WithNoOfConnections adds NoOfConnections (property field) - WithNoOfConnections(int32) PubSubConfigurationDataTypeBuilder + WithPublishedDataSets(...PublishedDataSetDataType) PubSubConfigurationDataTypeBuilder // WithConnections adds Connections (property field) - WithConnections(...ExtensionObjectDefinition) PubSubConfigurationDataTypeBuilder + WithConnections(...PubSubConnectionDataType) PubSubConfigurationDataTypeBuilder // WithEnabled adds Enabled (property field) WithEnabled(bool) PubSubConfigurationDataTypeBuilder // Build builds the PubSubConfigurationDataType or returns an error if something is wrong @@ -130,26 +118,16 @@ func (b *_PubSubConfigurationDataTypeBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_PubSubConfigurationDataTypeBuilder) WithMandatoryFields(noOfPublishedDataSets int32, publishedDataSets []ExtensionObjectDefinition, noOfConnections int32, connections []ExtensionObjectDefinition, enabled bool) PubSubConfigurationDataTypeBuilder { - return b.WithNoOfPublishedDataSets(noOfPublishedDataSets).WithPublishedDataSets(publishedDataSets...).WithNoOfConnections(noOfConnections).WithConnections(connections...).WithEnabled(enabled) +func (b *_PubSubConfigurationDataTypeBuilder) WithMandatoryFields(publishedDataSets []PublishedDataSetDataType, connections []PubSubConnectionDataType, enabled bool) PubSubConfigurationDataTypeBuilder { + return b.WithPublishedDataSets(publishedDataSets...).WithConnections(connections...).WithEnabled(enabled) } -func (b *_PubSubConfigurationDataTypeBuilder) WithNoOfPublishedDataSets(noOfPublishedDataSets int32) PubSubConfigurationDataTypeBuilder { - b.NoOfPublishedDataSets = noOfPublishedDataSets - return b -} - -func (b *_PubSubConfigurationDataTypeBuilder) WithPublishedDataSets(publishedDataSets ...ExtensionObjectDefinition) PubSubConfigurationDataTypeBuilder { +func (b *_PubSubConfigurationDataTypeBuilder) WithPublishedDataSets(publishedDataSets ...PublishedDataSetDataType) PubSubConfigurationDataTypeBuilder { b.PublishedDataSets = publishedDataSets return b } -func (b *_PubSubConfigurationDataTypeBuilder) WithNoOfConnections(noOfConnections int32) PubSubConfigurationDataTypeBuilder { - b.NoOfConnections = noOfConnections - return b -} - -func (b *_PubSubConfigurationDataTypeBuilder) WithConnections(connections ...ExtensionObjectDefinition) PubSubConfigurationDataTypeBuilder { +func (b *_PubSubConfigurationDataTypeBuilder) WithConnections(connections ...PubSubConnectionDataType) PubSubConfigurationDataTypeBuilder { b.Connections = connections return b } @@ -209,8 +187,8 @@ func (b *_PubSubConfigurationDataType) CreatePubSubConfigurationDataTypeBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PubSubConfigurationDataType) GetIdentifier() string { - return "15532" +func (m *_PubSubConfigurationDataType) GetExtensionId() int32 { + return int32(15532) } /////////////////////// @@ -227,19 +205,11 @@ func (m *_PubSubConfigurationDataType) GetParent() ExtensionObjectDefinitionCont /////////////////////// Accessors for property fields. /////////////////////// -func (m *_PubSubConfigurationDataType) GetNoOfPublishedDataSets() int32 { - return m.NoOfPublishedDataSets -} - -func (m *_PubSubConfigurationDataType) GetPublishedDataSets() []ExtensionObjectDefinition { +func (m *_PubSubConfigurationDataType) GetPublishedDataSets() []PublishedDataSetDataType { return m.PublishedDataSets } -func (m *_PubSubConfigurationDataType) GetNoOfConnections() int32 { - return m.NoOfConnections -} - -func (m *_PubSubConfigurationDataType) GetConnections() []ExtensionObjectDefinition { +func (m *_PubSubConfigurationDataType) GetConnections() []PubSubConnectionDataType { return m.Connections } @@ -270,7 +240,7 @@ func (m *_PubSubConfigurationDataType) GetTypeName() string { func (m *_PubSubConfigurationDataType) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfPublishedDataSets) + // Implicit Field (noOfPublishedDataSets) lengthInBits += 32 // Array field @@ -283,7 +253,7 @@ func (m *_PubSubConfigurationDataType) GetLengthInBits(ctx context.Context) uint } } - // Simple field (noOfConnections) + // Implicit Field (noOfConnections) lengthInBits += 32 // Array field @@ -309,7 +279,7 @@ func (m *_PubSubConfigurationDataType) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_PubSubConfigurationDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__pubSubConfigurationDataType PubSubConfigurationDataType, err error) { +func (m *_PubSubConfigurationDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubConfigurationDataType PubSubConfigurationDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -320,25 +290,25 @@ func (m *_PubSubConfigurationDataType) parse(ctx context.Context, readBuffer uti currentPos := positionAware.GetPos() _ = currentPos - noOfPublishedDataSets, err := ReadSimpleField(ctx, "noOfPublishedDataSets", ReadSignedInt(readBuffer, uint8(32))) + noOfPublishedDataSets, err := ReadImplicitField[int32](ctx, "noOfPublishedDataSets", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPublishedDataSets' field")) } - m.NoOfPublishedDataSets = noOfPublishedDataSets + _ = noOfPublishedDataSets - publishedDataSets, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "publishedDataSets", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("15580")), readBuffer), uint64(noOfPublishedDataSets)) + publishedDataSets, err := ReadCountArrayField[PublishedDataSetDataType](ctx, "publishedDataSets", ReadComplex[PublishedDataSetDataType](ExtensionObjectDefinitionParseWithBufferProducer[PublishedDataSetDataType]((int32)(int32(15580))), readBuffer), uint64(noOfPublishedDataSets)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishedDataSets' field")) } m.PublishedDataSets = publishedDataSets - noOfConnections, err := ReadSimpleField(ctx, "noOfConnections", ReadSignedInt(readBuffer, uint8(32))) + noOfConnections, err := ReadImplicitField[int32](ctx, "noOfConnections", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfConnections' field")) } - m.NoOfConnections = noOfConnections + _ = noOfConnections - connections, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "connections", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("15619")), readBuffer), uint64(noOfConnections)) + connections, err := ReadCountArrayField[PubSubConnectionDataType](ctx, "connections", ReadComplex[PubSubConnectionDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubConnectionDataType]((int32)(int32(15619))), readBuffer), uint64(noOfConnections)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'connections' field")) } @@ -380,16 +350,16 @@ func (m *_PubSubConfigurationDataType) SerializeWithWriteBuffer(ctx context.Cont if pushErr := writeBuffer.PushContext("PubSubConfigurationDataType"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for PubSubConfigurationDataType") } - - if err := WriteSimpleField[int32](ctx, "noOfPublishedDataSets", m.GetNoOfPublishedDataSets(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfPublishedDataSets := int32(utils.InlineIf(bool((m.GetPublishedDataSets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPublishedDataSets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPublishedDataSets", noOfPublishedDataSets, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfPublishedDataSets' field") } if err := WriteComplexTypeArrayField(ctx, "publishedDataSets", m.GetPublishedDataSets(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'publishedDataSets' field") } - - if err := WriteSimpleField[int32](ctx, "noOfConnections", m.GetNoOfConnections(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfConnections := int32(utils.InlineIf(bool((m.GetConnections()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetConnections()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfConnections", noOfConnections, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfConnections' field") } @@ -425,10 +395,8 @@ func (m *_PubSubConfigurationDataType) deepCopy() *_PubSubConfigurationDataType } _PubSubConfigurationDataTypeCopy := &_PubSubConfigurationDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfPublishedDataSets, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.PublishedDataSets), - m.NoOfConnections, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Connections), + utils.DeepCopySlice[PublishedDataSetDataType, PublishedDataSetDataType](m.PublishedDataSets), + utils.DeepCopySlice[PubSubConnectionDataType, PubSubConnectionDataType](m.Connections), m.Enabled, m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationRefDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationRefDataType.go index e0c73df8156..84a36636a84 100644 --- a/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationRefDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationRefDataType.go @@ -196,8 +196,8 @@ func (b *_PubSubConfigurationRefDataType) CreatePubSubConfigurationRefDataTypeBu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PubSubConfigurationRefDataType) GetIdentifier() string { - return "25521" +func (m *_PubSubConfigurationRefDataType) GetExtensionId() int32 { + return int32(25521) } /////////////////////// @@ -272,7 +272,7 @@ func (m *_PubSubConfigurationRefDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_PubSubConfigurationRefDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__pubSubConfigurationRefDataType PubSubConfigurationRefDataType, err error) { +func (m *_PubSubConfigurationRefDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubConfigurationRefDataType PubSubConfigurationRefDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationValueDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationValueDataType.go new file mode 100644 index 00000000000..f74d929df2c --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PubSubConfigurationValueDataType.go @@ -0,0 +1,436 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PubSubConfigurationValueDataType is the corresponding interface of PubSubConfigurationValueDataType +type PubSubConfigurationValueDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetConfigurationElement returns ConfigurationElement (property field) + GetConfigurationElement() PubSubConfigurationRefDataType + // GetName returns Name (property field) + GetName() PascalString + // GetIdentifier returns Identifier (property field) + GetIdentifier() Variant + // IsPubSubConfigurationValueDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPubSubConfigurationValueDataType() + // CreateBuilder creates a PubSubConfigurationValueDataTypeBuilder + CreatePubSubConfigurationValueDataTypeBuilder() PubSubConfigurationValueDataTypeBuilder +} + +// _PubSubConfigurationValueDataType is the data-structure of this message +type _PubSubConfigurationValueDataType struct { + ExtensionObjectDefinitionContract + ConfigurationElement PubSubConfigurationRefDataType + Name PascalString + Identifier Variant +} + +var _ PubSubConfigurationValueDataType = (*_PubSubConfigurationValueDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PubSubConfigurationValueDataType)(nil) + +// NewPubSubConfigurationValueDataType factory function for _PubSubConfigurationValueDataType +func NewPubSubConfigurationValueDataType(configurationElement PubSubConfigurationRefDataType, name PascalString, identifier Variant) *_PubSubConfigurationValueDataType { + if configurationElement == nil { + panic("configurationElement of type PubSubConfigurationRefDataType for PubSubConfigurationValueDataType must not be nil") + } + if name == nil { + panic("name of type PascalString for PubSubConfigurationValueDataType must not be nil") + } + if identifier == nil { + panic("identifier of type Variant for PubSubConfigurationValueDataType must not be nil") + } + _result := &_PubSubConfigurationValueDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + ConfigurationElement: configurationElement, + Name: name, + Identifier: identifier, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PubSubConfigurationValueDataTypeBuilder is a builder for PubSubConfigurationValueDataType +type PubSubConfigurationValueDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(configurationElement PubSubConfigurationRefDataType, name PascalString, identifier Variant) PubSubConfigurationValueDataTypeBuilder + // WithConfigurationElement adds ConfigurationElement (property field) + WithConfigurationElement(PubSubConfigurationRefDataType) PubSubConfigurationValueDataTypeBuilder + // WithConfigurationElementBuilder adds ConfigurationElement (property field) which is build by the builder + WithConfigurationElementBuilder(func(PubSubConfigurationRefDataTypeBuilder) PubSubConfigurationRefDataTypeBuilder) PubSubConfigurationValueDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) PubSubConfigurationValueDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) PubSubConfigurationValueDataTypeBuilder + // WithIdentifier adds Identifier (property field) + WithIdentifier(Variant) PubSubConfigurationValueDataTypeBuilder + // WithIdentifierBuilder adds Identifier (property field) which is build by the builder + WithIdentifierBuilder(func(VariantBuilder) VariantBuilder) PubSubConfigurationValueDataTypeBuilder + // Build builds the PubSubConfigurationValueDataType or returns an error if something is wrong + Build() (PubSubConfigurationValueDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PubSubConfigurationValueDataType +} + +// NewPubSubConfigurationValueDataTypeBuilder() creates a PubSubConfigurationValueDataTypeBuilder +func NewPubSubConfigurationValueDataTypeBuilder() PubSubConfigurationValueDataTypeBuilder { + return &_PubSubConfigurationValueDataTypeBuilder{_PubSubConfigurationValueDataType: new(_PubSubConfigurationValueDataType)} +} + +type _PubSubConfigurationValueDataTypeBuilder struct { + *_PubSubConfigurationValueDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PubSubConfigurationValueDataTypeBuilder) = (*_PubSubConfigurationValueDataTypeBuilder)(nil) + +func (b *_PubSubConfigurationValueDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithMandatoryFields(configurationElement PubSubConfigurationRefDataType, name PascalString, identifier Variant) PubSubConfigurationValueDataTypeBuilder { + return b.WithConfigurationElement(configurationElement).WithName(name).WithIdentifier(identifier) +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithConfigurationElement(configurationElement PubSubConfigurationRefDataType) PubSubConfigurationValueDataTypeBuilder { + b.ConfigurationElement = configurationElement + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithConfigurationElementBuilder(builderSupplier func(PubSubConfigurationRefDataTypeBuilder) PubSubConfigurationRefDataTypeBuilder) PubSubConfigurationValueDataTypeBuilder { + builder := builderSupplier(b.ConfigurationElement.CreatePubSubConfigurationRefDataTypeBuilder()) + var err error + b.ConfigurationElement, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PubSubConfigurationRefDataTypeBuilder failed")) + } + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithName(name PascalString) PubSubConfigurationValueDataTypeBuilder { + b.Name = name + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) PubSubConfigurationValueDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithIdentifier(identifier Variant) PubSubConfigurationValueDataTypeBuilder { + b.Identifier = identifier + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) WithIdentifierBuilder(builderSupplier func(VariantBuilder) VariantBuilder) PubSubConfigurationValueDataTypeBuilder { + builder := builderSupplier(b.Identifier.CreateVariantBuilder()) + var err error + b.Identifier, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) Build() (PubSubConfigurationValueDataType, error) { + if b.ConfigurationElement == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'configurationElement' not set")) + } + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.Identifier == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'identifier' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PubSubConfigurationValueDataType.deepCopy(), nil +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) MustBuild() PubSubConfigurationValueDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PubSubConfigurationValueDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PubSubConfigurationValueDataTypeBuilder) DeepCopy() any { + _copy := b.CreatePubSubConfigurationValueDataTypeBuilder().(*_PubSubConfigurationValueDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePubSubConfigurationValueDataTypeBuilder creates a PubSubConfigurationValueDataTypeBuilder +func (b *_PubSubConfigurationValueDataType) CreatePubSubConfigurationValueDataTypeBuilder() PubSubConfigurationValueDataTypeBuilder { + if b == nil { + return NewPubSubConfigurationValueDataTypeBuilder() + } + return &_PubSubConfigurationValueDataTypeBuilder{_PubSubConfigurationValueDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PubSubConfigurationValueDataType) GetExtensionId() int32 { + return int32(25522) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PubSubConfigurationValueDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PubSubConfigurationValueDataType) GetConfigurationElement() PubSubConfigurationRefDataType { + return m.ConfigurationElement +} + +func (m *_PubSubConfigurationValueDataType) GetName() PascalString { + return m.Name +} + +func (m *_PubSubConfigurationValueDataType) GetIdentifier() Variant { + return m.Identifier +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPubSubConfigurationValueDataType(structType any) PubSubConfigurationValueDataType { + if casted, ok := structType.(PubSubConfigurationValueDataType); ok { + return casted + } + if casted, ok := structType.(*PubSubConfigurationValueDataType); ok { + return *casted + } + return nil +} + +func (m *_PubSubConfigurationValueDataType) GetTypeName() string { + return "PubSubConfigurationValueDataType" +} + +func (m *_PubSubConfigurationValueDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (configurationElement) + lengthInBits += m.ConfigurationElement.GetLengthInBits(ctx) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Simple field (identifier) + lengthInBits += m.Identifier.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_PubSubConfigurationValueDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PubSubConfigurationValueDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubConfigurationValueDataType PubSubConfigurationValueDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PubSubConfigurationValueDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PubSubConfigurationValueDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + configurationElement, err := ReadSimpleField[PubSubConfigurationRefDataType](ctx, "configurationElement", ReadComplex[PubSubConfigurationRefDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubConfigurationRefDataType]((int32)(int32(25521))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'configurationElement' field")) + } + m.ConfigurationElement = configurationElement + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + identifier, err := ReadSimpleField[Variant](ctx, "identifier", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'identifier' field")) + } + m.Identifier = identifier + + if closeErr := readBuffer.CloseContext("PubSubConfigurationValueDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PubSubConfigurationValueDataType") + } + + return m, nil +} + +func (m *_PubSubConfigurationValueDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PubSubConfigurationValueDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PubSubConfigurationValueDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PubSubConfigurationValueDataType") + } + + if err := WriteSimpleField[PubSubConfigurationRefDataType](ctx, "configurationElement", m.GetConfigurationElement(), WriteComplex[PubSubConfigurationRefDataType](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'configurationElement' field") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteSimpleField[Variant](ctx, "identifier", m.GetIdentifier(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'identifier' field") + } + + if popErr := writeBuffer.PopContext("PubSubConfigurationValueDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PubSubConfigurationValueDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PubSubConfigurationValueDataType) IsPubSubConfigurationValueDataType() {} + +func (m *_PubSubConfigurationValueDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PubSubConfigurationValueDataType) deepCopy() *_PubSubConfigurationValueDataType { + if m == nil { + return nil + } + _PubSubConfigurationValueDataTypeCopy := &_PubSubConfigurationValueDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.ConfigurationElement.DeepCopy().(PubSubConfigurationRefDataType), + m.Name.DeepCopy().(PascalString), + m.Identifier.DeepCopy().(Variant), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PubSubConfigurationValueDataTypeCopy +} + +func (m *_PubSubConfigurationValueDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubConnectionDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubConnectionDataType.go index 4fbf3c78c42..ce0530396f5 100644 --- a/plc4go/protocols/opcua/readwrite/model/PubSubConnectionDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PubSubConnectionDataType.go @@ -50,20 +50,14 @@ type PubSubConnectionDataType interface { GetTransportProfileUri() PascalString // GetAddress returns Address (property field) GetAddress() ExtensionObject - // GetNoOfConnectionProperties returns NoOfConnectionProperties (property field) - GetNoOfConnectionProperties() int32 // GetConnectionProperties returns ConnectionProperties (property field) - GetConnectionProperties() []ExtensionObjectDefinition + GetConnectionProperties() []KeyValuePair // GetTransportSettings returns TransportSettings (property field) GetTransportSettings() ExtensionObject - // GetNoOfWriterGroups returns NoOfWriterGroups (property field) - GetNoOfWriterGroups() int32 // GetWriterGroups returns WriterGroups (property field) - GetWriterGroups() []PubSubGroupDataType - // GetNoOfReaderGroups returns NoOfReaderGroups (property field) - GetNoOfReaderGroups() int32 + GetWriterGroups() []WriterGroupDataType // GetReaderGroups returns ReaderGroups (property field) - GetReaderGroups() []PubSubGroupDataType + GetReaderGroups() []ReaderGroupDataType // IsPubSubConnectionDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsPubSubConnectionDataType() // CreateBuilder creates a PubSubConnectionDataTypeBuilder @@ -73,18 +67,15 @@ type PubSubConnectionDataType interface { // _PubSubConnectionDataType is the data-structure of this message type _PubSubConnectionDataType struct { ExtensionObjectDefinitionContract - Name PascalString - Enabled bool - PublisherId Variant - TransportProfileUri PascalString - Address ExtensionObject - NoOfConnectionProperties int32 - ConnectionProperties []ExtensionObjectDefinition - TransportSettings ExtensionObject - NoOfWriterGroups int32 - WriterGroups []PubSubGroupDataType - NoOfReaderGroups int32 - ReaderGroups []PubSubGroupDataType + Name PascalString + Enabled bool + PublisherId Variant + TransportProfileUri PascalString + Address ExtensionObject + ConnectionProperties []KeyValuePair + TransportSettings ExtensionObject + WriterGroups []WriterGroupDataType + ReaderGroups []ReaderGroupDataType // Reserved Fields reservedField0 *uint8 } @@ -93,7 +84,7 @@ var _ PubSubConnectionDataType = (*_PubSubConnectionDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PubSubConnectionDataType)(nil) // NewPubSubConnectionDataType factory function for _PubSubConnectionDataType -func NewPubSubConnectionDataType(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, noOfConnectionProperties int32, connectionProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, noOfWriterGroups int32, writerGroups []PubSubGroupDataType, noOfReaderGroups int32, readerGroups []PubSubGroupDataType) *_PubSubConnectionDataType { +func NewPubSubConnectionDataType(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, connectionProperties []KeyValuePair, transportSettings ExtensionObject, writerGroups []WriterGroupDataType, readerGroups []ReaderGroupDataType) *_PubSubConnectionDataType { if name == nil { panic("name of type PascalString for PubSubConnectionDataType must not be nil") } @@ -116,12 +107,9 @@ func NewPubSubConnectionDataType(name PascalString, enabled bool, publisherId Va PublisherId: publisherId, TransportProfileUri: transportProfileUri, Address: address, - NoOfConnectionProperties: noOfConnectionProperties, ConnectionProperties: connectionProperties, TransportSettings: transportSettings, - NoOfWriterGroups: noOfWriterGroups, WriterGroups: writerGroups, - NoOfReaderGroups: noOfReaderGroups, ReaderGroups: readerGroups, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -137,7 +125,7 @@ func NewPubSubConnectionDataType(name PascalString, enabled bool, publisherId Va type PubSubConnectionDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, noOfConnectionProperties int32, connectionProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, noOfWriterGroups int32, writerGroups []PubSubGroupDataType, noOfReaderGroups int32, readerGroups []PubSubGroupDataType) PubSubConnectionDataTypeBuilder + WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, connectionProperties []KeyValuePair, transportSettings ExtensionObject, writerGroups []WriterGroupDataType, readerGroups []ReaderGroupDataType) PubSubConnectionDataTypeBuilder // WithName adds Name (property field) WithName(PascalString) PubSubConnectionDataTypeBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -156,22 +144,16 @@ type PubSubConnectionDataTypeBuilder interface { WithAddress(ExtensionObject) PubSubConnectionDataTypeBuilder // WithAddressBuilder adds Address (property field) which is build by the builder WithAddressBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) PubSubConnectionDataTypeBuilder - // WithNoOfConnectionProperties adds NoOfConnectionProperties (property field) - WithNoOfConnectionProperties(int32) PubSubConnectionDataTypeBuilder // WithConnectionProperties adds ConnectionProperties (property field) - WithConnectionProperties(...ExtensionObjectDefinition) PubSubConnectionDataTypeBuilder + WithConnectionProperties(...KeyValuePair) PubSubConnectionDataTypeBuilder // WithTransportSettings adds TransportSettings (property field) WithTransportSettings(ExtensionObject) PubSubConnectionDataTypeBuilder // WithTransportSettingsBuilder adds TransportSettings (property field) which is build by the builder WithTransportSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) PubSubConnectionDataTypeBuilder - // WithNoOfWriterGroups adds NoOfWriterGroups (property field) - WithNoOfWriterGroups(int32) PubSubConnectionDataTypeBuilder // WithWriterGroups adds WriterGroups (property field) - WithWriterGroups(...PubSubGroupDataType) PubSubConnectionDataTypeBuilder - // WithNoOfReaderGroups adds NoOfReaderGroups (property field) - WithNoOfReaderGroups(int32) PubSubConnectionDataTypeBuilder + WithWriterGroups(...WriterGroupDataType) PubSubConnectionDataTypeBuilder // WithReaderGroups adds ReaderGroups (property field) - WithReaderGroups(...PubSubGroupDataType) PubSubConnectionDataTypeBuilder + WithReaderGroups(...ReaderGroupDataType) PubSubConnectionDataTypeBuilder // Build builds the PubSubConnectionDataType or returns an error if something is wrong Build() (PubSubConnectionDataType, error) // MustBuild does the same as Build but panics on error @@ -197,8 +179,8 @@ func (b *_PubSubConnectionDataTypeBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_PubSubConnectionDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, noOfConnectionProperties int32, connectionProperties []ExtensionObjectDefinition, transportSettings ExtensionObject, noOfWriterGroups int32, writerGroups []PubSubGroupDataType, noOfReaderGroups int32, readerGroups []PubSubGroupDataType) PubSubConnectionDataTypeBuilder { - return b.WithName(name).WithEnabled(enabled).WithPublisherId(publisherId).WithTransportProfileUri(transportProfileUri).WithAddress(address).WithNoOfConnectionProperties(noOfConnectionProperties).WithConnectionProperties(connectionProperties...).WithTransportSettings(transportSettings).WithNoOfWriterGroups(noOfWriterGroups).WithWriterGroups(writerGroups...).WithNoOfReaderGroups(noOfReaderGroups).WithReaderGroups(readerGroups...) +func (b *_PubSubConnectionDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, publisherId Variant, transportProfileUri PascalString, address ExtensionObject, connectionProperties []KeyValuePair, transportSettings ExtensionObject, writerGroups []WriterGroupDataType, readerGroups []ReaderGroupDataType) PubSubConnectionDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithPublisherId(publisherId).WithTransportProfileUri(transportProfileUri).WithAddress(address).WithConnectionProperties(connectionProperties...).WithTransportSettings(transportSettings).WithWriterGroups(writerGroups...).WithReaderGroups(readerGroups...) } func (b *_PubSubConnectionDataTypeBuilder) WithName(name PascalString) PubSubConnectionDataTypeBuilder { @@ -278,12 +260,7 @@ func (b *_PubSubConnectionDataTypeBuilder) WithAddressBuilder(builderSupplier fu return b } -func (b *_PubSubConnectionDataTypeBuilder) WithNoOfConnectionProperties(noOfConnectionProperties int32) PubSubConnectionDataTypeBuilder { - b.NoOfConnectionProperties = noOfConnectionProperties - return b -} - -func (b *_PubSubConnectionDataTypeBuilder) WithConnectionProperties(connectionProperties ...ExtensionObjectDefinition) PubSubConnectionDataTypeBuilder { +func (b *_PubSubConnectionDataTypeBuilder) WithConnectionProperties(connectionProperties ...KeyValuePair) PubSubConnectionDataTypeBuilder { b.ConnectionProperties = connectionProperties return b } @@ -306,22 +283,12 @@ func (b *_PubSubConnectionDataTypeBuilder) WithTransportSettingsBuilder(builderS return b } -func (b *_PubSubConnectionDataTypeBuilder) WithNoOfWriterGroups(noOfWriterGroups int32) PubSubConnectionDataTypeBuilder { - b.NoOfWriterGroups = noOfWriterGroups - return b -} - -func (b *_PubSubConnectionDataTypeBuilder) WithWriterGroups(writerGroups ...PubSubGroupDataType) PubSubConnectionDataTypeBuilder { +func (b *_PubSubConnectionDataTypeBuilder) WithWriterGroups(writerGroups ...WriterGroupDataType) PubSubConnectionDataTypeBuilder { b.WriterGroups = writerGroups return b } -func (b *_PubSubConnectionDataTypeBuilder) WithNoOfReaderGroups(noOfReaderGroups int32) PubSubConnectionDataTypeBuilder { - b.NoOfReaderGroups = noOfReaderGroups - return b -} - -func (b *_PubSubConnectionDataTypeBuilder) WithReaderGroups(readerGroups ...PubSubGroupDataType) PubSubConnectionDataTypeBuilder { +func (b *_PubSubConnectionDataTypeBuilder) WithReaderGroups(readerGroups ...ReaderGroupDataType) PubSubConnectionDataTypeBuilder { b.ReaderGroups = readerGroups return b } @@ -406,8 +373,8 @@ func (b *_PubSubConnectionDataType) CreatePubSubConnectionDataTypeBuilder() PubS /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PubSubConnectionDataType) GetIdentifier() string { - return "15619" +func (m *_PubSubConnectionDataType) GetExtensionId() int32 { + return int32(15619) } /////////////////////// @@ -444,11 +411,7 @@ func (m *_PubSubConnectionDataType) GetAddress() ExtensionObject { return m.Address } -func (m *_PubSubConnectionDataType) GetNoOfConnectionProperties() int32 { - return m.NoOfConnectionProperties -} - -func (m *_PubSubConnectionDataType) GetConnectionProperties() []ExtensionObjectDefinition { +func (m *_PubSubConnectionDataType) GetConnectionProperties() []KeyValuePair { return m.ConnectionProperties } @@ -456,19 +419,11 @@ func (m *_PubSubConnectionDataType) GetTransportSettings() ExtensionObject { return m.TransportSettings } -func (m *_PubSubConnectionDataType) GetNoOfWriterGroups() int32 { - return m.NoOfWriterGroups -} - -func (m *_PubSubConnectionDataType) GetWriterGroups() []PubSubGroupDataType { +func (m *_PubSubConnectionDataType) GetWriterGroups() []WriterGroupDataType { return m.WriterGroups } -func (m *_PubSubConnectionDataType) GetNoOfReaderGroups() int32 { - return m.NoOfReaderGroups -} - -func (m *_PubSubConnectionDataType) GetReaderGroups() []PubSubGroupDataType { +func (m *_PubSubConnectionDataType) GetReaderGroups() []ReaderGroupDataType { return m.ReaderGroups } @@ -513,7 +468,7 @@ func (m *_PubSubConnectionDataType) GetLengthInBits(ctx context.Context) uint16 // Simple field (address) lengthInBits += m.Address.GetLengthInBits(ctx) - // Simple field (noOfConnectionProperties) + // Implicit Field (noOfConnectionProperties) lengthInBits += 32 // Array field @@ -529,7 +484,7 @@ func (m *_PubSubConnectionDataType) GetLengthInBits(ctx context.Context) uint16 // Simple field (transportSettings) lengthInBits += m.TransportSettings.GetLengthInBits(ctx) - // Simple field (noOfWriterGroups) + // Implicit Field (noOfWriterGroups) lengthInBits += 32 // Array field @@ -542,7 +497,7 @@ func (m *_PubSubConnectionDataType) GetLengthInBits(ctx context.Context) uint16 } } - // Simple field (noOfReaderGroups) + // Implicit Field (noOfReaderGroups) lengthInBits += 32 // Array field @@ -562,7 +517,7 @@ func (m *_PubSubConnectionDataType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_PubSubConnectionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__pubSubConnectionDataType PubSubConnectionDataType, err error) { +func (m *_PubSubConnectionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubConnectionDataType PubSubConnectionDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -603,49 +558,49 @@ func (m *_PubSubConnectionDataType) parse(ctx context.Context, readBuffer utils. } m.TransportProfileUri = transportProfileUri - address, err := ReadSimpleField[ExtensionObject](ctx, "address", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + address, err := ReadSimpleField[ExtensionObject](ctx, "address", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'address' field")) } m.Address = address - noOfConnectionProperties, err := ReadSimpleField(ctx, "noOfConnectionProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfConnectionProperties, err := ReadImplicitField[int32](ctx, "noOfConnectionProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfConnectionProperties' field")) } - m.NoOfConnectionProperties = noOfConnectionProperties + _ = noOfConnectionProperties - connectionProperties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "connectionProperties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfConnectionProperties)) + connectionProperties, err := ReadCountArrayField[KeyValuePair](ctx, "connectionProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfConnectionProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'connectionProperties' field")) } m.ConnectionProperties = connectionProperties - transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transportSettings' field")) } m.TransportSettings = transportSettings - noOfWriterGroups, err := ReadSimpleField(ctx, "noOfWriterGroups", ReadSignedInt(readBuffer, uint8(32))) + noOfWriterGroups, err := ReadImplicitField[int32](ctx, "noOfWriterGroups", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfWriterGroups' field")) } - m.NoOfWriterGroups = noOfWriterGroups + _ = noOfWriterGroups - writerGroups, err := ReadCountArrayField[PubSubGroupDataType](ctx, "writerGroups", ReadComplex[PubSubGroupDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubGroupDataType]((string)("15609")), readBuffer), uint64(noOfWriterGroups)) + writerGroups, err := ReadCountArrayField[WriterGroupDataType](ctx, "writerGroups", ReadComplex[WriterGroupDataType](ExtensionObjectDefinitionParseWithBufferProducer[WriterGroupDataType]((int32)(int32(15482))), readBuffer), uint64(noOfWriterGroups)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writerGroups' field")) } m.WriterGroups = writerGroups - noOfReaderGroups, err := ReadSimpleField(ctx, "noOfReaderGroups", ReadSignedInt(readBuffer, uint8(32))) + noOfReaderGroups, err := ReadImplicitField[int32](ctx, "noOfReaderGroups", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReaderGroups' field")) } - m.NoOfReaderGroups = noOfReaderGroups + _ = noOfReaderGroups - readerGroups, err := ReadCountArrayField[PubSubGroupDataType](ctx, "readerGroups", ReadComplex[PubSubGroupDataType](ExtensionObjectDefinitionParseWithBufferProducer[PubSubGroupDataType]((string)("15609")), readBuffer), uint64(noOfReaderGroups)) + readerGroups, err := ReadCountArrayField[ReaderGroupDataType](ctx, "readerGroups", ReadComplex[ReaderGroupDataType](ExtensionObjectDefinitionParseWithBufferProducer[ReaderGroupDataType]((int32)(int32(15522))), readBuffer), uint64(noOfReaderGroups)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'readerGroups' field")) } @@ -699,8 +654,8 @@ func (m *_PubSubConnectionDataType) SerializeWithWriteBuffer(ctx context.Context if err := WriteSimpleField[ExtensionObject](ctx, "address", m.GetAddress(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'address' field") } - - if err := WriteSimpleField[int32](ctx, "noOfConnectionProperties", m.GetNoOfConnectionProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfConnectionProperties := int32(utils.InlineIf(bool((m.GetConnectionProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetConnectionProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfConnectionProperties", noOfConnectionProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfConnectionProperties' field") } @@ -711,16 +666,16 @@ func (m *_PubSubConnectionDataType) SerializeWithWriteBuffer(ctx context.Context if err := WriteSimpleField[ExtensionObject](ctx, "transportSettings", m.GetTransportSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'transportSettings' field") } - - if err := WriteSimpleField[int32](ctx, "noOfWriterGroups", m.GetNoOfWriterGroups(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfWriterGroups := int32(utils.InlineIf(bool((m.GetWriterGroups()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetWriterGroups()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfWriterGroups", noOfWriterGroups, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfWriterGroups' field") } if err := WriteComplexTypeArrayField(ctx, "writerGroups", m.GetWriterGroups(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'writerGroups' field") } - - if err := WriteSimpleField[int32](ctx, "noOfReaderGroups", m.GetNoOfReaderGroups(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfReaderGroups := int32(utils.InlineIf(bool((m.GetReaderGroups()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReaderGroups()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReaderGroups", noOfReaderGroups, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfReaderGroups' field") } @@ -753,13 +708,10 @@ func (m *_PubSubConnectionDataType) deepCopy() *_PubSubConnectionDataType { m.PublisherId.DeepCopy().(Variant), m.TransportProfileUri.DeepCopy().(PascalString), m.Address.DeepCopy().(ExtensionObject), - m.NoOfConnectionProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ConnectionProperties), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.ConnectionProperties), m.TransportSettings.DeepCopy().(ExtensionObject), - m.NoOfWriterGroups, - utils.DeepCopySlice[PubSubGroupDataType, PubSubGroupDataType](m.WriterGroups), - m.NoOfReaderGroups, - utils.DeepCopySlice[PubSubGroupDataType, PubSubGroupDataType](m.ReaderGroups), + utils.DeepCopySlice[WriterGroupDataType, WriterGroupDataType](m.WriterGroups), + utils.DeepCopySlice[ReaderGroupDataType, ReaderGroupDataType](m.ReaderGroups), m.reservedField0, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubGroupDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubGroupDataType.go index eb554d68d0f..eb8dcb6f653 100644 --- a/plc4go/protocols/opcua/readwrite/model/PubSubGroupDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PubSubGroupDataType.go @@ -48,16 +48,12 @@ type PubSubGroupDataType interface { GetSecurityMode() MessageSecurityMode // GetSecurityGroupId returns SecurityGroupId (property field) GetSecurityGroupId() PascalString - // GetNoOfSecurityKeyServices returns NoOfSecurityKeyServices (property field) - GetNoOfSecurityKeyServices() int32 // GetSecurityKeyServices returns SecurityKeyServices (property field) - GetSecurityKeyServices() []ExtensionObjectDefinition + GetSecurityKeyServices() []EndpointDescription // GetMaxNetworkMessageSize returns MaxNetworkMessageSize (property field) GetMaxNetworkMessageSize() uint32 - // GetNoOfGroupProperties returns NoOfGroupProperties (property field) - GetNoOfGroupProperties() int32 // GetGroupProperties returns GroupProperties (property field) - GetGroupProperties() []ExtensionObjectDefinition + GetGroupProperties() []KeyValuePair // IsPubSubGroupDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsPubSubGroupDataType() // CreateBuilder creates a PubSubGroupDataTypeBuilder @@ -67,15 +63,13 @@ type PubSubGroupDataType interface { // _PubSubGroupDataType is the data-structure of this message type _PubSubGroupDataType struct { ExtensionObjectDefinitionContract - Name PascalString - Enabled bool - SecurityMode MessageSecurityMode - SecurityGroupId PascalString - NoOfSecurityKeyServices int32 - SecurityKeyServices []ExtensionObjectDefinition - MaxNetworkMessageSize uint32 - NoOfGroupProperties int32 - GroupProperties []ExtensionObjectDefinition + Name PascalString + Enabled bool + SecurityMode MessageSecurityMode + SecurityGroupId PascalString + SecurityKeyServices []EndpointDescription + MaxNetworkMessageSize uint32 + GroupProperties []KeyValuePair // Reserved Fields reservedField0 *uint8 } @@ -84,7 +78,7 @@ var _ PubSubGroupDataType = (*_PubSubGroupDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PubSubGroupDataType)(nil) // NewPubSubGroupDataType factory function for _PubSubGroupDataType -func NewPubSubGroupDataType(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, noOfSecurityKeyServices int32, securityKeyServices []ExtensionObjectDefinition, maxNetworkMessageSize uint32, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) *_PubSubGroupDataType { +func NewPubSubGroupDataType(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair) *_PubSubGroupDataType { if name == nil { panic("name of type PascalString for PubSubGroupDataType must not be nil") } @@ -97,10 +91,8 @@ func NewPubSubGroupDataType(name PascalString, enabled bool, securityMode Messag Enabled: enabled, SecurityMode: securityMode, SecurityGroupId: securityGroupId, - NoOfSecurityKeyServices: noOfSecurityKeyServices, SecurityKeyServices: securityKeyServices, MaxNetworkMessageSize: maxNetworkMessageSize, - NoOfGroupProperties: noOfGroupProperties, GroupProperties: groupProperties, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -116,7 +108,7 @@ func NewPubSubGroupDataType(name PascalString, enabled bool, securityMode Messag type PubSubGroupDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, noOfSecurityKeyServices int32, securityKeyServices []ExtensionObjectDefinition, maxNetworkMessageSize uint32, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) PubSubGroupDataTypeBuilder + WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair) PubSubGroupDataTypeBuilder // WithName adds Name (property field) WithName(PascalString) PubSubGroupDataTypeBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -129,16 +121,12 @@ type PubSubGroupDataTypeBuilder interface { WithSecurityGroupId(PascalString) PubSubGroupDataTypeBuilder // WithSecurityGroupIdBuilder adds SecurityGroupId (property field) which is build by the builder WithSecurityGroupIdBuilder(func(PascalStringBuilder) PascalStringBuilder) PubSubGroupDataTypeBuilder - // WithNoOfSecurityKeyServices adds NoOfSecurityKeyServices (property field) - WithNoOfSecurityKeyServices(int32) PubSubGroupDataTypeBuilder // WithSecurityKeyServices adds SecurityKeyServices (property field) - WithSecurityKeyServices(...ExtensionObjectDefinition) PubSubGroupDataTypeBuilder + WithSecurityKeyServices(...EndpointDescription) PubSubGroupDataTypeBuilder // WithMaxNetworkMessageSize adds MaxNetworkMessageSize (property field) WithMaxNetworkMessageSize(uint32) PubSubGroupDataTypeBuilder - // WithNoOfGroupProperties adds NoOfGroupProperties (property field) - WithNoOfGroupProperties(int32) PubSubGroupDataTypeBuilder // WithGroupProperties adds GroupProperties (property field) - WithGroupProperties(...ExtensionObjectDefinition) PubSubGroupDataTypeBuilder + WithGroupProperties(...KeyValuePair) PubSubGroupDataTypeBuilder // Build builds the PubSubGroupDataType or returns an error if something is wrong Build() (PubSubGroupDataType, error) // MustBuild does the same as Build but panics on error @@ -164,8 +152,8 @@ func (b *_PubSubGroupDataTypeBuilder) setParent(contract ExtensionObjectDefiniti b.ExtensionObjectDefinitionContract = contract } -func (b *_PubSubGroupDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, noOfSecurityKeyServices int32, securityKeyServices []ExtensionObjectDefinition, maxNetworkMessageSize uint32, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) PubSubGroupDataTypeBuilder { - return b.WithName(name).WithEnabled(enabled).WithSecurityMode(securityMode).WithSecurityGroupId(securityGroupId).WithNoOfSecurityKeyServices(noOfSecurityKeyServices).WithSecurityKeyServices(securityKeyServices...).WithMaxNetworkMessageSize(maxNetworkMessageSize).WithNoOfGroupProperties(noOfGroupProperties).WithGroupProperties(groupProperties...) +func (b *_PubSubGroupDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair) PubSubGroupDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithSecurityMode(securityMode).WithSecurityGroupId(securityGroupId).WithSecurityKeyServices(securityKeyServices...).WithMaxNetworkMessageSize(maxNetworkMessageSize).WithGroupProperties(groupProperties...) } func (b *_PubSubGroupDataTypeBuilder) WithName(name PascalString) PubSubGroupDataTypeBuilder { @@ -214,12 +202,7 @@ func (b *_PubSubGroupDataTypeBuilder) WithSecurityGroupIdBuilder(builderSupplier return b } -func (b *_PubSubGroupDataTypeBuilder) WithNoOfSecurityKeyServices(noOfSecurityKeyServices int32) PubSubGroupDataTypeBuilder { - b.NoOfSecurityKeyServices = noOfSecurityKeyServices - return b -} - -func (b *_PubSubGroupDataTypeBuilder) WithSecurityKeyServices(securityKeyServices ...ExtensionObjectDefinition) PubSubGroupDataTypeBuilder { +func (b *_PubSubGroupDataTypeBuilder) WithSecurityKeyServices(securityKeyServices ...EndpointDescription) PubSubGroupDataTypeBuilder { b.SecurityKeyServices = securityKeyServices return b } @@ -229,12 +212,7 @@ func (b *_PubSubGroupDataTypeBuilder) WithMaxNetworkMessageSize(maxNetworkMessag return b } -func (b *_PubSubGroupDataTypeBuilder) WithNoOfGroupProperties(noOfGroupProperties int32) PubSubGroupDataTypeBuilder { - b.NoOfGroupProperties = noOfGroupProperties - return b -} - -func (b *_PubSubGroupDataTypeBuilder) WithGroupProperties(groupProperties ...ExtensionObjectDefinition) PubSubGroupDataTypeBuilder { +func (b *_PubSubGroupDataTypeBuilder) WithGroupProperties(groupProperties ...KeyValuePair) PubSubGroupDataTypeBuilder { b.GroupProperties = groupProperties return b } @@ -301,8 +279,8 @@ func (b *_PubSubGroupDataType) CreatePubSubGroupDataTypeBuilder() PubSubGroupDat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PubSubGroupDataType) GetIdentifier() string { - return "15611" +func (m *_PubSubGroupDataType) GetExtensionId() int32 { + return int32(15611) } /////////////////////// @@ -335,11 +313,7 @@ func (m *_PubSubGroupDataType) GetSecurityGroupId() PascalString { return m.SecurityGroupId } -func (m *_PubSubGroupDataType) GetNoOfSecurityKeyServices() int32 { - return m.NoOfSecurityKeyServices -} - -func (m *_PubSubGroupDataType) GetSecurityKeyServices() []ExtensionObjectDefinition { +func (m *_PubSubGroupDataType) GetSecurityKeyServices() []EndpointDescription { return m.SecurityKeyServices } @@ -347,11 +321,7 @@ func (m *_PubSubGroupDataType) GetMaxNetworkMessageSize() uint32 { return m.MaxNetworkMessageSize } -func (m *_PubSubGroupDataType) GetNoOfGroupProperties() int32 { - return m.NoOfGroupProperties -} - -func (m *_PubSubGroupDataType) GetGroupProperties() []ExtensionObjectDefinition { +func (m *_PubSubGroupDataType) GetGroupProperties() []KeyValuePair { return m.GroupProperties } @@ -393,7 +363,7 @@ func (m *_PubSubGroupDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (securityGroupId) lengthInBits += m.SecurityGroupId.GetLengthInBits(ctx) - // Simple field (noOfSecurityKeyServices) + // Implicit Field (noOfSecurityKeyServices) lengthInBits += 32 // Array field @@ -409,7 +379,7 @@ func (m *_PubSubGroupDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (maxNetworkMessageSize) lengthInBits += 32 - // Simple field (noOfGroupProperties) + // Implicit Field (noOfGroupProperties) lengthInBits += 32 // Array field @@ -429,7 +399,7 @@ func (m *_PubSubGroupDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_PubSubGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__pubSubGroupDataType PubSubGroupDataType, err error) { +func (m *_PubSubGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubGroupDataType PubSubGroupDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -470,13 +440,13 @@ func (m *_PubSubGroupDataType) parse(ctx context.Context, readBuffer utils.ReadB } m.SecurityGroupId = securityGroupId - noOfSecurityKeyServices, err := ReadSimpleField(ctx, "noOfSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) + noOfSecurityKeyServices, err := ReadImplicitField[int32](ctx, "noOfSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityKeyServices' field")) } - m.NoOfSecurityKeyServices = noOfSecurityKeyServices + _ = noOfSecurityKeyServices - securityKeyServices, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "securityKeyServices", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("314")), readBuffer), uint64(noOfSecurityKeyServices)) + securityKeyServices, err := ReadCountArrayField[EndpointDescription](ctx, "securityKeyServices", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfSecurityKeyServices)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityKeyServices' field")) } @@ -488,13 +458,13 @@ func (m *_PubSubGroupDataType) parse(ctx context.Context, readBuffer utils.ReadB } m.MaxNetworkMessageSize = maxNetworkMessageSize - noOfGroupProperties, err := ReadSimpleField(ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfGroupProperties, err := ReadImplicitField[int32](ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfGroupProperties' field")) } - m.NoOfGroupProperties = noOfGroupProperties + _ = noOfGroupProperties - groupProperties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "groupProperties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfGroupProperties)) + groupProperties, err := ReadCountArrayField[KeyValuePair](ctx, "groupProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfGroupProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupProperties' field")) } @@ -544,8 +514,8 @@ func (m *_PubSubGroupDataType) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[PascalString](ctx, "securityGroupId", m.GetSecurityGroupId(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'securityGroupId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSecurityKeyServices", m.GetNoOfSecurityKeyServices(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSecurityKeyServices := int32(utils.InlineIf(bool((m.GetSecurityKeyServices()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityKeyServices()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityKeyServices", noOfSecurityKeyServices, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSecurityKeyServices' field") } @@ -556,8 +526,8 @@ func (m *_PubSubGroupDataType) SerializeWithWriteBuffer(ctx context.Context, wri if err := WriteSimpleField[uint32](ctx, "maxNetworkMessageSize", m.GetMaxNetworkMessageSize(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'maxNetworkMessageSize' field") } - - if err := WriteSimpleField[int32](ctx, "noOfGroupProperties", m.GetNoOfGroupProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfGroupProperties := int32(utils.InlineIf(bool((m.GetGroupProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetGroupProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfGroupProperties", noOfGroupProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfGroupProperties' field") } @@ -589,11 +559,9 @@ func (m *_PubSubGroupDataType) deepCopy() *_PubSubGroupDataType { m.Enabled, m.SecurityMode, m.SecurityGroupId.DeepCopy().(PascalString), - m.NoOfSecurityKeyServices, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.SecurityKeyServices), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.SecurityKeyServices), m.MaxNetworkMessageSize, - m.NoOfGroupProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.GroupProperties), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.GroupProperties), m.reservedField0, } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/PubSubKeyPushTargetDataType.go b/plc4go/protocols/opcua/readwrite/model/PubSubKeyPushTargetDataType.go index e354e00847c..6e008a65180 100644 --- a/plc4go/protocols/opcua/readwrite/model/PubSubKeyPushTargetDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PubSubKeyPushTargetDataType.go @@ -42,8 +42,6 @@ type PubSubKeyPushTargetDataType interface { ExtensionObjectDefinition // GetApplicationUri returns ApplicationUri (property field) GetApplicationUri() PascalString - // GetNoOfPushTargetFolder returns NoOfPushTargetFolder (property field) - GetNoOfPushTargetFolder() int32 // GetPushTargetFolder returns PushTargetFolder (property field) GetPushTargetFolder() []PascalString // GetEndpointUrl returns EndpointUrl (property field) @@ -51,17 +49,13 @@ type PubSubKeyPushTargetDataType interface { // GetSecurityPolicyUri returns SecurityPolicyUri (property field) GetSecurityPolicyUri() PascalString // GetUserTokenType returns UserTokenType (property field) - GetUserTokenType() ExtensionObjectDefinition + GetUserTokenType() UserTokenPolicy // GetRequestedKeyCount returns RequestedKeyCount (property field) GetRequestedKeyCount() uint16 // GetRetryInterval returns RetryInterval (property field) GetRetryInterval() float64 - // GetNoOfPushTargetProperties returns NoOfPushTargetProperties (property field) - GetNoOfPushTargetProperties() int32 // GetPushTargetProperties returns PushTargetProperties (property field) - GetPushTargetProperties() []ExtensionObjectDefinition - // GetNoOfSecurityGroups returns NoOfSecurityGroups (property field) - GetNoOfSecurityGroups() int32 + GetPushTargetProperties() []KeyValuePair // GetSecurityGroups returns SecurityGroups (property field) GetSecurityGroups() []PascalString // IsPubSubKeyPushTargetDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -73,25 +67,22 @@ type PubSubKeyPushTargetDataType interface { // _PubSubKeyPushTargetDataType is the data-structure of this message type _PubSubKeyPushTargetDataType struct { ExtensionObjectDefinitionContract - ApplicationUri PascalString - NoOfPushTargetFolder int32 - PushTargetFolder []PascalString - EndpointUrl PascalString - SecurityPolicyUri PascalString - UserTokenType ExtensionObjectDefinition - RequestedKeyCount uint16 - RetryInterval float64 - NoOfPushTargetProperties int32 - PushTargetProperties []ExtensionObjectDefinition - NoOfSecurityGroups int32 - SecurityGroups []PascalString + ApplicationUri PascalString + PushTargetFolder []PascalString + EndpointUrl PascalString + SecurityPolicyUri PascalString + UserTokenType UserTokenPolicy + RequestedKeyCount uint16 + RetryInterval float64 + PushTargetProperties []KeyValuePair + SecurityGroups []PascalString } var _ PubSubKeyPushTargetDataType = (*_PubSubKeyPushTargetDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PubSubKeyPushTargetDataType)(nil) // NewPubSubKeyPushTargetDataType factory function for _PubSubKeyPushTargetDataType -func NewPubSubKeyPushTargetDataType(applicationUri PascalString, noOfPushTargetFolder int32, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType ExtensionObjectDefinition, requestedKeyCount uint16, retryInterval float64, noOfPushTargetProperties int32, pushTargetProperties []ExtensionObjectDefinition, noOfSecurityGroups int32, securityGroups []PascalString) *_PubSubKeyPushTargetDataType { +func NewPubSubKeyPushTargetDataType(applicationUri PascalString, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType UserTokenPolicy, requestedKeyCount uint16, retryInterval float64, pushTargetProperties []KeyValuePair, securityGroups []PascalString) *_PubSubKeyPushTargetDataType { if applicationUri == nil { panic("applicationUri of type PascalString for PubSubKeyPushTargetDataType must not be nil") } @@ -102,21 +93,18 @@ func NewPubSubKeyPushTargetDataType(applicationUri PascalString, noOfPushTargetF panic("securityPolicyUri of type PascalString for PubSubKeyPushTargetDataType must not be nil") } if userTokenType == nil { - panic("userTokenType of type ExtensionObjectDefinition for PubSubKeyPushTargetDataType must not be nil") + panic("userTokenType of type UserTokenPolicy for PubSubKeyPushTargetDataType must not be nil") } _result := &_PubSubKeyPushTargetDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ApplicationUri: applicationUri, - NoOfPushTargetFolder: noOfPushTargetFolder, PushTargetFolder: pushTargetFolder, EndpointUrl: endpointUrl, SecurityPolicyUri: securityPolicyUri, UserTokenType: userTokenType, RequestedKeyCount: requestedKeyCount, RetryInterval: retryInterval, - NoOfPushTargetProperties: noOfPushTargetProperties, PushTargetProperties: pushTargetProperties, - NoOfSecurityGroups: noOfSecurityGroups, SecurityGroups: securityGroups, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -132,13 +120,11 @@ func NewPubSubKeyPushTargetDataType(applicationUri PascalString, noOfPushTargetF type PubSubKeyPushTargetDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(applicationUri PascalString, noOfPushTargetFolder int32, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType ExtensionObjectDefinition, requestedKeyCount uint16, retryInterval float64, noOfPushTargetProperties int32, pushTargetProperties []ExtensionObjectDefinition, noOfSecurityGroups int32, securityGroups []PascalString) PubSubKeyPushTargetDataTypeBuilder + WithMandatoryFields(applicationUri PascalString, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType UserTokenPolicy, requestedKeyCount uint16, retryInterval float64, pushTargetProperties []KeyValuePair, securityGroups []PascalString) PubSubKeyPushTargetDataTypeBuilder // WithApplicationUri adds ApplicationUri (property field) WithApplicationUri(PascalString) PubSubKeyPushTargetDataTypeBuilder // WithApplicationUriBuilder adds ApplicationUri (property field) which is build by the builder WithApplicationUriBuilder(func(PascalStringBuilder) PascalStringBuilder) PubSubKeyPushTargetDataTypeBuilder - // WithNoOfPushTargetFolder adds NoOfPushTargetFolder (property field) - WithNoOfPushTargetFolder(int32) PubSubKeyPushTargetDataTypeBuilder // WithPushTargetFolder adds PushTargetFolder (property field) WithPushTargetFolder(...PascalString) PubSubKeyPushTargetDataTypeBuilder // WithEndpointUrl adds EndpointUrl (property field) @@ -150,19 +136,15 @@ type PubSubKeyPushTargetDataTypeBuilder interface { // WithSecurityPolicyUriBuilder adds SecurityPolicyUri (property field) which is build by the builder WithSecurityPolicyUriBuilder(func(PascalStringBuilder) PascalStringBuilder) PubSubKeyPushTargetDataTypeBuilder // WithUserTokenType adds UserTokenType (property field) - WithUserTokenType(ExtensionObjectDefinition) PubSubKeyPushTargetDataTypeBuilder + WithUserTokenType(UserTokenPolicy) PubSubKeyPushTargetDataTypeBuilder // WithUserTokenTypeBuilder adds UserTokenType (property field) which is build by the builder - WithUserTokenTypeBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PubSubKeyPushTargetDataTypeBuilder + WithUserTokenTypeBuilder(func(UserTokenPolicyBuilder) UserTokenPolicyBuilder) PubSubKeyPushTargetDataTypeBuilder // WithRequestedKeyCount adds RequestedKeyCount (property field) WithRequestedKeyCount(uint16) PubSubKeyPushTargetDataTypeBuilder // WithRetryInterval adds RetryInterval (property field) WithRetryInterval(float64) PubSubKeyPushTargetDataTypeBuilder - // WithNoOfPushTargetProperties adds NoOfPushTargetProperties (property field) - WithNoOfPushTargetProperties(int32) PubSubKeyPushTargetDataTypeBuilder // WithPushTargetProperties adds PushTargetProperties (property field) - WithPushTargetProperties(...ExtensionObjectDefinition) PubSubKeyPushTargetDataTypeBuilder - // WithNoOfSecurityGroups adds NoOfSecurityGroups (property field) - WithNoOfSecurityGroups(int32) PubSubKeyPushTargetDataTypeBuilder + WithPushTargetProperties(...KeyValuePair) PubSubKeyPushTargetDataTypeBuilder // WithSecurityGroups adds SecurityGroups (property field) WithSecurityGroups(...PascalString) PubSubKeyPushTargetDataTypeBuilder // Build builds the PubSubKeyPushTargetDataType or returns an error if something is wrong @@ -190,8 +172,8 @@ func (b *_PubSubKeyPushTargetDataTypeBuilder) setParent(contract ExtensionObject b.ExtensionObjectDefinitionContract = contract } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithMandatoryFields(applicationUri PascalString, noOfPushTargetFolder int32, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType ExtensionObjectDefinition, requestedKeyCount uint16, retryInterval float64, noOfPushTargetProperties int32, pushTargetProperties []ExtensionObjectDefinition, noOfSecurityGroups int32, securityGroups []PascalString) PubSubKeyPushTargetDataTypeBuilder { - return b.WithApplicationUri(applicationUri).WithNoOfPushTargetFolder(noOfPushTargetFolder).WithPushTargetFolder(pushTargetFolder...).WithEndpointUrl(endpointUrl).WithSecurityPolicyUri(securityPolicyUri).WithUserTokenType(userTokenType).WithRequestedKeyCount(requestedKeyCount).WithRetryInterval(retryInterval).WithNoOfPushTargetProperties(noOfPushTargetProperties).WithPushTargetProperties(pushTargetProperties...).WithNoOfSecurityGroups(noOfSecurityGroups).WithSecurityGroups(securityGroups...) +func (b *_PubSubKeyPushTargetDataTypeBuilder) WithMandatoryFields(applicationUri PascalString, pushTargetFolder []PascalString, endpointUrl PascalString, securityPolicyUri PascalString, userTokenType UserTokenPolicy, requestedKeyCount uint16, retryInterval float64, pushTargetProperties []KeyValuePair, securityGroups []PascalString) PubSubKeyPushTargetDataTypeBuilder { + return b.WithApplicationUri(applicationUri).WithPushTargetFolder(pushTargetFolder...).WithEndpointUrl(endpointUrl).WithSecurityPolicyUri(securityPolicyUri).WithUserTokenType(userTokenType).WithRequestedKeyCount(requestedKeyCount).WithRetryInterval(retryInterval).WithPushTargetProperties(pushTargetProperties...).WithSecurityGroups(securityGroups...) } func (b *_PubSubKeyPushTargetDataTypeBuilder) WithApplicationUri(applicationUri PascalString) PubSubKeyPushTargetDataTypeBuilder { @@ -212,11 +194,6 @@ func (b *_PubSubKeyPushTargetDataTypeBuilder) WithApplicationUriBuilder(builderS return b } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithNoOfPushTargetFolder(noOfPushTargetFolder int32) PubSubKeyPushTargetDataTypeBuilder { - b.NoOfPushTargetFolder = noOfPushTargetFolder - return b -} - func (b *_PubSubKeyPushTargetDataTypeBuilder) WithPushTargetFolder(pushTargetFolder ...PascalString) PubSubKeyPushTargetDataTypeBuilder { b.PushTargetFolder = pushTargetFolder return b @@ -258,20 +235,20 @@ func (b *_PubSubKeyPushTargetDataTypeBuilder) WithSecurityPolicyUriBuilder(build return b } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithUserTokenType(userTokenType ExtensionObjectDefinition) PubSubKeyPushTargetDataTypeBuilder { +func (b *_PubSubKeyPushTargetDataTypeBuilder) WithUserTokenType(userTokenType UserTokenPolicy) PubSubKeyPushTargetDataTypeBuilder { b.UserTokenType = userTokenType return b } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithUserTokenTypeBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PubSubKeyPushTargetDataTypeBuilder { - builder := builderSupplier(b.UserTokenType.CreateExtensionObjectDefinitionBuilder()) +func (b *_PubSubKeyPushTargetDataTypeBuilder) WithUserTokenTypeBuilder(builderSupplier func(UserTokenPolicyBuilder) UserTokenPolicyBuilder) PubSubKeyPushTargetDataTypeBuilder { + builder := builderSupplier(b.UserTokenType.CreateUserTokenPolicyBuilder()) var err error b.UserTokenType, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "UserTokenPolicyBuilder failed")) } return b } @@ -286,21 +263,11 @@ func (b *_PubSubKeyPushTargetDataTypeBuilder) WithRetryInterval(retryInterval fl return b } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithNoOfPushTargetProperties(noOfPushTargetProperties int32) PubSubKeyPushTargetDataTypeBuilder { - b.NoOfPushTargetProperties = noOfPushTargetProperties - return b -} - -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithPushTargetProperties(pushTargetProperties ...ExtensionObjectDefinition) PubSubKeyPushTargetDataTypeBuilder { +func (b *_PubSubKeyPushTargetDataTypeBuilder) WithPushTargetProperties(pushTargetProperties ...KeyValuePair) PubSubKeyPushTargetDataTypeBuilder { b.PushTargetProperties = pushTargetProperties return b } -func (b *_PubSubKeyPushTargetDataTypeBuilder) WithNoOfSecurityGroups(noOfSecurityGroups int32) PubSubKeyPushTargetDataTypeBuilder { - b.NoOfSecurityGroups = noOfSecurityGroups - return b -} - func (b *_PubSubKeyPushTargetDataTypeBuilder) WithSecurityGroups(securityGroups ...PascalString) PubSubKeyPushTargetDataTypeBuilder { b.SecurityGroups = securityGroups return b @@ -380,8 +347,8 @@ func (b *_PubSubKeyPushTargetDataType) CreatePubSubKeyPushTargetDataTypeBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PubSubKeyPushTargetDataType) GetIdentifier() string { - return "25272" +func (m *_PubSubKeyPushTargetDataType) GetExtensionId() int32 { + return int32(25272) } /////////////////////// @@ -402,10 +369,6 @@ func (m *_PubSubKeyPushTargetDataType) GetApplicationUri() PascalString { return m.ApplicationUri } -func (m *_PubSubKeyPushTargetDataType) GetNoOfPushTargetFolder() int32 { - return m.NoOfPushTargetFolder -} - func (m *_PubSubKeyPushTargetDataType) GetPushTargetFolder() []PascalString { return m.PushTargetFolder } @@ -418,7 +381,7 @@ func (m *_PubSubKeyPushTargetDataType) GetSecurityPolicyUri() PascalString { return m.SecurityPolicyUri } -func (m *_PubSubKeyPushTargetDataType) GetUserTokenType() ExtensionObjectDefinition { +func (m *_PubSubKeyPushTargetDataType) GetUserTokenType() UserTokenPolicy { return m.UserTokenType } @@ -430,18 +393,10 @@ func (m *_PubSubKeyPushTargetDataType) GetRetryInterval() float64 { return m.RetryInterval } -func (m *_PubSubKeyPushTargetDataType) GetNoOfPushTargetProperties() int32 { - return m.NoOfPushTargetProperties -} - -func (m *_PubSubKeyPushTargetDataType) GetPushTargetProperties() []ExtensionObjectDefinition { +func (m *_PubSubKeyPushTargetDataType) GetPushTargetProperties() []KeyValuePair { return m.PushTargetProperties } -func (m *_PubSubKeyPushTargetDataType) GetNoOfSecurityGroups() int32 { - return m.NoOfSecurityGroups -} - func (m *_PubSubKeyPushTargetDataType) GetSecurityGroups() []PascalString { return m.SecurityGroups } @@ -472,7 +427,7 @@ func (m *_PubSubKeyPushTargetDataType) GetLengthInBits(ctx context.Context) uint // Simple field (applicationUri) lengthInBits += m.ApplicationUri.GetLengthInBits(ctx) - // Simple field (noOfPushTargetFolder) + // Implicit Field (noOfPushTargetFolder) lengthInBits += 32 // Array field @@ -500,7 +455,7 @@ func (m *_PubSubKeyPushTargetDataType) GetLengthInBits(ctx context.Context) uint // Simple field (retryInterval) lengthInBits += 64 - // Simple field (noOfPushTargetProperties) + // Implicit Field (noOfPushTargetProperties) lengthInBits += 32 // Array field @@ -513,7 +468,7 @@ func (m *_PubSubKeyPushTargetDataType) GetLengthInBits(ctx context.Context) uint } } - // Simple field (noOfSecurityGroups) + // Implicit Field (noOfSecurityGroups) lengthInBits += 32 // Array field @@ -533,7 +488,7 @@ func (m *_PubSubKeyPushTargetDataType) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_PubSubKeyPushTargetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__pubSubKeyPushTargetDataType PubSubKeyPushTargetDataType, err error) { +func (m *_PubSubKeyPushTargetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__pubSubKeyPushTargetDataType PubSubKeyPushTargetDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -550,11 +505,11 @@ func (m *_PubSubKeyPushTargetDataType) parse(ctx context.Context, readBuffer uti } m.ApplicationUri = applicationUri - noOfPushTargetFolder, err := ReadSimpleField(ctx, "noOfPushTargetFolder", ReadSignedInt(readBuffer, uint8(32))) + noOfPushTargetFolder, err := ReadImplicitField[int32](ctx, "noOfPushTargetFolder", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPushTargetFolder' field")) } - m.NoOfPushTargetFolder = noOfPushTargetFolder + _ = noOfPushTargetFolder pushTargetFolder, err := ReadCountArrayField[PascalString](ctx, "pushTargetFolder", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfPushTargetFolder)) if err != nil { @@ -574,7 +529,7 @@ func (m *_PubSubKeyPushTargetDataType) parse(ctx context.Context, readBuffer uti } m.SecurityPolicyUri = securityPolicyUri - userTokenType, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "userTokenType", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("306")), readBuffer)) + userTokenType, err := ReadSimpleField[UserTokenPolicy](ctx, "userTokenType", ReadComplex[UserTokenPolicy](ExtensionObjectDefinitionParseWithBufferProducer[UserTokenPolicy]((int32)(int32(306))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userTokenType' field")) } @@ -592,23 +547,23 @@ func (m *_PubSubKeyPushTargetDataType) parse(ctx context.Context, readBuffer uti } m.RetryInterval = retryInterval - noOfPushTargetProperties, err := ReadSimpleField(ctx, "noOfPushTargetProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfPushTargetProperties, err := ReadImplicitField[int32](ctx, "noOfPushTargetProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPushTargetProperties' field")) } - m.NoOfPushTargetProperties = noOfPushTargetProperties + _ = noOfPushTargetProperties - pushTargetProperties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "pushTargetProperties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfPushTargetProperties)) + pushTargetProperties, err := ReadCountArrayField[KeyValuePair](ctx, "pushTargetProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfPushTargetProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'pushTargetProperties' field")) } m.PushTargetProperties = pushTargetProperties - noOfSecurityGroups, err := ReadSimpleField(ctx, "noOfSecurityGroups", ReadSignedInt(readBuffer, uint8(32))) + noOfSecurityGroups, err := ReadImplicitField[int32](ctx, "noOfSecurityGroups", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityGroups' field")) } - m.NoOfSecurityGroups = noOfSecurityGroups + _ = noOfSecurityGroups securityGroups, err := ReadCountArrayField[PascalString](ctx, "securityGroups", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfSecurityGroups)) if err != nil { @@ -644,8 +599,8 @@ func (m *_PubSubKeyPushTargetDataType) SerializeWithWriteBuffer(ctx context.Cont if err := WriteSimpleField[PascalString](ctx, "applicationUri", m.GetApplicationUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'applicationUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfPushTargetFolder", m.GetNoOfPushTargetFolder(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfPushTargetFolder := int32(utils.InlineIf(bool((m.GetPushTargetFolder()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPushTargetFolder()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPushTargetFolder", noOfPushTargetFolder, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfPushTargetFolder' field") } @@ -661,7 +616,7 @@ func (m *_PubSubKeyPushTargetDataType) SerializeWithWriteBuffer(ctx context.Cont return errors.Wrap(err, "Error serializing 'securityPolicyUri' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "userTokenType", m.GetUserTokenType(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[UserTokenPolicy](ctx, "userTokenType", m.GetUserTokenType(), WriteComplex[UserTokenPolicy](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'userTokenType' field") } @@ -672,16 +627,16 @@ func (m *_PubSubKeyPushTargetDataType) SerializeWithWriteBuffer(ctx context.Cont if err := WriteSimpleField[float64](ctx, "retryInterval", m.GetRetryInterval(), WriteDouble(writeBuffer, 64)); err != nil { return errors.Wrap(err, "Error serializing 'retryInterval' field") } - - if err := WriteSimpleField[int32](ctx, "noOfPushTargetProperties", m.GetNoOfPushTargetProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfPushTargetProperties := int32(utils.InlineIf(bool((m.GetPushTargetProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPushTargetProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPushTargetProperties", noOfPushTargetProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfPushTargetProperties' field") } if err := WriteComplexTypeArrayField(ctx, "pushTargetProperties", m.GetPushTargetProperties(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'pushTargetProperties' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSecurityGroups", m.GetNoOfSecurityGroups(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSecurityGroups := int32(utils.InlineIf(bool((m.GetSecurityGroups()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityGroups()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityGroups", noOfSecurityGroups, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSecurityGroups' field") } @@ -710,16 +665,13 @@ func (m *_PubSubKeyPushTargetDataType) deepCopy() *_PubSubKeyPushTargetDataType _PubSubKeyPushTargetDataTypeCopy := &_PubSubKeyPushTargetDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.ApplicationUri.DeepCopy().(PascalString), - m.NoOfPushTargetFolder, utils.DeepCopySlice[PascalString, PascalString](m.PushTargetFolder), m.EndpointUrl.DeepCopy().(PascalString), m.SecurityPolicyUri.DeepCopy().(PascalString), - m.UserTokenType.DeepCopy().(ExtensionObjectDefinition), + m.UserTokenType.DeepCopy().(UserTokenPolicy), m.RequestedKeyCount, m.RetryInterval, - m.NoOfPushTargetProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.PushTargetProperties), - m.NoOfSecurityGroups, + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.PushTargetProperties), utils.DeepCopySlice[PascalString, PascalString](m.SecurityGroups), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/PublishRequest.go b/plc4go/protocols/opcua/readwrite/model/PublishRequest.go index 7a950475338..51dee1bd6ec 100644 --- a/plc4go/protocols/opcua/readwrite/model/PublishRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/PublishRequest.go @@ -41,11 +41,9 @@ type PublishRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfSubscriptionAcknowledgements returns NoOfSubscriptionAcknowledgements (property field) - GetNoOfSubscriptionAcknowledgements() int32 + GetRequestHeader() RequestHeader // GetSubscriptionAcknowledgements returns SubscriptionAcknowledgements (property field) - GetSubscriptionAcknowledgements() []ExtensionObjectDefinition + GetSubscriptionAcknowledgements() []SubscriptionAcknowledgement // IsPublishRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsPublishRequest() // CreateBuilder creates a PublishRequestBuilder @@ -55,23 +53,21 @@ type PublishRequest interface { // _PublishRequest is the data-structure of this message type _PublishRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfSubscriptionAcknowledgements int32 - SubscriptionAcknowledgements []ExtensionObjectDefinition + RequestHeader RequestHeader + SubscriptionAcknowledgements []SubscriptionAcknowledgement } var _ PublishRequest = (*_PublishRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PublishRequest)(nil) // NewPublishRequest factory function for _PublishRequest -func NewPublishRequest(requestHeader ExtensionObjectDefinition, noOfSubscriptionAcknowledgements int32, subscriptionAcknowledgements []ExtensionObjectDefinition) *_PublishRequest { +func NewPublishRequest(requestHeader RequestHeader, subscriptionAcknowledgements []SubscriptionAcknowledgement) *_PublishRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for PublishRequest must not be nil") + panic("requestHeader of type RequestHeader for PublishRequest must not be nil") } _result := &_PublishRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfSubscriptionAcknowledgements: noOfSubscriptionAcknowledgements, SubscriptionAcknowledgements: subscriptionAcknowledgements, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewPublishRequest(requestHeader ExtensionObjectDefinition, noOfSubscription type PublishRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionAcknowledgements int32, subscriptionAcknowledgements []ExtensionObjectDefinition) PublishRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionAcknowledgements []SubscriptionAcknowledgement) PublishRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) PublishRequestBuilder + WithRequestHeader(RequestHeader) PublishRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishRequestBuilder - // WithNoOfSubscriptionAcknowledgements adds NoOfSubscriptionAcknowledgements (property field) - WithNoOfSubscriptionAcknowledgements(int32) PublishRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) PublishRequestBuilder // WithSubscriptionAcknowledgements adds SubscriptionAcknowledgements (property field) - WithSubscriptionAcknowledgements(...ExtensionObjectDefinition) PublishRequestBuilder + WithSubscriptionAcknowledgements(...SubscriptionAcknowledgement) PublishRequestBuilder // Build builds the PublishRequest or returns an error if something is wrong Build() (PublishRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_PublishRequestBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_PublishRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionAcknowledgements int32, subscriptionAcknowledgements []ExtensionObjectDefinition) PublishRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfSubscriptionAcknowledgements(noOfSubscriptionAcknowledgements).WithSubscriptionAcknowledgements(subscriptionAcknowledgements...) +func (b *_PublishRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionAcknowledgements []SubscriptionAcknowledgement) PublishRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionAcknowledgements(subscriptionAcknowledgements...) } -func (b *_PublishRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) PublishRequestBuilder { +func (b *_PublishRequestBuilder) WithRequestHeader(requestHeader RequestHeader) PublishRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_PublishRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_PublishRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) PublishRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_PublishRequestBuilder) WithNoOfSubscriptionAcknowledgements(noOfSubscriptionAcknowledgements int32) PublishRequestBuilder { - b.NoOfSubscriptionAcknowledgements = noOfSubscriptionAcknowledgements - return b -} - -func (b *_PublishRequestBuilder) WithSubscriptionAcknowledgements(subscriptionAcknowledgements ...ExtensionObjectDefinition) PublishRequestBuilder { +func (b *_PublishRequestBuilder) WithSubscriptionAcknowledgements(subscriptionAcknowledgements ...SubscriptionAcknowledgement) PublishRequestBuilder { b.SubscriptionAcknowledgements = subscriptionAcknowledgements return b } @@ -209,8 +198,8 @@ func (b *_PublishRequest) CreatePublishRequestBuilder() PublishRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PublishRequest) GetIdentifier() string { - return "826" +func (m *_PublishRequest) GetExtensionId() int32 { + return int32(826) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_PublishRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_PublishRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_PublishRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_PublishRequest) GetNoOfSubscriptionAcknowledgements() int32 { - return m.NoOfSubscriptionAcknowledgements -} - -func (m *_PublishRequest) GetSubscriptionAcknowledgements() []ExtensionObjectDefinition { +func (m *_PublishRequest) GetSubscriptionAcknowledgements() []SubscriptionAcknowledgement { return m.SubscriptionAcknowledgements } @@ -265,7 +250,7 @@ func (m *_PublishRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfSubscriptionAcknowledgements) + // Implicit Field (noOfSubscriptionAcknowledgements) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_PublishRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_PublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__publishRequest PublishRequest, err error) { +func (m *_PublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishRequest PublishRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_PublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfSubscriptionAcknowledgements, err := ReadSimpleField(ctx, "noOfSubscriptionAcknowledgements", ReadSignedInt(readBuffer, uint8(32))) + noOfSubscriptionAcknowledgements, err := ReadImplicitField[int32](ctx, "noOfSubscriptionAcknowledgements", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSubscriptionAcknowledgements' field")) } - m.NoOfSubscriptionAcknowledgements = noOfSubscriptionAcknowledgements + _ = noOfSubscriptionAcknowledgements - subscriptionAcknowledgements, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "subscriptionAcknowledgements", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("823")), readBuffer), uint64(noOfSubscriptionAcknowledgements)) + subscriptionAcknowledgements, err := ReadCountArrayField[SubscriptionAcknowledgement](ctx, "subscriptionAcknowledgements", ReadComplex[SubscriptionAcknowledgement](ExtensionObjectDefinitionParseWithBufferProducer[SubscriptionAcknowledgement]((int32)(int32(823))), readBuffer), uint64(noOfSubscriptionAcknowledgements)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'subscriptionAcknowledgements' field")) } @@ -339,11 +324,11 @@ func (m *_PublishRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuf return errors.Wrap(pushErr, "Error pushing for PublishRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSubscriptionAcknowledgements", m.GetNoOfSubscriptionAcknowledgements(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSubscriptionAcknowledgements := int32(utils.InlineIf(bool((m.GetSubscriptionAcknowledgements()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSubscriptionAcknowledgements()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSubscriptionAcknowledgements", noOfSubscriptionAcknowledgements, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSubscriptionAcknowledgements' field") } @@ -371,9 +356,8 @@ func (m *_PublishRequest) deepCopy() *_PublishRequest { } _PublishRequestCopy := &_PublishRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfSubscriptionAcknowledgements, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.SubscriptionAcknowledgements), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[SubscriptionAcknowledgement, SubscriptionAcknowledgement](m.SubscriptionAcknowledgements), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _PublishRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/PublishResponse.go b/plc4go/protocols/opcua/readwrite/model/PublishResponse.go index 80a84a1690a..56163869037 100644 --- a/plc4go/protocols/opcua/readwrite/model/PublishResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/PublishResponse.go @@ -41,23 +41,17 @@ type PublishResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 - // GetNoOfAvailableSequenceNumbers returns NoOfAvailableSequenceNumbers (property field) - GetNoOfAvailableSequenceNumbers() int32 // GetAvailableSequenceNumbers returns AvailableSequenceNumbers (property field) GetAvailableSequenceNumbers() []uint32 // GetMoreNotifications returns MoreNotifications (property field) GetMoreNotifications() bool // GetNotificationMessage returns NotificationMessage (property field) - GetNotificationMessage() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetNotificationMessage() NotificationMessage // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsPublishResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -69,16 +63,13 @@ type PublishResponse interface { // _PublishResponse is the data-structure of this message type _PublishResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - SubscriptionId uint32 - NoOfAvailableSequenceNumbers int32 - AvailableSequenceNumbers []uint32 - MoreNotifications bool - NotificationMessage ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + SubscriptionId uint32 + AvailableSequenceNumbers []uint32 + MoreNotifications bool + NotificationMessage NotificationMessage + Results []StatusCode + DiagnosticInfos []DiagnosticInfo // Reserved Fields reservedField0 *uint8 } @@ -87,24 +78,21 @@ var _ PublishResponse = (*_PublishResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PublishResponse)(nil) // NewPublishResponse factory function for _PublishResponse -func NewPublishResponse(responseHeader ExtensionObjectDefinition, subscriptionId uint32, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_PublishResponse { +func NewPublishResponse(responseHeader ResponseHeader, subscriptionId uint32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage NotificationMessage, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_PublishResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for PublishResponse must not be nil") + panic("responseHeader of type ResponseHeader for PublishResponse must not be nil") } if notificationMessage == nil { - panic("notificationMessage of type ExtensionObjectDefinition for PublishResponse must not be nil") + panic("notificationMessage of type NotificationMessage for PublishResponse must not be nil") } _result := &_PublishResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, SubscriptionId: subscriptionId, - NoOfAvailableSequenceNumbers: noOfAvailableSequenceNumbers, AvailableSequenceNumbers: availableSequenceNumbers, MoreNotifications: moreNotifications, NotificationMessage: notificationMessage, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -120,29 +108,23 @@ func NewPublishResponse(responseHeader ExtensionObjectDefinition, subscriptionId type PublishResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, subscriptionId uint32, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) PublishResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, subscriptionId uint32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage NotificationMessage, results []StatusCode, diagnosticInfos []DiagnosticInfo) PublishResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) PublishResponseBuilder + WithResponseHeader(ResponseHeader) PublishResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) PublishResponseBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) PublishResponseBuilder - // WithNoOfAvailableSequenceNumbers adds NoOfAvailableSequenceNumbers (property field) - WithNoOfAvailableSequenceNumbers(int32) PublishResponseBuilder // WithAvailableSequenceNumbers adds AvailableSequenceNumbers (property field) WithAvailableSequenceNumbers(...uint32) PublishResponseBuilder // WithMoreNotifications adds MoreNotifications (property field) WithMoreNotifications(bool) PublishResponseBuilder // WithNotificationMessage adds NotificationMessage (property field) - WithNotificationMessage(ExtensionObjectDefinition) PublishResponseBuilder + WithNotificationMessage(NotificationMessage) PublishResponseBuilder // WithNotificationMessageBuilder adds NotificationMessage (property field) which is build by the builder - WithNotificationMessageBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) PublishResponseBuilder + WithNotificationMessageBuilder(func(NotificationMessageBuilder) NotificationMessageBuilder) PublishResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) PublishResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) PublishResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) PublishResponseBuilder // Build builds the PublishResponse or returns an error if something is wrong @@ -170,24 +152,24 @@ func (b *_PublishResponseBuilder) setParent(contract ExtensionObjectDefinitionCo b.ExtensionObjectDefinitionContract = contract } -func (b *_PublishResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, subscriptionId uint32, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) PublishResponseBuilder { - return b.WithResponseHeader(responseHeader).WithSubscriptionId(subscriptionId).WithNoOfAvailableSequenceNumbers(noOfAvailableSequenceNumbers).WithAvailableSequenceNumbers(availableSequenceNumbers...).WithMoreNotifications(moreNotifications).WithNotificationMessage(notificationMessage).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_PublishResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, subscriptionId uint32, availableSequenceNumbers []uint32, moreNotifications bool, notificationMessage NotificationMessage, results []StatusCode, diagnosticInfos []DiagnosticInfo) PublishResponseBuilder { + return b.WithResponseHeader(responseHeader).WithSubscriptionId(subscriptionId).WithAvailableSequenceNumbers(availableSequenceNumbers...).WithMoreNotifications(moreNotifications).WithNotificationMessage(notificationMessage).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_PublishResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) PublishResponseBuilder { +func (b *_PublishResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) PublishResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_PublishResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_PublishResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) PublishResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -197,11 +179,6 @@ func (b *_PublishResponseBuilder) WithSubscriptionId(subscriptionId uint32) Publ return b } -func (b *_PublishResponseBuilder) WithNoOfAvailableSequenceNumbers(noOfAvailableSequenceNumbers int32) PublishResponseBuilder { - b.NoOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers - return b -} - func (b *_PublishResponseBuilder) WithAvailableSequenceNumbers(availableSequenceNumbers ...uint32) PublishResponseBuilder { b.AvailableSequenceNumbers = availableSequenceNumbers return b @@ -212,39 +189,29 @@ func (b *_PublishResponseBuilder) WithMoreNotifications(moreNotifications bool) return b } -func (b *_PublishResponseBuilder) WithNotificationMessage(notificationMessage ExtensionObjectDefinition) PublishResponseBuilder { +func (b *_PublishResponseBuilder) WithNotificationMessage(notificationMessage NotificationMessage) PublishResponseBuilder { b.NotificationMessage = notificationMessage return b } -func (b *_PublishResponseBuilder) WithNotificationMessageBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) PublishResponseBuilder { - builder := builderSupplier(b.NotificationMessage.CreateExtensionObjectDefinitionBuilder()) +func (b *_PublishResponseBuilder) WithNotificationMessageBuilder(builderSupplier func(NotificationMessageBuilder) NotificationMessageBuilder) PublishResponseBuilder { + builder := builderSupplier(b.NotificationMessage.CreateNotificationMessageBuilder()) var err error b.NotificationMessage, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "NotificationMessageBuilder failed")) } return b } -func (b *_PublishResponseBuilder) WithNoOfResults(noOfResults int32) PublishResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_PublishResponseBuilder) WithResults(results ...StatusCode) PublishResponseBuilder { b.Results = results return b } -func (b *_PublishResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) PublishResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_PublishResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) PublishResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -312,8 +279,8 @@ func (b *_PublishResponse) CreatePublishResponseBuilder() PublishResponseBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PublishResponse) GetIdentifier() string { - return "829" +func (m *_PublishResponse) GetExtensionId() int32 { + return int32(829) } /////////////////////// @@ -330,7 +297,7 @@ func (m *_PublishResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_PublishResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_PublishResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -338,10 +305,6 @@ func (m *_PublishResponse) GetSubscriptionId() uint32 { return m.SubscriptionId } -func (m *_PublishResponse) GetNoOfAvailableSequenceNumbers() int32 { - return m.NoOfAvailableSequenceNumbers -} - func (m *_PublishResponse) GetAvailableSequenceNumbers() []uint32 { return m.AvailableSequenceNumbers } @@ -350,22 +313,14 @@ func (m *_PublishResponse) GetMoreNotifications() bool { return m.MoreNotifications } -func (m *_PublishResponse) GetNotificationMessage() ExtensionObjectDefinition { +func (m *_PublishResponse) GetNotificationMessage() NotificationMessage { return m.NotificationMessage } -func (m *_PublishResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_PublishResponse) GetResults() []StatusCode { return m.Results } -func (m *_PublishResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_PublishResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -399,7 +354,7 @@ func (m *_PublishResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (subscriptionId) lengthInBits += 32 - // Simple field (noOfAvailableSequenceNumbers) + // Implicit Field (noOfAvailableSequenceNumbers) lengthInBits += 32 // Array field @@ -416,7 +371,7 @@ func (m *_PublishResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (notificationMessage) lengthInBits += m.NotificationMessage.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -429,7 +384,7 @@ func (m *_PublishResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -449,7 +404,7 @@ func (m *_PublishResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__publishResponse PublishResponse, err error) { +func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishResponse PublishResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -460,7 +415,7 @@ func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffe currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -472,11 +427,11 @@ func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.SubscriptionId = subscriptionId - noOfAvailableSequenceNumbers, err := ReadSimpleField(ctx, "noOfAvailableSequenceNumbers", ReadSignedInt(readBuffer, uint8(32))) + noOfAvailableSequenceNumbers, err := ReadImplicitField[int32](ctx, "noOfAvailableSequenceNumbers", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAvailableSequenceNumbers' field")) } - m.NoOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers + _ = noOfAvailableSequenceNumbers availableSequenceNumbers, err := ReadCountArrayField[uint32](ctx, "availableSequenceNumbers", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfAvailableSequenceNumbers)) if err != nil { @@ -496,17 +451,17 @@ func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.MoreNotifications = moreNotifications - notificationMessage, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "notificationMessage", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("805")), readBuffer)) + notificationMessage, err := ReadSimpleField[NotificationMessage](ctx, "notificationMessage", ReadComplex[NotificationMessage](ExtensionObjectDefinitionParseWithBufferProducer[NotificationMessage]((int32)(int32(805))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationMessage' field")) } m.NotificationMessage = notificationMessage - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -514,11 +469,11 @@ func (m *_PublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -551,15 +506,15 @@ func (m *_PublishResponse) SerializeWithWriteBuffer(ctx context.Context, writeBu return errors.Wrap(pushErr, "Error pushing for PublishResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } if err := WriteSimpleField[uint32](ctx, "subscriptionId", m.GetSubscriptionId(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'subscriptionId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfAvailableSequenceNumbers", m.GetNoOfAvailableSequenceNumbers(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfAvailableSequenceNumbers := int32(utils.InlineIf(bool((m.GetAvailableSequenceNumbers()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAvailableSequenceNumbers()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAvailableSequenceNumbers", noOfAvailableSequenceNumbers, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfAvailableSequenceNumbers' field") } @@ -575,19 +530,19 @@ func (m *_PublishResponse) SerializeWithWriteBuffer(ctx context.Context, writeBu return errors.Wrap(err, "Error serializing 'moreNotifications' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "notificationMessage", m.GetNotificationMessage(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[NotificationMessage](ctx, "notificationMessage", m.GetNotificationMessage(), WriteComplex[NotificationMessage](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'notificationMessage' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -615,15 +570,12 @@ func (m *_PublishResponse) deepCopy() *_PublishResponse { } _PublishResponseCopy := &_PublishResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), m.SubscriptionId, - m.NoOfAvailableSequenceNumbers, utils.DeepCopySlice[uint32, uint32](m.AvailableSequenceNumbers), m.MoreNotifications, - m.NotificationMessage.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.NotificationMessage.DeepCopy().(NotificationMessage), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedDataItemsDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedDataItemsDataType.go new file mode 100644 index 00000000000..dfb70676f55 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PublishedDataItemsDataType.go @@ -0,0 +1,326 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PublishedDataItemsDataType is the corresponding interface of PublishedDataItemsDataType +type PublishedDataItemsDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetPublishedData returns PublishedData (property field) + GetPublishedData() []PublishedVariableDataType + // IsPublishedDataItemsDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPublishedDataItemsDataType() + // CreateBuilder creates a PublishedDataItemsDataTypeBuilder + CreatePublishedDataItemsDataTypeBuilder() PublishedDataItemsDataTypeBuilder +} + +// _PublishedDataItemsDataType is the data-structure of this message +type _PublishedDataItemsDataType struct { + ExtensionObjectDefinitionContract + PublishedData []PublishedVariableDataType +} + +var _ PublishedDataItemsDataType = (*_PublishedDataItemsDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PublishedDataItemsDataType)(nil) + +// NewPublishedDataItemsDataType factory function for _PublishedDataItemsDataType +func NewPublishedDataItemsDataType(publishedData []PublishedVariableDataType) *_PublishedDataItemsDataType { + _result := &_PublishedDataItemsDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PublishedData: publishedData, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PublishedDataItemsDataTypeBuilder is a builder for PublishedDataItemsDataType +type PublishedDataItemsDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(publishedData []PublishedVariableDataType) PublishedDataItemsDataTypeBuilder + // WithPublishedData adds PublishedData (property field) + WithPublishedData(...PublishedVariableDataType) PublishedDataItemsDataTypeBuilder + // Build builds the PublishedDataItemsDataType or returns an error if something is wrong + Build() (PublishedDataItemsDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PublishedDataItemsDataType +} + +// NewPublishedDataItemsDataTypeBuilder() creates a PublishedDataItemsDataTypeBuilder +func NewPublishedDataItemsDataTypeBuilder() PublishedDataItemsDataTypeBuilder { + return &_PublishedDataItemsDataTypeBuilder{_PublishedDataItemsDataType: new(_PublishedDataItemsDataType)} +} + +type _PublishedDataItemsDataTypeBuilder struct { + *_PublishedDataItemsDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PublishedDataItemsDataTypeBuilder) = (*_PublishedDataItemsDataTypeBuilder)(nil) + +func (b *_PublishedDataItemsDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PublishedDataItemsDataTypeBuilder) WithMandatoryFields(publishedData []PublishedVariableDataType) PublishedDataItemsDataTypeBuilder { + return b.WithPublishedData(publishedData...) +} + +func (b *_PublishedDataItemsDataTypeBuilder) WithPublishedData(publishedData ...PublishedVariableDataType) PublishedDataItemsDataTypeBuilder { + b.PublishedData = publishedData + return b +} + +func (b *_PublishedDataItemsDataTypeBuilder) Build() (PublishedDataItemsDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PublishedDataItemsDataType.deepCopy(), nil +} + +func (b *_PublishedDataItemsDataTypeBuilder) MustBuild() PublishedDataItemsDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PublishedDataItemsDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PublishedDataItemsDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PublishedDataItemsDataTypeBuilder) DeepCopy() any { + _copy := b.CreatePublishedDataItemsDataTypeBuilder().(*_PublishedDataItemsDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePublishedDataItemsDataTypeBuilder creates a PublishedDataItemsDataTypeBuilder +func (b *_PublishedDataItemsDataType) CreatePublishedDataItemsDataTypeBuilder() PublishedDataItemsDataTypeBuilder { + if b == nil { + return NewPublishedDataItemsDataTypeBuilder() + } + return &_PublishedDataItemsDataTypeBuilder{_PublishedDataItemsDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PublishedDataItemsDataType) GetExtensionId() int32 { + return int32(15583) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PublishedDataItemsDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PublishedDataItemsDataType) GetPublishedData() []PublishedVariableDataType { + return m.PublishedData +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPublishedDataItemsDataType(structType any) PublishedDataItemsDataType { + if casted, ok := structType.(PublishedDataItemsDataType); ok { + return casted + } + if casted, ok := structType.(*PublishedDataItemsDataType); ok { + return *casted + } + return nil +} + +func (m *_PublishedDataItemsDataType) GetTypeName() string { + return "PublishedDataItemsDataType" +} + +func (m *_PublishedDataItemsDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfPublishedData) + lengthInBits += 32 + + // Array field + if len(m.PublishedData) > 0 { + for _curItem, element := range m.PublishedData { + arrayCtx := utils.CreateArrayContext(ctx, len(m.PublishedData), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_PublishedDataItemsDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PublishedDataItemsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedDataItemsDataType PublishedDataItemsDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PublishedDataItemsDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PublishedDataItemsDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfPublishedData, err := ReadImplicitField[int32](ctx, "noOfPublishedData", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPublishedData' field")) + } + _ = noOfPublishedData + + publishedData, err := ReadCountArrayField[PublishedVariableDataType](ctx, "publishedData", ReadComplex[PublishedVariableDataType](ExtensionObjectDefinitionParseWithBufferProducer[PublishedVariableDataType]((int32)(int32(14275))), readBuffer), uint64(noOfPublishedData)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishedData' field")) + } + m.PublishedData = publishedData + + if closeErr := readBuffer.CloseContext("PublishedDataItemsDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PublishedDataItemsDataType") + } + + return m, nil +} + +func (m *_PublishedDataItemsDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PublishedDataItemsDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PublishedDataItemsDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PublishedDataItemsDataType") + } + noOfPublishedData := int32(utils.InlineIf(bool((m.GetPublishedData()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPublishedData()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPublishedData", noOfPublishedData, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfPublishedData' field") + } + + if err := WriteComplexTypeArrayField(ctx, "publishedData", m.GetPublishedData(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'publishedData' field") + } + + if popErr := writeBuffer.PopContext("PublishedDataItemsDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PublishedDataItemsDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PublishedDataItemsDataType) IsPublishedDataItemsDataType() {} + +func (m *_PublishedDataItemsDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PublishedDataItemsDataType) deepCopy() *_PublishedDataItemsDataType { + if m == nil { + return nil + } + _PublishedDataItemsDataTypeCopy := &_PublishedDataItemsDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[PublishedVariableDataType, PublishedVariableDataType](m.PublishedData), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PublishedDataItemsDataTypeCopy +} + +func (m *_PublishedDataItemsDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedDataSetCustomSourceDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetCustomSourceDataType.go new file mode 100644 index 00000000000..526ab535c53 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetCustomSourceDataType.go @@ -0,0 +1,322 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PublishedDataSetCustomSourceDataType is the corresponding interface of PublishedDataSetCustomSourceDataType +type PublishedDataSetCustomSourceDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetCyclicDataSet returns CyclicDataSet (property field) + GetCyclicDataSet() bool + // IsPublishedDataSetCustomSourceDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPublishedDataSetCustomSourceDataType() + // CreateBuilder creates a PublishedDataSetCustomSourceDataTypeBuilder + CreatePublishedDataSetCustomSourceDataTypeBuilder() PublishedDataSetCustomSourceDataTypeBuilder +} + +// _PublishedDataSetCustomSourceDataType is the data-structure of this message +type _PublishedDataSetCustomSourceDataType struct { + ExtensionObjectDefinitionContract + CyclicDataSet bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ PublishedDataSetCustomSourceDataType = (*_PublishedDataSetCustomSourceDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PublishedDataSetCustomSourceDataType)(nil) + +// NewPublishedDataSetCustomSourceDataType factory function for _PublishedDataSetCustomSourceDataType +func NewPublishedDataSetCustomSourceDataType(cyclicDataSet bool) *_PublishedDataSetCustomSourceDataType { + _result := &_PublishedDataSetCustomSourceDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + CyclicDataSet: cyclicDataSet, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PublishedDataSetCustomSourceDataTypeBuilder is a builder for PublishedDataSetCustomSourceDataType +type PublishedDataSetCustomSourceDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(cyclicDataSet bool) PublishedDataSetCustomSourceDataTypeBuilder + // WithCyclicDataSet adds CyclicDataSet (property field) + WithCyclicDataSet(bool) PublishedDataSetCustomSourceDataTypeBuilder + // Build builds the PublishedDataSetCustomSourceDataType or returns an error if something is wrong + Build() (PublishedDataSetCustomSourceDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PublishedDataSetCustomSourceDataType +} + +// NewPublishedDataSetCustomSourceDataTypeBuilder() creates a PublishedDataSetCustomSourceDataTypeBuilder +func NewPublishedDataSetCustomSourceDataTypeBuilder() PublishedDataSetCustomSourceDataTypeBuilder { + return &_PublishedDataSetCustomSourceDataTypeBuilder{_PublishedDataSetCustomSourceDataType: new(_PublishedDataSetCustomSourceDataType)} +} + +type _PublishedDataSetCustomSourceDataTypeBuilder struct { + *_PublishedDataSetCustomSourceDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PublishedDataSetCustomSourceDataTypeBuilder) = (*_PublishedDataSetCustomSourceDataTypeBuilder)(nil) + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) WithMandatoryFields(cyclicDataSet bool) PublishedDataSetCustomSourceDataTypeBuilder { + return b.WithCyclicDataSet(cyclicDataSet) +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) WithCyclicDataSet(cyclicDataSet bool) PublishedDataSetCustomSourceDataTypeBuilder { + b.CyclicDataSet = cyclicDataSet + return b +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) Build() (PublishedDataSetCustomSourceDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PublishedDataSetCustomSourceDataType.deepCopy(), nil +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) MustBuild() PublishedDataSetCustomSourceDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PublishedDataSetCustomSourceDataTypeBuilder) DeepCopy() any { + _copy := b.CreatePublishedDataSetCustomSourceDataTypeBuilder().(*_PublishedDataSetCustomSourceDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePublishedDataSetCustomSourceDataTypeBuilder creates a PublishedDataSetCustomSourceDataTypeBuilder +func (b *_PublishedDataSetCustomSourceDataType) CreatePublishedDataSetCustomSourceDataTypeBuilder() PublishedDataSetCustomSourceDataTypeBuilder { + if b == nil { + return NewPublishedDataSetCustomSourceDataTypeBuilder() + } + return &_PublishedDataSetCustomSourceDataTypeBuilder{_PublishedDataSetCustomSourceDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PublishedDataSetCustomSourceDataType) GetExtensionId() int32 { + return int32(25271) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PublishedDataSetCustomSourceDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PublishedDataSetCustomSourceDataType) GetCyclicDataSet() bool { + return m.CyclicDataSet +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPublishedDataSetCustomSourceDataType(structType any) PublishedDataSetCustomSourceDataType { + if casted, ok := structType.(PublishedDataSetCustomSourceDataType); ok { + return casted + } + if casted, ok := structType.(*PublishedDataSetCustomSourceDataType); ok { + return *casted + } + return nil +} + +func (m *_PublishedDataSetCustomSourceDataType) GetTypeName() string { + return "PublishedDataSetCustomSourceDataType" +} + +func (m *_PublishedDataSetCustomSourceDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (cyclicDataSet) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_PublishedDataSetCustomSourceDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PublishedDataSetCustomSourceDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedDataSetCustomSourceDataType PublishedDataSetCustomSourceDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PublishedDataSetCustomSourceDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PublishedDataSetCustomSourceDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + cyclicDataSet, err := ReadSimpleField(ctx, "cyclicDataSet", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'cyclicDataSet' field")) + } + m.CyclicDataSet = cyclicDataSet + + if closeErr := readBuffer.CloseContext("PublishedDataSetCustomSourceDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PublishedDataSetCustomSourceDataType") + } + + return m, nil +} + +func (m *_PublishedDataSetCustomSourceDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PublishedDataSetCustomSourceDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PublishedDataSetCustomSourceDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PublishedDataSetCustomSourceDataType") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "cyclicDataSet", m.GetCyclicDataSet(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'cyclicDataSet' field") + } + + if popErr := writeBuffer.PopContext("PublishedDataSetCustomSourceDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PublishedDataSetCustomSourceDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PublishedDataSetCustomSourceDataType) IsPublishedDataSetCustomSourceDataType() {} + +func (m *_PublishedDataSetCustomSourceDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PublishedDataSetCustomSourceDataType) deepCopy() *_PublishedDataSetCustomSourceDataType { + if m == nil { + return nil + } + _PublishedDataSetCustomSourceDataTypeCopy := &_PublishedDataSetCustomSourceDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.CyclicDataSet, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PublishedDataSetCustomSourceDataTypeCopy +} + +func (m *_PublishedDataSetCustomSourceDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedDataSetDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetDataType.go new file mode 100644 index 00000000000..dbb1be44da0 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetDataType.go @@ -0,0 +1,534 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PublishedDataSetDataType is the corresponding interface of PublishedDataSetDataType +type PublishedDataSetDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetName returns Name (property field) + GetName() PascalString + // GetDataSetFolder returns DataSetFolder (property field) + GetDataSetFolder() []PascalString + // GetDataSetMetaData returns DataSetMetaData (property field) + GetDataSetMetaData() DataSetMetaDataType + // GetExtensionFields returns ExtensionFields (property field) + GetExtensionFields() []KeyValuePair + // GetDataSetSource returns DataSetSource (property field) + GetDataSetSource() ExtensionObject + // IsPublishedDataSetDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPublishedDataSetDataType() + // CreateBuilder creates a PublishedDataSetDataTypeBuilder + CreatePublishedDataSetDataTypeBuilder() PublishedDataSetDataTypeBuilder +} + +// _PublishedDataSetDataType is the data-structure of this message +type _PublishedDataSetDataType struct { + ExtensionObjectDefinitionContract + Name PascalString + DataSetFolder []PascalString + DataSetMetaData DataSetMetaDataType + ExtensionFields []KeyValuePair + DataSetSource ExtensionObject +} + +var _ PublishedDataSetDataType = (*_PublishedDataSetDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PublishedDataSetDataType)(nil) + +// NewPublishedDataSetDataType factory function for _PublishedDataSetDataType +func NewPublishedDataSetDataType(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, extensionFields []KeyValuePair, dataSetSource ExtensionObject) *_PublishedDataSetDataType { + if name == nil { + panic("name of type PascalString for PublishedDataSetDataType must not be nil") + } + if dataSetMetaData == nil { + panic("dataSetMetaData of type DataSetMetaDataType for PublishedDataSetDataType must not be nil") + } + if dataSetSource == nil { + panic("dataSetSource of type ExtensionObject for PublishedDataSetDataType must not be nil") + } + _result := &_PublishedDataSetDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Name: name, + DataSetFolder: dataSetFolder, + DataSetMetaData: dataSetMetaData, + ExtensionFields: extensionFields, + DataSetSource: dataSetSource, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PublishedDataSetDataTypeBuilder is a builder for PublishedDataSetDataType +type PublishedDataSetDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, extensionFields []KeyValuePair, dataSetSource ExtensionObject) PublishedDataSetDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) PublishedDataSetDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) PublishedDataSetDataTypeBuilder + // WithDataSetFolder adds DataSetFolder (property field) + WithDataSetFolder(...PascalString) PublishedDataSetDataTypeBuilder + // WithDataSetMetaData adds DataSetMetaData (property field) + WithDataSetMetaData(DataSetMetaDataType) PublishedDataSetDataTypeBuilder + // WithDataSetMetaDataBuilder adds DataSetMetaData (property field) which is build by the builder + WithDataSetMetaDataBuilder(func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) PublishedDataSetDataTypeBuilder + // WithExtensionFields adds ExtensionFields (property field) + WithExtensionFields(...KeyValuePair) PublishedDataSetDataTypeBuilder + // WithDataSetSource adds DataSetSource (property field) + WithDataSetSource(ExtensionObject) PublishedDataSetDataTypeBuilder + // WithDataSetSourceBuilder adds DataSetSource (property field) which is build by the builder + WithDataSetSourceBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) PublishedDataSetDataTypeBuilder + // Build builds the PublishedDataSetDataType or returns an error if something is wrong + Build() (PublishedDataSetDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PublishedDataSetDataType +} + +// NewPublishedDataSetDataTypeBuilder() creates a PublishedDataSetDataTypeBuilder +func NewPublishedDataSetDataTypeBuilder() PublishedDataSetDataTypeBuilder { + return &_PublishedDataSetDataTypeBuilder{_PublishedDataSetDataType: new(_PublishedDataSetDataType)} +} + +type _PublishedDataSetDataTypeBuilder struct { + *_PublishedDataSetDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PublishedDataSetDataTypeBuilder) = (*_PublishedDataSetDataTypeBuilder)(nil) + +func (b *_PublishedDataSetDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PublishedDataSetDataTypeBuilder) WithMandatoryFields(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, extensionFields []KeyValuePair, dataSetSource ExtensionObject) PublishedDataSetDataTypeBuilder { + return b.WithName(name).WithDataSetFolder(dataSetFolder...).WithDataSetMetaData(dataSetMetaData).WithExtensionFields(extensionFields...).WithDataSetSource(dataSetSource) +} + +func (b *_PublishedDataSetDataTypeBuilder) WithName(name PascalString) PublishedDataSetDataTypeBuilder { + b.Name = name + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) PublishedDataSetDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithDataSetFolder(dataSetFolder ...PascalString) PublishedDataSetDataTypeBuilder { + b.DataSetFolder = dataSetFolder + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithDataSetMetaData(dataSetMetaData DataSetMetaDataType) PublishedDataSetDataTypeBuilder { + b.DataSetMetaData = dataSetMetaData + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithDataSetMetaDataBuilder(builderSupplier func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) PublishedDataSetDataTypeBuilder { + builder := builderSupplier(b.DataSetMetaData.CreateDataSetMetaDataTypeBuilder()) + var err error + b.DataSetMetaData, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "DataSetMetaDataTypeBuilder failed")) + } + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithExtensionFields(extensionFields ...KeyValuePair) PublishedDataSetDataTypeBuilder { + b.ExtensionFields = extensionFields + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithDataSetSource(dataSetSource ExtensionObject) PublishedDataSetDataTypeBuilder { + b.DataSetSource = dataSetSource + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) WithDataSetSourceBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) PublishedDataSetDataTypeBuilder { + builder := builderSupplier(b.DataSetSource.CreateExtensionObjectBuilder()) + var err error + b.DataSetSource, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_PublishedDataSetDataTypeBuilder) Build() (PublishedDataSetDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.DataSetMetaData == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetMetaData' not set")) + } + if b.DataSetSource == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetSource' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PublishedDataSetDataType.deepCopy(), nil +} + +func (b *_PublishedDataSetDataTypeBuilder) MustBuild() PublishedDataSetDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PublishedDataSetDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PublishedDataSetDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PublishedDataSetDataTypeBuilder) DeepCopy() any { + _copy := b.CreatePublishedDataSetDataTypeBuilder().(*_PublishedDataSetDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePublishedDataSetDataTypeBuilder creates a PublishedDataSetDataTypeBuilder +func (b *_PublishedDataSetDataType) CreatePublishedDataSetDataTypeBuilder() PublishedDataSetDataTypeBuilder { + if b == nil { + return NewPublishedDataSetDataTypeBuilder() + } + return &_PublishedDataSetDataTypeBuilder{_PublishedDataSetDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PublishedDataSetDataType) GetExtensionId() int32 { + return int32(15580) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PublishedDataSetDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PublishedDataSetDataType) GetName() PascalString { + return m.Name +} + +func (m *_PublishedDataSetDataType) GetDataSetFolder() []PascalString { + return m.DataSetFolder +} + +func (m *_PublishedDataSetDataType) GetDataSetMetaData() DataSetMetaDataType { + return m.DataSetMetaData +} + +func (m *_PublishedDataSetDataType) GetExtensionFields() []KeyValuePair { + return m.ExtensionFields +} + +func (m *_PublishedDataSetDataType) GetDataSetSource() ExtensionObject { + return m.DataSetSource +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPublishedDataSetDataType(structType any) PublishedDataSetDataType { + if casted, ok := structType.(PublishedDataSetDataType); ok { + return casted + } + if casted, ok := structType.(*PublishedDataSetDataType); ok { + return *casted + } + return nil +} + +func (m *_PublishedDataSetDataType) GetTypeName() string { + return "PublishedDataSetDataType" +} + +func (m *_PublishedDataSetDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Implicit Field (noOfDataSetFolder) + lengthInBits += 32 + + // Array field + if len(m.DataSetFolder) > 0 { + for _curItem, element := range m.DataSetFolder { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetFolder), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (dataSetMetaData) + lengthInBits += m.DataSetMetaData.GetLengthInBits(ctx) + + // Implicit Field (noOfExtensionFields) + lengthInBits += 32 + + // Array field + if len(m.ExtensionFields) > 0 { + for _curItem, element := range m.ExtensionFields { + arrayCtx := utils.CreateArrayContext(ctx, len(m.ExtensionFields), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (dataSetSource) + lengthInBits += m.DataSetSource.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_PublishedDataSetDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PublishedDataSetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedDataSetDataType PublishedDataSetDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PublishedDataSetDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PublishedDataSetDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + noOfDataSetFolder, err := ReadImplicitField[int32](ctx, "noOfDataSetFolder", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetFolder' field")) + } + _ = noOfDataSetFolder + + dataSetFolder, err := ReadCountArrayField[PascalString](ctx, "dataSetFolder", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfDataSetFolder)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetFolder' field")) + } + m.DataSetFolder = dataSetFolder + + dataSetMetaData, err := ReadSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", ReadComplex[DataSetMetaDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetMetaDataType]((int32)(int32(14525))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMetaData' field")) + } + m.DataSetMetaData = dataSetMetaData + + noOfExtensionFields, err := ReadImplicitField[int32](ctx, "noOfExtensionFields", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfExtensionFields' field")) + } + _ = noOfExtensionFields + + extensionFields, err := ReadCountArrayField[KeyValuePair](ctx, "extensionFields", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfExtensionFields)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'extensionFields' field")) + } + m.ExtensionFields = extensionFields + + dataSetSource, err := ReadSimpleField[ExtensionObject](ctx, "dataSetSource", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetSource' field")) + } + m.DataSetSource = dataSetSource + + if closeErr := readBuffer.CloseContext("PublishedDataSetDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PublishedDataSetDataType") + } + + return m, nil +} + +func (m *_PublishedDataSetDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PublishedDataSetDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PublishedDataSetDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PublishedDataSetDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + noOfDataSetFolder := int32(utils.InlineIf(bool((m.GetDataSetFolder()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetFolder()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetFolder", noOfDataSetFolder, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetFolder' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetFolder", m.GetDataSetFolder(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetFolder' field") + } + + if err := WriteSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", m.GetDataSetMetaData(), WriteComplex[DataSetMetaDataType](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMetaData' field") + } + noOfExtensionFields := int32(utils.InlineIf(bool((m.GetExtensionFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetExtensionFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfExtensionFields", noOfExtensionFields, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfExtensionFields' field") + } + + if err := WriteComplexTypeArrayField(ctx, "extensionFields", m.GetExtensionFields(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'extensionFields' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "dataSetSource", m.GetDataSetSource(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetSource' field") + } + + if popErr := writeBuffer.PopContext("PublishedDataSetDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PublishedDataSetDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PublishedDataSetDataType) IsPublishedDataSetDataType() {} + +func (m *_PublishedDataSetDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PublishedDataSetDataType) deepCopy() *_PublishedDataSetDataType { + if m == nil { + return nil + } + _PublishedDataSetDataTypeCopy := &_PublishedDataSetDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Name.DeepCopy().(PascalString), + utils.DeepCopySlice[PascalString, PascalString](m.DataSetFolder), + m.DataSetMetaData.DeepCopy().(DataSetMetaDataType), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.ExtensionFields), + m.DataSetSource.DeepCopy().(ExtensionObject), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PublishedDataSetDataTypeCopy +} + +func (m *_PublishedDataSetDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedDataSetSourceDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetSourceDataType.go index 5a2b0f7aa16..5cf898320c6 100644 --- a/plc4go/protocols/opcua/readwrite/model/PublishedDataSetSourceDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PublishedDataSetSourceDataType.go @@ -150,8 +150,8 @@ func (b *_PublishedDataSetSourceDataType) CreatePublishedDataSetSourceDataTypeBu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PublishedDataSetSourceDataType) GetIdentifier() string { - return "15582" +func (m *_PublishedDataSetSourceDataType) GetExtensionId() int32 { + return int32(15582) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_PublishedDataSetSourceDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_PublishedDataSetSourceDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__publishedDataSetSourceDataType PublishedDataSetSourceDataType, err error) { +func (m *_PublishedDataSetSourceDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedDataSetSourceDataType PublishedDataSetSourceDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedEventsDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedEventsDataType.go new file mode 100644 index 00000000000..e8cba7b4aad --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/PublishedEventsDataType.go @@ -0,0 +1,432 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// PublishedEventsDataType is the corresponding interface of PublishedEventsDataType +type PublishedEventsDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetEventNotifier returns EventNotifier (property field) + GetEventNotifier() NodeId + // GetSelectedFields returns SelectedFields (property field) + GetSelectedFields() []SimpleAttributeOperand + // GetFilter returns Filter (property field) + GetFilter() ContentFilter + // IsPublishedEventsDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsPublishedEventsDataType() + // CreateBuilder creates a PublishedEventsDataTypeBuilder + CreatePublishedEventsDataTypeBuilder() PublishedEventsDataTypeBuilder +} + +// _PublishedEventsDataType is the data-structure of this message +type _PublishedEventsDataType struct { + ExtensionObjectDefinitionContract + EventNotifier NodeId + SelectedFields []SimpleAttributeOperand + Filter ContentFilter +} + +var _ PublishedEventsDataType = (*_PublishedEventsDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_PublishedEventsDataType)(nil) + +// NewPublishedEventsDataType factory function for _PublishedEventsDataType +func NewPublishedEventsDataType(eventNotifier NodeId, selectedFields []SimpleAttributeOperand, filter ContentFilter) *_PublishedEventsDataType { + if eventNotifier == nil { + panic("eventNotifier of type NodeId for PublishedEventsDataType must not be nil") + } + if filter == nil { + panic("filter of type ContentFilter for PublishedEventsDataType must not be nil") + } + _result := &_PublishedEventsDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + EventNotifier: eventNotifier, + SelectedFields: selectedFields, + Filter: filter, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// PublishedEventsDataTypeBuilder is a builder for PublishedEventsDataType +type PublishedEventsDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(eventNotifier NodeId, selectedFields []SimpleAttributeOperand, filter ContentFilter) PublishedEventsDataTypeBuilder + // WithEventNotifier adds EventNotifier (property field) + WithEventNotifier(NodeId) PublishedEventsDataTypeBuilder + // WithEventNotifierBuilder adds EventNotifier (property field) which is build by the builder + WithEventNotifierBuilder(func(NodeIdBuilder) NodeIdBuilder) PublishedEventsDataTypeBuilder + // WithSelectedFields adds SelectedFields (property field) + WithSelectedFields(...SimpleAttributeOperand) PublishedEventsDataTypeBuilder + // WithFilter adds Filter (property field) + WithFilter(ContentFilter) PublishedEventsDataTypeBuilder + // WithFilterBuilder adds Filter (property field) which is build by the builder + WithFilterBuilder(func(ContentFilterBuilder) ContentFilterBuilder) PublishedEventsDataTypeBuilder + // Build builds the PublishedEventsDataType or returns an error if something is wrong + Build() (PublishedEventsDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() PublishedEventsDataType +} + +// NewPublishedEventsDataTypeBuilder() creates a PublishedEventsDataTypeBuilder +func NewPublishedEventsDataTypeBuilder() PublishedEventsDataTypeBuilder { + return &_PublishedEventsDataTypeBuilder{_PublishedEventsDataType: new(_PublishedEventsDataType)} +} + +type _PublishedEventsDataTypeBuilder struct { + *_PublishedEventsDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (PublishedEventsDataTypeBuilder) = (*_PublishedEventsDataTypeBuilder)(nil) + +func (b *_PublishedEventsDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_PublishedEventsDataTypeBuilder) WithMandatoryFields(eventNotifier NodeId, selectedFields []SimpleAttributeOperand, filter ContentFilter) PublishedEventsDataTypeBuilder { + return b.WithEventNotifier(eventNotifier).WithSelectedFields(selectedFields...).WithFilter(filter) +} + +func (b *_PublishedEventsDataTypeBuilder) WithEventNotifier(eventNotifier NodeId) PublishedEventsDataTypeBuilder { + b.EventNotifier = eventNotifier + return b +} + +func (b *_PublishedEventsDataTypeBuilder) WithEventNotifierBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) PublishedEventsDataTypeBuilder { + builder := builderSupplier(b.EventNotifier.CreateNodeIdBuilder()) + var err error + b.EventNotifier, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_PublishedEventsDataTypeBuilder) WithSelectedFields(selectedFields ...SimpleAttributeOperand) PublishedEventsDataTypeBuilder { + b.SelectedFields = selectedFields + return b +} + +func (b *_PublishedEventsDataTypeBuilder) WithFilter(filter ContentFilter) PublishedEventsDataTypeBuilder { + b.Filter = filter + return b +} + +func (b *_PublishedEventsDataTypeBuilder) WithFilterBuilder(builderSupplier func(ContentFilterBuilder) ContentFilterBuilder) PublishedEventsDataTypeBuilder { + builder := builderSupplier(b.Filter.CreateContentFilterBuilder()) + var err error + b.Filter, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ContentFilterBuilder failed")) + } + return b +} + +func (b *_PublishedEventsDataTypeBuilder) Build() (PublishedEventsDataType, error) { + if b.EventNotifier == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'eventNotifier' not set")) + } + if b.Filter == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'filter' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._PublishedEventsDataType.deepCopy(), nil +} + +func (b *_PublishedEventsDataTypeBuilder) MustBuild() PublishedEventsDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_PublishedEventsDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_PublishedEventsDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_PublishedEventsDataTypeBuilder) DeepCopy() any { + _copy := b.CreatePublishedEventsDataTypeBuilder().(*_PublishedEventsDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreatePublishedEventsDataTypeBuilder creates a PublishedEventsDataTypeBuilder +func (b *_PublishedEventsDataType) CreatePublishedEventsDataTypeBuilder() PublishedEventsDataTypeBuilder { + if b == nil { + return NewPublishedEventsDataTypeBuilder() + } + return &_PublishedEventsDataTypeBuilder{_PublishedEventsDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_PublishedEventsDataType) GetExtensionId() int32 { + return int32(15584) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_PublishedEventsDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_PublishedEventsDataType) GetEventNotifier() NodeId { + return m.EventNotifier +} + +func (m *_PublishedEventsDataType) GetSelectedFields() []SimpleAttributeOperand { + return m.SelectedFields +} + +func (m *_PublishedEventsDataType) GetFilter() ContentFilter { + return m.Filter +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastPublishedEventsDataType(structType any) PublishedEventsDataType { + if casted, ok := structType.(PublishedEventsDataType); ok { + return casted + } + if casted, ok := structType.(*PublishedEventsDataType); ok { + return *casted + } + return nil +} + +func (m *_PublishedEventsDataType) GetTypeName() string { + return "PublishedEventsDataType" +} + +func (m *_PublishedEventsDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (eventNotifier) + lengthInBits += m.EventNotifier.GetLengthInBits(ctx) + + // Implicit Field (noOfSelectedFields) + lengthInBits += 32 + + // Array field + if len(m.SelectedFields) > 0 { + for _curItem, element := range m.SelectedFields { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SelectedFields), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (filter) + lengthInBits += m.Filter.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_PublishedEventsDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_PublishedEventsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedEventsDataType PublishedEventsDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("PublishedEventsDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for PublishedEventsDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + eventNotifier, err := ReadSimpleField[NodeId](ctx, "eventNotifier", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eventNotifier' field")) + } + m.EventNotifier = eventNotifier + + noOfSelectedFields, err := ReadImplicitField[int32](ctx, "noOfSelectedFields", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSelectedFields' field")) + } + _ = noOfSelectedFields + + selectedFields, err := ReadCountArrayField[SimpleAttributeOperand](ctx, "selectedFields", ReadComplex[SimpleAttributeOperand](ExtensionObjectDefinitionParseWithBufferProducer[SimpleAttributeOperand]((int32)(int32(603))), readBuffer), uint64(noOfSelectedFields)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'selectedFields' field")) + } + m.SelectedFields = selectedFields + + filter, err := ReadSimpleField[ContentFilter](ctx, "filter", ReadComplex[ContentFilter](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilter]((int32)(int32(588))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) + } + m.Filter = filter + + if closeErr := readBuffer.CloseContext("PublishedEventsDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for PublishedEventsDataType") + } + + return m, nil +} + +func (m *_PublishedEventsDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_PublishedEventsDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("PublishedEventsDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for PublishedEventsDataType") + } + + if err := WriteSimpleField[NodeId](ctx, "eventNotifier", m.GetEventNotifier(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'eventNotifier' field") + } + noOfSelectedFields := int32(utils.InlineIf(bool((m.GetSelectedFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSelectedFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSelectedFields", noOfSelectedFields, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSelectedFields' field") + } + + if err := WriteComplexTypeArrayField(ctx, "selectedFields", m.GetSelectedFields(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'selectedFields' field") + } + + if err := WriteSimpleField[ContentFilter](ctx, "filter", m.GetFilter(), WriteComplex[ContentFilter](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'filter' field") + } + + if popErr := writeBuffer.PopContext("PublishedEventsDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for PublishedEventsDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_PublishedEventsDataType) IsPublishedEventsDataType() {} + +func (m *_PublishedEventsDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_PublishedEventsDataType) deepCopy() *_PublishedEventsDataType { + if m == nil { + return nil + } + _PublishedEventsDataTypeCopy := &_PublishedEventsDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.EventNotifier.DeepCopy().(NodeId), + utils.DeepCopySlice[SimpleAttributeOperand, SimpleAttributeOperand](m.SelectedFields), + m.Filter.DeepCopy().(ContentFilter), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _PublishedEventsDataTypeCopy +} + +func (m *_PublishedEventsDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/PublishedVariableDataType.go b/plc4go/protocols/opcua/readwrite/model/PublishedVariableDataType.go index 9b830874866..d3205b492bb 100644 --- a/plc4go/protocols/opcua/readwrite/model/PublishedVariableDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/PublishedVariableDataType.go @@ -54,8 +54,6 @@ type PublishedVariableDataType interface { GetIndexRange() PascalString // GetSubstituteValue returns SubstituteValue (property field) GetSubstituteValue() Variant - // GetNoOfMetaDataProperties returns NoOfMetaDataProperties (property field) - GetNoOfMetaDataProperties() int32 // GetMetaDataProperties returns MetaDataProperties (property field) GetMetaDataProperties() []QualifiedName // IsPublishedVariableDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -67,22 +65,21 @@ type PublishedVariableDataType interface { // _PublishedVariableDataType is the data-structure of this message type _PublishedVariableDataType struct { ExtensionObjectDefinitionContract - PublishedVariable NodeId - AttributeId uint32 - SamplingIntervalHint float64 - DeadbandType uint32 - DeadbandValue float64 - IndexRange PascalString - SubstituteValue Variant - NoOfMetaDataProperties int32 - MetaDataProperties []QualifiedName + PublishedVariable NodeId + AttributeId uint32 + SamplingIntervalHint float64 + DeadbandType uint32 + DeadbandValue float64 + IndexRange PascalString + SubstituteValue Variant + MetaDataProperties []QualifiedName } var _ PublishedVariableDataType = (*_PublishedVariableDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_PublishedVariableDataType)(nil) // NewPublishedVariableDataType factory function for _PublishedVariableDataType -func NewPublishedVariableDataType(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, noOfMetaDataProperties int32, metaDataProperties []QualifiedName) *_PublishedVariableDataType { +func NewPublishedVariableDataType(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, metaDataProperties []QualifiedName) *_PublishedVariableDataType { if publishedVariable == nil { panic("publishedVariable of type NodeId for PublishedVariableDataType must not be nil") } @@ -101,7 +98,6 @@ func NewPublishedVariableDataType(publishedVariable NodeId, attributeId uint32, DeadbandValue: deadbandValue, IndexRange: indexRange, SubstituteValue: substituteValue, - NoOfMetaDataProperties: noOfMetaDataProperties, MetaDataProperties: metaDataProperties, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -117,7 +113,7 @@ func NewPublishedVariableDataType(publishedVariable NodeId, attributeId uint32, type PublishedVariableDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, noOfMetaDataProperties int32, metaDataProperties []QualifiedName) PublishedVariableDataTypeBuilder + WithMandatoryFields(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, metaDataProperties []QualifiedName) PublishedVariableDataTypeBuilder // WithPublishedVariable adds PublishedVariable (property field) WithPublishedVariable(NodeId) PublishedVariableDataTypeBuilder // WithPublishedVariableBuilder adds PublishedVariable (property field) which is build by the builder @@ -138,8 +134,6 @@ type PublishedVariableDataTypeBuilder interface { WithSubstituteValue(Variant) PublishedVariableDataTypeBuilder // WithSubstituteValueBuilder adds SubstituteValue (property field) which is build by the builder WithSubstituteValueBuilder(func(VariantBuilder) VariantBuilder) PublishedVariableDataTypeBuilder - // WithNoOfMetaDataProperties adds NoOfMetaDataProperties (property field) - WithNoOfMetaDataProperties(int32) PublishedVariableDataTypeBuilder // WithMetaDataProperties adds MetaDataProperties (property field) WithMetaDataProperties(...QualifiedName) PublishedVariableDataTypeBuilder // Build builds the PublishedVariableDataType or returns an error if something is wrong @@ -167,8 +161,8 @@ func (b *_PublishedVariableDataTypeBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_PublishedVariableDataTypeBuilder) WithMandatoryFields(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, noOfMetaDataProperties int32, metaDataProperties []QualifiedName) PublishedVariableDataTypeBuilder { - return b.WithPublishedVariable(publishedVariable).WithAttributeId(attributeId).WithSamplingIntervalHint(samplingIntervalHint).WithDeadbandType(deadbandType).WithDeadbandValue(deadbandValue).WithIndexRange(indexRange).WithSubstituteValue(substituteValue).WithNoOfMetaDataProperties(noOfMetaDataProperties).WithMetaDataProperties(metaDataProperties...) +func (b *_PublishedVariableDataTypeBuilder) WithMandatoryFields(publishedVariable NodeId, attributeId uint32, samplingIntervalHint float64, deadbandType uint32, deadbandValue float64, indexRange PascalString, substituteValue Variant, metaDataProperties []QualifiedName) PublishedVariableDataTypeBuilder { + return b.WithPublishedVariable(publishedVariable).WithAttributeId(attributeId).WithSamplingIntervalHint(samplingIntervalHint).WithDeadbandType(deadbandType).WithDeadbandValue(deadbandValue).WithIndexRange(indexRange).WithSubstituteValue(substituteValue).WithMetaDataProperties(metaDataProperties...) } func (b *_PublishedVariableDataTypeBuilder) WithPublishedVariable(publishedVariable NodeId) PublishedVariableDataTypeBuilder { @@ -245,11 +239,6 @@ func (b *_PublishedVariableDataTypeBuilder) WithSubstituteValueBuilder(builderSu return b } -func (b *_PublishedVariableDataTypeBuilder) WithNoOfMetaDataProperties(noOfMetaDataProperties int32) PublishedVariableDataTypeBuilder { - b.NoOfMetaDataProperties = noOfMetaDataProperties - return b -} - func (b *_PublishedVariableDataTypeBuilder) WithMetaDataProperties(metaDataProperties ...QualifiedName) PublishedVariableDataTypeBuilder { b.MetaDataProperties = metaDataProperties return b @@ -323,8 +312,8 @@ func (b *_PublishedVariableDataType) CreatePublishedVariableDataTypeBuilder() Pu /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_PublishedVariableDataType) GetIdentifier() string { - return "14275" +func (m *_PublishedVariableDataType) GetExtensionId() int32 { + return int32(14275) } /////////////////////// @@ -369,10 +358,6 @@ func (m *_PublishedVariableDataType) GetSubstituteValue() Variant { return m.SubstituteValue } -func (m *_PublishedVariableDataType) GetNoOfMetaDataProperties() int32 { - return m.NoOfMetaDataProperties -} - func (m *_PublishedVariableDataType) GetMetaDataProperties() []QualifiedName { return m.MetaDataProperties } @@ -421,7 +406,7 @@ func (m *_PublishedVariableDataType) GetLengthInBits(ctx context.Context) uint16 // Simple field (substituteValue) lengthInBits += m.SubstituteValue.GetLengthInBits(ctx) - // Simple field (noOfMetaDataProperties) + // Implicit Field (noOfMetaDataProperties) lengthInBits += 32 // Array field @@ -441,7 +426,7 @@ func (m *_PublishedVariableDataType) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_PublishedVariableDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__publishedVariableDataType PublishedVariableDataType, err error) { +func (m *_PublishedVariableDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__publishedVariableDataType PublishedVariableDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -494,11 +479,11 @@ func (m *_PublishedVariableDataType) parse(ctx context.Context, readBuffer utils } m.SubstituteValue = substituteValue - noOfMetaDataProperties, err := ReadSimpleField(ctx, "noOfMetaDataProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfMetaDataProperties, err := ReadImplicitField[int32](ctx, "noOfMetaDataProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfMetaDataProperties' field")) } - m.NoOfMetaDataProperties = noOfMetaDataProperties + _ = noOfMetaDataProperties metaDataProperties, err := ReadCountArrayField[QualifiedName](ctx, "metaDataProperties", ReadComplex[QualifiedName](QualifiedNameParseWithBuffer, readBuffer), uint64(noOfMetaDataProperties)) if err != nil { @@ -558,8 +543,8 @@ func (m *_PublishedVariableDataType) SerializeWithWriteBuffer(ctx context.Contex if err := WriteSimpleField[Variant](ctx, "substituteValue", m.GetSubstituteValue(), WriteComplex[Variant](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'substituteValue' field") } - - if err := WriteSimpleField[int32](ctx, "noOfMetaDataProperties", m.GetNoOfMetaDataProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfMetaDataProperties := int32(utils.InlineIf(bool((m.GetMetaDataProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetMetaDataProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfMetaDataProperties", noOfMetaDataProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfMetaDataProperties' field") } @@ -594,7 +579,6 @@ func (m *_PublishedVariableDataType) deepCopy() *_PublishedVariableDataType { m.DeadbandValue, m.IndexRange.DeepCopy().(PascalString), m.SubstituteValue.DeepCopy().(Variant), - m.NoOfMetaDataProperties, utils.DeepCopySlice[QualifiedName, QualifiedName](m.MetaDataProperties), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/QosDataType.go b/plc4go/protocols/opcua/readwrite/model/QosDataType.go index 0a8cab91666..8f48240eaa6 100644 --- a/plc4go/protocols/opcua/readwrite/model/QosDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/QosDataType.go @@ -150,8 +150,8 @@ func (b *_QosDataType) CreateQosDataTypeBuilder() QosDataTypeBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QosDataType) GetIdentifier() string { - return "23605" +func (m *_QosDataType) GetExtensionId() int32 { + return int32(23605) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_QosDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QosDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__qosDataType QosDataType, err error) { +func (m *_QosDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__qosDataType QosDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/QuantityDimension.go b/plc4go/protocols/opcua/readwrite/model/QuantityDimension.go index af54341f9e5..02980b151e2 100644 --- a/plc4go/protocols/opcua/readwrite/model/QuantityDimension.go +++ b/plc4go/protocols/opcua/readwrite/model/QuantityDimension.go @@ -240,8 +240,8 @@ func (b *_QuantityDimension) CreateQuantityDimensionBuilder() QuantityDimensionB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QuantityDimension) GetIdentifier() string { - return "32440" +func (m *_QuantityDimension) GetExtensionId() int32 { + return int32(32440) } /////////////////////// @@ -344,7 +344,7 @@ func (m *_QuantityDimension) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QuantityDimension) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__quantityDimension QuantityDimension, err error) { +func (m *_QuantityDimension) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__quantityDimension QuantityDimension, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/QueryDataDescription.go b/plc4go/protocols/opcua/readwrite/model/QueryDataDescription.go index 76735ec7f27..2bed9369ebb 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryDataDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryDataDescription.go @@ -41,7 +41,7 @@ type QueryDataDescription interface { utils.Copyable ExtensionObjectDefinition // GetRelativePath returns RelativePath (property field) - GetRelativePath() ExtensionObjectDefinition + GetRelativePath() RelativePath // GetAttributeId returns AttributeId (property field) GetAttributeId() uint32 // GetIndexRange returns IndexRange (property field) @@ -55,7 +55,7 @@ type QueryDataDescription interface { // _QueryDataDescription is the data-structure of this message type _QueryDataDescription struct { ExtensionObjectDefinitionContract - RelativePath ExtensionObjectDefinition + RelativePath RelativePath AttributeId uint32 IndexRange PascalString } @@ -64,9 +64,9 @@ var _ QueryDataDescription = (*_QueryDataDescription)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryDataDescription)(nil) // NewQueryDataDescription factory function for _QueryDataDescription -func NewQueryDataDescription(relativePath ExtensionObjectDefinition, attributeId uint32, indexRange PascalString) *_QueryDataDescription { +func NewQueryDataDescription(relativePath RelativePath, attributeId uint32, indexRange PascalString) *_QueryDataDescription { if relativePath == nil { - panic("relativePath of type ExtensionObjectDefinition for QueryDataDescription must not be nil") + panic("relativePath of type RelativePath for QueryDataDescription must not be nil") } if indexRange == nil { panic("indexRange of type PascalString for QueryDataDescription must not be nil") @@ -90,11 +90,11 @@ func NewQueryDataDescription(relativePath ExtensionObjectDefinition, attributeId type QueryDataDescriptionBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(relativePath ExtensionObjectDefinition, attributeId uint32, indexRange PascalString) QueryDataDescriptionBuilder + WithMandatoryFields(relativePath RelativePath, attributeId uint32, indexRange PascalString) QueryDataDescriptionBuilder // WithRelativePath adds RelativePath (property field) - WithRelativePath(ExtensionObjectDefinition) QueryDataDescriptionBuilder + WithRelativePath(RelativePath) QueryDataDescriptionBuilder // WithRelativePathBuilder adds RelativePath (property field) which is build by the builder - WithRelativePathBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryDataDescriptionBuilder + WithRelativePathBuilder(func(RelativePathBuilder) RelativePathBuilder) QueryDataDescriptionBuilder // WithAttributeId adds AttributeId (property field) WithAttributeId(uint32) QueryDataDescriptionBuilder // WithIndexRange adds IndexRange (property field) @@ -126,24 +126,24 @@ func (b *_QueryDataDescriptionBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryDataDescriptionBuilder) WithMandatoryFields(relativePath ExtensionObjectDefinition, attributeId uint32, indexRange PascalString) QueryDataDescriptionBuilder { +func (b *_QueryDataDescriptionBuilder) WithMandatoryFields(relativePath RelativePath, attributeId uint32, indexRange PascalString) QueryDataDescriptionBuilder { return b.WithRelativePath(relativePath).WithAttributeId(attributeId).WithIndexRange(indexRange) } -func (b *_QueryDataDescriptionBuilder) WithRelativePath(relativePath ExtensionObjectDefinition) QueryDataDescriptionBuilder { +func (b *_QueryDataDescriptionBuilder) WithRelativePath(relativePath RelativePath) QueryDataDescriptionBuilder { b.RelativePath = relativePath return b } -func (b *_QueryDataDescriptionBuilder) WithRelativePathBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryDataDescriptionBuilder { - builder := builderSupplier(b.RelativePath.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryDataDescriptionBuilder) WithRelativePathBuilder(builderSupplier func(RelativePathBuilder) RelativePathBuilder) QueryDataDescriptionBuilder { + builder := builderSupplier(b.RelativePath.CreateRelativePathBuilder()) var err error b.RelativePath, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RelativePathBuilder failed")) } return b } @@ -233,8 +233,8 @@ func (b *_QueryDataDescription) CreateQueryDataDescriptionBuilder() QueryDataDes /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryDataDescription) GetIdentifier() string { - return "572" +func (m *_QueryDataDescription) GetExtensionId() int32 { + return int32(572) } /////////////////////// @@ -251,7 +251,7 @@ func (m *_QueryDataDescription) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_QueryDataDescription) GetRelativePath() ExtensionObjectDefinition { +func (m *_QueryDataDescription) GetRelativePath() RelativePath { return m.RelativePath } @@ -302,7 +302,7 @@ func (m *_QueryDataDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryDataDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryDataDescription QueryDataDescription, err error) { +func (m *_QueryDataDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryDataDescription QueryDataDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -313,7 +313,7 @@ func (m *_QueryDataDescription) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - relativePath, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "relativePath", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("542")), readBuffer)) + relativePath, err := ReadSimpleField[RelativePath](ctx, "relativePath", ReadComplex[RelativePath](ExtensionObjectDefinitionParseWithBufferProducer[RelativePath]((int32)(int32(542))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'relativePath' field")) } @@ -356,7 +356,7 @@ func (m *_QueryDataDescription) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for QueryDataDescription") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "relativePath", m.GetRelativePath(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RelativePath](ctx, "relativePath", m.GetRelativePath(), WriteComplex[RelativePath](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'relativePath' field") } @@ -388,7 +388,7 @@ func (m *_QueryDataDescription) deepCopy() *_QueryDataDescription { } _QueryDataDescriptionCopy := &_QueryDataDescription{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RelativePath.DeepCopy().(ExtensionObjectDefinition), + m.RelativePath.DeepCopy().(RelativePath), m.AttributeId, m.IndexRange.DeepCopy().(PascalString), } diff --git a/plc4go/protocols/opcua/readwrite/model/QueryDataSet.go b/plc4go/protocols/opcua/readwrite/model/QueryDataSet.go index c70201e9a9a..6c6ea563605 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryDataSet.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryDataSet.go @@ -44,8 +44,6 @@ type QueryDataSet interface { GetNodeId() ExpandedNodeId // GetTypeDefinitionNode returns TypeDefinitionNode (property field) GetTypeDefinitionNode() ExpandedNodeId - // GetNoOfValues returns NoOfValues (property field) - GetNoOfValues() int32 // GetValues returns Values (property field) GetValues() []Variant // IsQueryDataSet is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,7 +57,6 @@ type _QueryDataSet struct { ExtensionObjectDefinitionContract NodeId ExpandedNodeId TypeDefinitionNode ExpandedNodeId - NoOfValues int32 Values []Variant } @@ -67,7 +64,7 @@ var _ QueryDataSet = (*_QueryDataSet)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryDataSet)(nil) // NewQueryDataSet factory function for _QueryDataSet -func NewQueryDataSet(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, noOfValues int32, values []Variant) *_QueryDataSet { +func NewQueryDataSet(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, values []Variant) *_QueryDataSet { if nodeId == nil { panic("nodeId of type ExpandedNodeId for QueryDataSet must not be nil") } @@ -78,7 +75,6 @@ func NewQueryDataSet(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, n ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), NodeId: nodeId, TypeDefinitionNode: typeDefinitionNode, - NoOfValues: noOfValues, Values: values, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -94,7 +90,7 @@ func NewQueryDataSet(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, n type QueryDataSetBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, noOfValues int32, values []Variant) QueryDataSetBuilder + WithMandatoryFields(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, values []Variant) QueryDataSetBuilder // WithNodeId adds NodeId (property field) WithNodeId(ExpandedNodeId) QueryDataSetBuilder // WithNodeIdBuilder adds NodeId (property field) which is build by the builder @@ -103,8 +99,6 @@ type QueryDataSetBuilder interface { WithTypeDefinitionNode(ExpandedNodeId) QueryDataSetBuilder // WithTypeDefinitionNodeBuilder adds TypeDefinitionNode (property field) which is build by the builder WithTypeDefinitionNodeBuilder(func(ExpandedNodeIdBuilder) ExpandedNodeIdBuilder) QueryDataSetBuilder - // WithNoOfValues adds NoOfValues (property field) - WithNoOfValues(int32) QueryDataSetBuilder // WithValues adds Values (property field) WithValues(...Variant) QueryDataSetBuilder // Build builds the QueryDataSet or returns an error if something is wrong @@ -132,8 +126,8 @@ func (b *_QueryDataSetBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryDataSetBuilder) WithMandatoryFields(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, noOfValues int32, values []Variant) QueryDataSetBuilder { - return b.WithNodeId(nodeId).WithTypeDefinitionNode(typeDefinitionNode).WithNoOfValues(noOfValues).WithValues(values...) +func (b *_QueryDataSetBuilder) WithMandatoryFields(nodeId ExpandedNodeId, typeDefinitionNode ExpandedNodeId, values []Variant) QueryDataSetBuilder { + return b.WithNodeId(nodeId).WithTypeDefinitionNode(typeDefinitionNode).WithValues(values...) } func (b *_QueryDataSetBuilder) WithNodeId(nodeId ExpandedNodeId) QueryDataSetBuilder { @@ -172,11 +166,6 @@ func (b *_QueryDataSetBuilder) WithTypeDefinitionNodeBuilder(builderSupplier fun return b } -func (b *_QueryDataSetBuilder) WithNoOfValues(noOfValues int32) QueryDataSetBuilder { - b.NoOfValues = noOfValues - return b -} - func (b *_QueryDataSetBuilder) WithValues(values ...Variant) QueryDataSetBuilder { b.Values = values return b @@ -244,8 +233,8 @@ func (b *_QueryDataSet) CreateQueryDataSetBuilder() QueryDataSetBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryDataSet) GetIdentifier() string { - return "579" +func (m *_QueryDataSet) GetExtensionId() int32 { + return int32(579) } /////////////////////// @@ -270,10 +259,6 @@ func (m *_QueryDataSet) GetTypeDefinitionNode() ExpandedNodeId { return m.TypeDefinitionNode } -func (m *_QueryDataSet) GetNoOfValues() int32 { - return m.NoOfValues -} - func (m *_QueryDataSet) GetValues() []Variant { return m.Values } @@ -307,7 +292,7 @@ func (m *_QueryDataSet) GetLengthInBits(ctx context.Context) uint16 { // Simple field (typeDefinitionNode) lengthInBits += m.TypeDefinitionNode.GetLengthInBits(ctx) - // Simple field (noOfValues) + // Implicit Field (noOfValues) lengthInBits += 32 // Array field @@ -327,7 +312,7 @@ func (m *_QueryDataSet) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryDataSet) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryDataSet QueryDataSet, err error) { +func (m *_QueryDataSet) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryDataSet QueryDataSet, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -350,11 +335,11 @@ func (m *_QueryDataSet) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.TypeDefinitionNode = typeDefinitionNode - noOfValues, err := ReadSimpleField(ctx, "noOfValues", ReadSignedInt(readBuffer, uint8(32))) + noOfValues, err := ReadImplicitField[int32](ctx, "noOfValues", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfValues' field")) } - m.NoOfValues = noOfValues + _ = noOfValues values, err := ReadCountArrayField[Variant](ctx, "values", ReadComplex[Variant](VariantParseWithBuffer, readBuffer), uint64(noOfValues)) if err != nil { @@ -394,8 +379,8 @@ func (m *_QueryDataSet) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if err := WriteSimpleField[ExpandedNodeId](ctx, "typeDefinitionNode", m.GetTypeDefinitionNode(), WriteComplex[ExpandedNodeId](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'typeDefinitionNode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfValues", m.GetNoOfValues(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfValues := int32(utils.InlineIf(bool((m.GetValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfValues", noOfValues, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfValues' field") } @@ -425,7 +410,6 @@ func (m *_QueryDataSet) deepCopy() *_QueryDataSet { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.NodeId.DeepCopy().(ExpandedNodeId), m.TypeDefinitionNode.DeepCopy().(ExpandedNodeId), - m.NoOfValues, utils.DeepCopySlice[Variant, Variant](m.Values), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/QueryFirstRequest.go b/plc4go/protocols/opcua/readwrite/model/QueryFirstRequest.go index 64e10603d5e..652a7e0268b 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryFirstRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryFirstRequest.go @@ -41,15 +41,13 @@ type QueryFirstRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetView returns View (property field) - GetView() ExtensionObjectDefinition - // GetNoOfNodeTypes returns NoOfNodeTypes (property field) - GetNoOfNodeTypes() int32 + GetView() ViewDescription // GetNodeTypes returns NodeTypes (property field) - GetNodeTypes() []ExtensionObjectDefinition + GetNodeTypes() []NodeTypeDescription // GetFilter returns Filter (property field) - GetFilter() ExtensionObjectDefinition + GetFilter() ContentFilter // GetMaxDataSetsToReturn returns MaxDataSetsToReturn (property field) GetMaxDataSetsToReturn() uint32 // GetMaxReferencesToReturn returns MaxReferencesToReturn (property field) @@ -63,11 +61,10 @@ type QueryFirstRequest interface { // _QueryFirstRequest is the data-structure of this message type _QueryFirstRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - View ExtensionObjectDefinition - NoOfNodeTypes int32 - NodeTypes []ExtensionObjectDefinition - Filter ExtensionObjectDefinition + RequestHeader RequestHeader + View ViewDescription + NodeTypes []NodeTypeDescription + Filter ContentFilter MaxDataSetsToReturn uint32 MaxReferencesToReturn uint32 } @@ -76,21 +73,20 @@ var _ QueryFirstRequest = (*_QueryFirstRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryFirstRequest)(nil) // NewQueryFirstRequest factory function for _QueryFirstRequest -func NewQueryFirstRequest(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, noOfNodeTypes int32, nodeTypes []ExtensionObjectDefinition, filter ExtensionObjectDefinition, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) *_QueryFirstRequest { +func NewQueryFirstRequest(requestHeader RequestHeader, view ViewDescription, nodeTypes []NodeTypeDescription, filter ContentFilter, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) *_QueryFirstRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for QueryFirstRequest must not be nil") + panic("requestHeader of type RequestHeader for QueryFirstRequest must not be nil") } if view == nil { - panic("view of type ExtensionObjectDefinition for QueryFirstRequest must not be nil") + panic("view of type ViewDescription for QueryFirstRequest must not be nil") } if filter == nil { - panic("filter of type ExtensionObjectDefinition for QueryFirstRequest must not be nil") + panic("filter of type ContentFilter for QueryFirstRequest must not be nil") } _result := &_QueryFirstRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, View: view, - NoOfNodeTypes: noOfNodeTypes, NodeTypes: nodeTypes, Filter: filter, MaxDataSetsToReturn: maxDataSetsToReturn, @@ -109,23 +105,21 @@ func NewQueryFirstRequest(requestHeader ExtensionObjectDefinition, view Extensio type QueryFirstRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, noOfNodeTypes int32, nodeTypes []ExtensionObjectDefinition, filter ExtensionObjectDefinition, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) QueryFirstRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, view ViewDescription, nodeTypes []NodeTypeDescription, filter ContentFilter, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) QueryFirstRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) QueryFirstRequestBuilder + WithRequestHeader(RequestHeader) QueryFirstRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) QueryFirstRequestBuilder // WithView adds View (property field) - WithView(ExtensionObjectDefinition) QueryFirstRequestBuilder + WithView(ViewDescription) QueryFirstRequestBuilder // WithViewBuilder adds View (property field) which is build by the builder - WithViewBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder - // WithNoOfNodeTypes adds NoOfNodeTypes (property field) - WithNoOfNodeTypes(int32) QueryFirstRequestBuilder + WithViewBuilder(func(ViewDescriptionBuilder) ViewDescriptionBuilder) QueryFirstRequestBuilder // WithNodeTypes adds NodeTypes (property field) - WithNodeTypes(...ExtensionObjectDefinition) QueryFirstRequestBuilder + WithNodeTypes(...NodeTypeDescription) QueryFirstRequestBuilder // WithFilter adds Filter (property field) - WithFilter(ExtensionObjectDefinition) QueryFirstRequestBuilder + WithFilter(ContentFilter) QueryFirstRequestBuilder // WithFilterBuilder adds Filter (property field) which is build by the builder - WithFilterBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder + WithFilterBuilder(func(ContentFilterBuilder) ContentFilterBuilder) QueryFirstRequestBuilder // WithMaxDataSetsToReturn adds MaxDataSetsToReturn (property field) WithMaxDataSetsToReturn(uint32) QueryFirstRequestBuilder // WithMaxReferencesToReturn adds MaxReferencesToReturn (property field) @@ -155,70 +149,65 @@ func (b *_QueryFirstRequestBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryFirstRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, view ExtensionObjectDefinition, noOfNodeTypes int32, nodeTypes []ExtensionObjectDefinition, filter ExtensionObjectDefinition, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) QueryFirstRequestBuilder { - return b.WithRequestHeader(requestHeader).WithView(view).WithNoOfNodeTypes(noOfNodeTypes).WithNodeTypes(nodeTypes...).WithFilter(filter).WithMaxDataSetsToReturn(maxDataSetsToReturn).WithMaxReferencesToReturn(maxReferencesToReturn) +func (b *_QueryFirstRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, view ViewDescription, nodeTypes []NodeTypeDescription, filter ContentFilter, maxDataSetsToReturn uint32, maxReferencesToReturn uint32) QueryFirstRequestBuilder { + return b.WithRequestHeader(requestHeader).WithView(view).WithNodeTypes(nodeTypes...).WithFilter(filter).WithMaxDataSetsToReturn(maxDataSetsToReturn).WithMaxReferencesToReturn(maxReferencesToReturn) } -func (b *_QueryFirstRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) QueryFirstRequestBuilder { +func (b *_QueryFirstRequestBuilder) WithRequestHeader(requestHeader RequestHeader) QueryFirstRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_QueryFirstRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryFirstRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) QueryFirstRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_QueryFirstRequestBuilder) WithView(view ExtensionObjectDefinition) QueryFirstRequestBuilder { +func (b *_QueryFirstRequestBuilder) WithView(view ViewDescription) QueryFirstRequestBuilder { b.View = view return b } -func (b *_QueryFirstRequestBuilder) WithViewBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder { - builder := builderSupplier(b.View.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryFirstRequestBuilder) WithViewBuilder(builderSupplier func(ViewDescriptionBuilder) ViewDescriptionBuilder) QueryFirstRequestBuilder { + builder := builderSupplier(b.View.CreateViewDescriptionBuilder()) var err error b.View, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ViewDescriptionBuilder failed")) } return b } -func (b *_QueryFirstRequestBuilder) WithNoOfNodeTypes(noOfNodeTypes int32) QueryFirstRequestBuilder { - b.NoOfNodeTypes = noOfNodeTypes - return b -} - -func (b *_QueryFirstRequestBuilder) WithNodeTypes(nodeTypes ...ExtensionObjectDefinition) QueryFirstRequestBuilder { +func (b *_QueryFirstRequestBuilder) WithNodeTypes(nodeTypes ...NodeTypeDescription) QueryFirstRequestBuilder { b.NodeTypes = nodeTypes return b } -func (b *_QueryFirstRequestBuilder) WithFilter(filter ExtensionObjectDefinition) QueryFirstRequestBuilder { +func (b *_QueryFirstRequestBuilder) WithFilter(filter ContentFilter) QueryFirstRequestBuilder { b.Filter = filter return b } -func (b *_QueryFirstRequestBuilder) WithFilterBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstRequestBuilder { - builder := builderSupplier(b.Filter.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryFirstRequestBuilder) WithFilterBuilder(builderSupplier func(ContentFilterBuilder) ContentFilterBuilder) QueryFirstRequestBuilder { + builder := builderSupplier(b.Filter.CreateContentFilterBuilder()) var err error b.Filter, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ContentFilterBuilder failed")) } return b } @@ -301,8 +290,8 @@ func (b *_QueryFirstRequest) CreateQueryFirstRequestBuilder() QueryFirstRequestB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryFirstRequest) GetIdentifier() string { - return "615" +func (m *_QueryFirstRequest) GetExtensionId() int32 { + return int32(615) } /////////////////////// @@ -319,23 +308,19 @@ func (m *_QueryFirstRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_QueryFirstRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_QueryFirstRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_QueryFirstRequest) GetView() ExtensionObjectDefinition { +func (m *_QueryFirstRequest) GetView() ViewDescription { return m.View } -func (m *_QueryFirstRequest) GetNoOfNodeTypes() int32 { - return m.NoOfNodeTypes -} - -func (m *_QueryFirstRequest) GetNodeTypes() []ExtensionObjectDefinition { +func (m *_QueryFirstRequest) GetNodeTypes() []NodeTypeDescription { return m.NodeTypes } -func (m *_QueryFirstRequest) GetFilter() ExtensionObjectDefinition { +func (m *_QueryFirstRequest) GetFilter() ContentFilter { return m.Filter } @@ -376,7 +361,7 @@ func (m *_QueryFirstRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (view) lengthInBits += m.View.GetLengthInBits(ctx) - // Simple field (noOfNodeTypes) + // Implicit Field (noOfNodeTypes) lengthInBits += 32 // Array field @@ -405,7 +390,7 @@ func (m *_QueryFirstRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryFirstRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryFirstRequest QueryFirstRequest, err error) { +func (m *_QueryFirstRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryFirstRequest QueryFirstRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -416,31 +401,31 @@ func (m *_QueryFirstRequest) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - view, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "view", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("513")), readBuffer)) + view, err := ReadSimpleField[ViewDescription](ctx, "view", ReadComplex[ViewDescription](ExtensionObjectDefinitionParseWithBufferProducer[ViewDescription]((int32)(int32(513))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'view' field")) } m.View = view - noOfNodeTypes, err := ReadSimpleField(ctx, "noOfNodeTypes", ReadSignedInt(readBuffer, uint8(32))) + noOfNodeTypes, err := ReadImplicitField[int32](ctx, "noOfNodeTypes", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodeTypes' field")) } - m.NoOfNodeTypes = noOfNodeTypes + _ = noOfNodeTypes - nodeTypes, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodeTypes", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("575")), readBuffer), uint64(noOfNodeTypes)) + nodeTypes, err := ReadCountArrayField[NodeTypeDescription](ctx, "nodeTypes", ReadComplex[NodeTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[NodeTypeDescription]((int32)(int32(575))), readBuffer), uint64(noOfNodeTypes)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeTypes' field")) } m.NodeTypes = nodeTypes - filter, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "filter", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("588")), readBuffer)) + filter, err := ReadSimpleField[ContentFilter](ctx, "filter", ReadComplex[ContentFilter](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilter]((int32)(int32(588))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) } @@ -483,15 +468,15 @@ func (m *_QueryFirstRequest) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for QueryFirstRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "view", m.GetView(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ViewDescription](ctx, "view", m.GetView(), WriteComplex[ViewDescription](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'view' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodeTypes", m.GetNoOfNodeTypes(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodeTypes := int32(utils.InlineIf(bool((m.GetNodeTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodeTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodeTypes", noOfNodeTypes, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodeTypes' field") } @@ -499,7 +484,7 @@ func (m *_QueryFirstRequest) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(err, "Error serializing 'nodeTypes' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "filter", m.GetFilter(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ContentFilter](ctx, "filter", m.GetFilter(), WriteComplex[ContentFilter](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'filter' field") } @@ -531,11 +516,10 @@ func (m *_QueryFirstRequest) deepCopy() *_QueryFirstRequest { } _QueryFirstRequestCopy := &_QueryFirstRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.View.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodeTypes, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodeTypes), - m.Filter.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), + m.View.DeepCopy().(ViewDescription), + utils.DeepCopySlice[NodeTypeDescription, NodeTypeDescription](m.NodeTypes), + m.Filter.DeepCopy().(ContentFilter), m.MaxDataSetsToReturn, m.MaxReferencesToReturn, } diff --git a/plc4go/protocols/opcua/readwrite/model/QueryFirstResponse.go b/plc4go/protocols/opcua/readwrite/model/QueryFirstResponse.go index 2b19ab4f639..733cfafba56 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryFirstResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryFirstResponse.go @@ -41,23 +41,17 @@ type QueryFirstResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfQueryDataSets returns NoOfQueryDataSets (property field) - GetNoOfQueryDataSets() int32 + GetResponseHeader() ResponseHeader // GetQueryDataSets returns QueryDataSets (property field) - GetQueryDataSets() []ExtensionObjectDefinition + GetQueryDataSets() []QueryDataSet // GetContinuationPoint returns ContinuationPoint (property field) GetContinuationPoint() PascalByteString - // GetNoOfParsingResults returns NoOfParsingResults (property field) - GetNoOfParsingResults() int32 // GetParsingResults returns ParsingResults (property field) - GetParsingResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetParsingResults() []ParsingResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // GetFilterResult returns FilterResult (property field) - GetFilterResult() ExtensionObjectDefinition + GetFilterResult() ContentFilterResult // IsQueryFirstResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsQueryFirstResponse() // CreateBuilder creates a QueryFirstResponseBuilder @@ -67,40 +61,34 @@ type QueryFirstResponse interface { // _QueryFirstResponse is the data-structure of this message type _QueryFirstResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfQueryDataSets int32 - QueryDataSets []ExtensionObjectDefinition - ContinuationPoint PascalByteString - NoOfParsingResults int32 - ParsingResults []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo - FilterResult ExtensionObjectDefinition + ResponseHeader ResponseHeader + QueryDataSets []QueryDataSet + ContinuationPoint PascalByteString + ParsingResults []ParsingResult + DiagnosticInfos []DiagnosticInfo + FilterResult ContentFilterResult } var _ QueryFirstResponse = (*_QueryFirstResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryFirstResponse)(nil) // NewQueryFirstResponse factory function for _QueryFirstResponse -func NewQueryFirstResponse(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, continuationPoint PascalByteString, noOfParsingResults int32, parsingResults []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo, filterResult ExtensionObjectDefinition) *_QueryFirstResponse { +func NewQueryFirstResponse(responseHeader ResponseHeader, queryDataSets []QueryDataSet, continuationPoint PascalByteString, parsingResults []ParsingResult, diagnosticInfos []DiagnosticInfo, filterResult ContentFilterResult) *_QueryFirstResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for QueryFirstResponse must not be nil") + panic("responseHeader of type ResponseHeader for QueryFirstResponse must not be nil") } if continuationPoint == nil { panic("continuationPoint of type PascalByteString for QueryFirstResponse must not be nil") } if filterResult == nil { - panic("filterResult of type ExtensionObjectDefinition for QueryFirstResponse must not be nil") + panic("filterResult of type ContentFilterResult for QueryFirstResponse must not be nil") } _result := &_QueryFirstResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfQueryDataSets: noOfQueryDataSets, QueryDataSets: queryDataSets, ContinuationPoint: continuationPoint, - NoOfParsingResults: noOfParsingResults, ParsingResults: parsingResults, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, FilterResult: filterResult, } @@ -117,31 +105,25 @@ func NewQueryFirstResponse(responseHeader ExtensionObjectDefinition, noOfQueryDa type QueryFirstResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, continuationPoint PascalByteString, noOfParsingResults int32, parsingResults []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo, filterResult ExtensionObjectDefinition) QueryFirstResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, queryDataSets []QueryDataSet, continuationPoint PascalByteString, parsingResults []ParsingResult, diagnosticInfos []DiagnosticInfo, filterResult ContentFilterResult) QueryFirstResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) QueryFirstResponseBuilder + WithResponseHeader(ResponseHeader) QueryFirstResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstResponseBuilder - // WithNoOfQueryDataSets adds NoOfQueryDataSets (property field) - WithNoOfQueryDataSets(int32) QueryFirstResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) QueryFirstResponseBuilder // WithQueryDataSets adds QueryDataSets (property field) - WithQueryDataSets(...ExtensionObjectDefinition) QueryFirstResponseBuilder + WithQueryDataSets(...QueryDataSet) QueryFirstResponseBuilder // WithContinuationPoint adds ContinuationPoint (property field) WithContinuationPoint(PascalByteString) QueryFirstResponseBuilder // WithContinuationPointBuilder adds ContinuationPoint (property field) which is build by the builder WithContinuationPointBuilder(func(PascalByteStringBuilder) PascalByteStringBuilder) QueryFirstResponseBuilder - // WithNoOfParsingResults adds NoOfParsingResults (property field) - WithNoOfParsingResults(int32) QueryFirstResponseBuilder // WithParsingResults adds ParsingResults (property field) - WithParsingResults(...ExtensionObjectDefinition) QueryFirstResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) QueryFirstResponseBuilder + WithParsingResults(...ParsingResult) QueryFirstResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) QueryFirstResponseBuilder // WithFilterResult adds FilterResult (property field) - WithFilterResult(ExtensionObjectDefinition) QueryFirstResponseBuilder + WithFilterResult(ContentFilterResult) QueryFirstResponseBuilder // WithFilterResultBuilder adds FilterResult (property field) which is build by the builder - WithFilterResultBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstResponseBuilder + WithFilterResultBuilder(func(ContentFilterResultBuilder) ContentFilterResultBuilder) QueryFirstResponseBuilder // Build builds the QueryFirstResponse or returns an error if something is wrong Build() (QueryFirstResponse, error) // MustBuild does the same as Build but panics on error @@ -167,34 +149,29 @@ func (b *_QueryFirstResponseBuilder) setParent(contract ExtensionObjectDefinitio b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryFirstResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, continuationPoint PascalByteString, noOfParsingResults int32, parsingResults []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo, filterResult ExtensionObjectDefinition) QueryFirstResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfQueryDataSets(noOfQueryDataSets).WithQueryDataSets(queryDataSets...).WithContinuationPoint(continuationPoint).WithNoOfParsingResults(noOfParsingResults).WithParsingResults(parsingResults...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...).WithFilterResult(filterResult) +func (b *_QueryFirstResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, queryDataSets []QueryDataSet, continuationPoint PascalByteString, parsingResults []ParsingResult, diagnosticInfos []DiagnosticInfo, filterResult ContentFilterResult) QueryFirstResponseBuilder { + return b.WithResponseHeader(responseHeader).WithQueryDataSets(queryDataSets...).WithContinuationPoint(continuationPoint).WithParsingResults(parsingResults...).WithDiagnosticInfos(diagnosticInfos...).WithFilterResult(filterResult) } -func (b *_QueryFirstResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) QueryFirstResponseBuilder { +func (b *_QueryFirstResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) QueryFirstResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_QueryFirstResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryFirstResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) QueryFirstResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_QueryFirstResponseBuilder) WithNoOfQueryDataSets(noOfQueryDataSets int32) QueryFirstResponseBuilder { - b.NoOfQueryDataSets = noOfQueryDataSets - return b -} - -func (b *_QueryFirstResponseBuilder) WithQueryDataSets(queryDataSets ...ExtensionObjectDefinition) QueryFirstResponseBuilder { +func (b *_QueryFirstResponseBuilder) WithQueryDataSets(queryDataSets ...QueryDataSet) QueryFirstResponseBuilder { b.QueryDataSets = queryDataSets return b } @@ -217,40 +194,30 @@ func (b *_QueryFirstResponseBuilder) WithContinuationPointBuilder(builderSupplie return b } -func (b *_QueryFirstResponseBuilder) WithNoOfParsingResults(noOfParsingResults int32) QueryFirstResponseBuilder { - b.NoOfParsingResults = noOfParsingResults - return b -} - -func (b *_QueryFirstResponseBuilder) WithParsingResults(parsingResults ...ExtensionObjectDefinition) QueryFirstResponseBuilder { +func (b *_QueryFirstResponseBuilder) WithParsingResults(parsingResults ...ParsingResult) QueryFirstResponseBuilder { b.ParsingResults = parsingResults return b } -func (b *_QueryFirstResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) QueryFirstResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_QueryFirstResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) QueryFirstResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b } -func (b *_QueryFirstResponseBuilder) WithFilterResult(filterResult ExtensionObjectDefinition) QueryFirstResponseBuilder { +func (b *_QueryFirstResponseBuilder) WithFilterResult(filterResult ContentFilterResult) QueryFirstResponseBuilder { b.FilterResult = filterResult return b } -func (b *_QueryFirstResponseBuilder) WithFilterResultBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryFirstResponseBuilder { - builder := builderSupplier(b.FilterResult.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryFirstResponseBuilder) WithFilterResultBuilder(builderSupplier func(ContentFilterResultBuilder) ContentFilterResultBuilder) QueryFirstResponseBuilder { + builder := builderSupplier(b.FilterResult.CreateContentFilterResultBuilder()) var err error b.FilterResult, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ContentFilterResultBuilder failed")) } return b } @@ -323,8 +290,8 @@ func (b *_QueryFirstResponse) CreateQueryFirstResponseBuilder() QueryFirstRespon /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryFirstResponse) GetIdentifier() string { - return "618" +func (m *_QueryFirstResponse) GetExtensionId() int32 { + return int32(618) } /////////////////////// @@ -341,15 +308,11 @@ func (m *_QueryFirstResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_QueryFirstResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_QueryFirstResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_QueryFirstResponse) GetNoOfQueryDataSets() int32 { - return m.NoOfQueryDataSets -} - -func (m *_QueryFirstResponse) GetQueryDataSets() []ExtensionObjectDefinition { +func (m *_QueryFirstResponse) GetQueryDataSets() []QueryDataSet { return m.QueryDataSets } @@ -357,23 +320,15 @@ func (m *_QueryFirstResponse) GetContinuationPoint() PascalByteString { return m.ContinuationPoint } -func (m *_QueryFirstResponse) GetNoOfParsingResults() int32 { - return m.NoOfParsingResults -} - -func (m *_QueryFirstResponse) GetParsingResults() []ExtensionObjectDefinition { +func (m *_QueryFirstResponse) GetParsingResults() []ParsingResult { return m.ParsingResults } -func (m *_QueryFirstResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_QueryFirstResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } -func (m *_QueryFirstResponse) GetFilterResult() ExtensionObjectDefinition { +func (m *_QueryFirstResponse) GetFilterResult() ContentFilterResult { return m.FilterResult } @@ -403,7 +358,7 @@ func (m *_QueryFirstResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfQueryDataSets) + // Implicit Field (noOfQueryDataSets) lengthInBits += 32 // Array field @@ -419,7 +374,7 @@ func (m *_QueryFirstResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (continuationPoint) lengthInBits += m.ContinuationPoint.GetLengthInBits(ctx) - // Simple field (noOfParsingResults) + // Implicit Field (noOfParsingResults) lengthInBits += 32 // Array field @@ -432,7 +387,7 @@ func (m *_QueryFirstResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -455,7 +410,7 @@ func (m *_QueryFirstResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryFirstResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryFirstResponse QueryFirstResponse, err error) { +func (m *_QueryFirstResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryFirstResponse QueryFirstResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -466,19 +421,19 @@ func (m *_QueryFirstResponse) parse(ctx context.Context, readBuffer utils.ReadBu currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfQueryDataSets, err := ReadSimpleField(ctx, "noOfQueryDataSets", ReadSignedInt(readBuffer, uint8(32))) + noOfQueryDataSets, err := ReadImplicitField[int32](ctx, "noOfQueryDataSets", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfQueryDataSets' field")) } - m.NoOfQueryDataSets = noOfQueryDataSets + _ = noOfQueryDataSets - queryDataSets, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "queryDataSets", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("579")), readBuffer), uint64(noOfQueryDataSets)) + queryDataSets, err := ReadCountArrayField[QueryDataSet](ctx, "queryDataSets", ReadComplex[QueryDataSet](ExtensionObjectDefinitionParseWithBufferProducer[QueryDataSet]((int32)(int32(579))), readBuffer), uint64(noOfQueryDataSets)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queryDataSets' field")) } @@ -490,23 +445,23 @@ func (m *_QueryFirstResponse) parse(ctx context.Context, readBuffer utils.ReadBu } m.ContinuationPoint = continuationPoint - noOfParsingResults, err := ReadSimpleField(ctx, "noOfParsingResults", ReadSignedInt(readBuffer, uint8(32))) + noOfParsingResults, err := ReadImplicitField[int32](ctx, "noOfParsingResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfParsingResults' field")) } - m.NoOfParsingResults = noOfParsingResults + _ = noOfParsingResults - parsingResults, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "parsingResults", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("612")), readBuffer), uint64(noOfParsingResults)) + parsingResults, err := ReadCountArrayField[ParsingResult](ctx, "parsingResults", ReadComplex[ParsingResult](ExtensionObjectDefinitionParseWithBufferProducer[ParsingResult]((int32)(int32(612))), readBuffer), uint64(noOfParsingResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'parsingResults' field")) } m.ParsingResults = parsingResults - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -514,7 +469,7 @@ func (m *_QueryFirstResponse) parse(ctx context.Context, readBuffer utils.ReadBu } m.DiagnosticInfos = diagnosticInfos - filterResult, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "filterResult", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("609")), readBuffer)) + filterResult, err := ReadSimpleField[ContentFilterResult](ctx, "filterResult", ReadComplex[ContentFilterResult](ExtensionObjectDefinitionParseWithBufferProducer[ContentFilterResult]((int32)(int32(609))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filterResult' field")) } @@ -545,11 +500,11 @@ func (m *_QueryFirstResponse) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(pushErr, "Error pushing for QueryFirstResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfQueryDataSets", m.GetNoOfQueryDataSets(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfQueryDataSets := int32(utils.InlineIf(bool((m.GetQueryDataSets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetQueryDataSets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfQueryDataSets", noOfQueryDataSets, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfQueryDataSets' field") } @@ -560,16 +515,16 @@ func (m *_QueryFirstResponse) SerializeWithWriteBuffer(ctx context.Context, writ if err := WriteSimpleField[PascalByteString](ctx, "continuationPoint", m.GetContinuationPoint(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'continuationPoint' field") } - - if err := WriteSimpleField[int32](ctx, "noOfParsingResults", m.GetNoOfParsingResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfParsingResults := int32(utils.InlineIf(bool((m.GetParsingResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetParsingResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfParsingResults", noOfParsingResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfParsingResults' field") } if err := WriteComplexTypeArrayField(ctx, "parsingResults", m.GetParsingResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'parsingResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -577,7 +532,7 @@ func (m *_QueryFirstResponse) SerializeWithWriteBuffer(ctx context.Context, writ return errors.Wrap(err, "Error serializing 'diagnosticInfos' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "filterResult", m.GetFilterResult(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ContentFilterResult](ctx, "filterResult", m.GetFilterResult(), WriteComplex[ContentFilterResult](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'filterResult' field") } @@ -601,15 +556,12 @@ func (m *_QueryFirstResponse) deepCopy() *_QueryFirstResponse { } _QueryFirstResponseCopy := &_QueryFirstResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfQueryDataSets, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.QueryDataSets), + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[QueryDataSet, QueryDataSet](m.QueryDataSets), m.ContinuationPoint.DeepCopy().(PascalByteString), - m.NoOfParsingResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.ParsingResults), - m.NoOfDiagnosticInfos, + utils.DeepCopySlice[ParsingResult, ParsingResult](m.ParsingResults), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), - m.FilterResult.DeepCopy().(ExtensionObjectDefinition), + m.FilterResult.DeepCopy().(ContentFilterResult), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _QueryFirstResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/QueryNextRequest.go b/plc4go/protocols/opcua/readwrite/model/QueryNextRequest.go index 1f5a78253ea..470df163f57 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryNextRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryNextRequest.go @@ -41,7 +41,7 @@ type QueryNextRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetReleaseContinuationPoint returns ReleaseContinuationPoint (property field) GetReleaseContinuationPoint() bool // GetContinuationPoint returns ContinuationPoint (property field) @@ -55,7 +55,7 @@ type QueryNextRequest interface { // _QueryNextRequest is the data-structure of this message type _QueryNextRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader ReleaseContinuationPoint bool ContinuationPoint PascalByteString // Reserved Fields @@ -66,9 +66,9 @@ var _ QueryNextRequest = (*_QueryNextRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryNextRequest)(nil) // NewQueryNextRequest factory function for _QueryNextRequest -func NewQueryNextRequest(requestHeader ExtensionObjectDefinition, releaseContinuationPoint bool, continuationPoint PascalByteString) *_QueryNextRequest { +func NewQueryNextRequest(requestHeader RequestHeader, releaseContinuationPoint bool, continuationPoint PascalByteString) *_QueryNextRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for QueryNextRequest must not be nil") + panic("requestHeader of type RequestHeader for QueryNextRequest must not be nil") } if continuationPoint == nil { panic("continuationPoint of type PascalByteString for QueryNextRequest must not be nil") @@ -92,11 +92,11 @@ func NewQueryNextRequest(requestHeader ExtensionObjectDefinition, releaseContinu type QueryNextRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, releaseContinuationPoint bool, continuationPoint PascalByteString) QueryNextRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, releaseContinuationPoint bool, continuationPoint PascalByteString) QueryNextRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) QueryNextRequestBuilder + WithRequestHeader(RequestHeader) QueryNextRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryNextRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) QueryNextRequestBuilder // WithReleaseContinuationPoint adds ReleaseContinuationPoint (property field) WithReleaseContinuationPoint(bool) QueryNextRequestBuilder // WithContinuationPoint adds ContinuationPoint (property field) @@ -128,24 +128,24 @@ func (b *_QueryNextRequestBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryNextRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, releaseContinuationPoint bool, continuationPoint PascalByteString) QueryNextRequestBuilder { +func (b *_QueryNextRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, releaseContinuationPoint bool, continuationPoint PascalByteString) QueryNextRequestBuilder { return b.WithRequestHeader(requestHeader).WithReleaseContinuationPoint(releaseContinuationPoint).WithContinuationPoint(continuationPoint) } -func (b *_QueryNextRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) QueryNextRequestBuilder { +func (b *_QueryNextRequestBuilder) WithRequestHeader(requestHeader RequestHeader) QueryNextRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_QueryNextRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryNextRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryNextRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) QueryNextRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -235,8 +235,8 @@ func (b *_QueryNextRequest) CreateQueryNextRequestBuilder() QueryNextRequestBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryNextRequest) GetIdentifier() string { - return "621" +func (m *_QueryNextRequest) GetExtensionId() int32 { + return int32(621) } /////////////////////// @@ -253,7 +253,7 @@ func (m *_QueryNextRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_QueryNextRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_QueryNextRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -307,7 +307,7 @@ func (m *_QueryNextRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryNextRequest QueryNextRequest, err error) { +func (m *_QueryNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryNextRequest QueryNextRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -318,7 +318,7 @@ func (m *_QueryNextRequest) parse(ctx context.Context, readBuffer utils.ReadBuff currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -367,7 +367,7 @@ func (m *_QueryNextRequest) SerializeWithWriteBuffer(ctx context.Context, writeB return errors.Wrap(pushErr, "Error pushing for QueryNextRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -403,7 +403,7 @@ func (m *_QueryNextRequest) deepCopy() *_QueryNextRequest { } _QueryNextRequestCopy := &_QueryNextRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.ReleaseContinuationPoint, m.ContinuationPoint.DeepCopy().(PascalByteString), m.reservedField0, diff --git a/plc4go/protocols/opcua/readwrite/model/QueryNextResponse.go b/plc4go/protocols/opcua/readwrite/model/QueryNextResponse.go index 283681babee..045d107f5db 100644 --- a/plc4go/protocols/opcua/readwrite/model/QueryNextResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/QueryNextResponse.go @@ -41,11 +41,9 @@ type QueryNextResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfQueryDataSets returns NoOfQueryDataSets (property field) - GetNoOfQueryDataSets() int32 + GetResponseHeader() ResponseHeader // GetQueryDataSets returns QueryDataSets (property field) - GetQueryDataSets() []ExtensionObjectDefinition + GetQueryDataSets() []QueryDataSet // GetRevisedContinuationPoint returns RevisedContinuationPoint (property field) GetRevisedContinuationPoint() PascalByteString // IsQueryNextResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,9 +55,8 @@ type QueryNextResponse interface { // _QueryNextResponse is the data-structure of this message type _QueryNextResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfQueryDataSets int32 - QueryDataSets []ExtensionObjectDefinition + ResponseHeader ResponseHeader + QueryDataSets []QueryDataSet RevisedContinuationPoint PascalByteString } @@ -67,9 +64,9 @@ var _ QueryNextResponse = (*_QueryNextResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_QueryNextResponse)(nil) // NewQueryNextResponse factory function for _QueryNextResponse -func NewQueryNextResponse(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, revisedContinuationPoint PascalByteString) *_QueryNextResponse { +func NewQueryNextResponse(responseHeader ResponseHeader, queryDataSets []QueryDataSet, revisedContinuationPoint PascalByteString) *_QueryNextResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for QueryNextResponse must not be nil") + panic("responseHeader of type ResponseHeader for QueryNextResponse must not be nil") } if revisedContinuationPoint == nil { panic("revisedContinuationPoint of type PascalByteString for QueryNextResponse must not be nil") @@ -77,7 +74,6 @@ func NewQueryNextResponse(responseHeader ExtensionObjectDefinition, noOfQueryDat _result := &_QueryNextResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfQueryDataSets: noOfQueryDataSets, QueryDataSets: queryDataSets, RevisedContinuationPoint: revisedContinuationPoint, } @@ -94,15 +90,13 @@ func NewQueryNextResponse(responseHeader ExtensionObjectDefinition, noOfQueryDat type QueryNextResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, revisedContinuationPoint PascalByteString) QueryNextResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, queryDataSets []QueryDataSet, revisedContinuationPoint PascalByteString) QueryNextResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) QueryNextResponseBuilder + WithResponseHeader(ResponseHeader) QueryNextResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryNextResponseBuilder - // WithNoOfQueryDataSets adds NoOfQueryDataSets (property field) - WithNoOfQueryDataSets(int32) QueryNextResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) QueryNextResponseBuilder // WithQueryDataSets adds QueryDataSets (property field) - WithQueryDataSets(...ExtensionObjectDefinition) QueryNextResponseBuilder + WithQueryDataSets(...QueryDataSet) QueryNextResponseBuilder // WithRevisedContinuationPoint adds RevisedContinuationPoint (property field) WithRevisedContinuationPoint(PascalByteString) QueryNextResponseBuilder // WithRevisedContinuationPointBuilder adds RevisedContinuationPoint (property field) which is build by the builder @@ -132,34 +126,29 @@ func (b *_QueryNextResponseBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_QueryNextResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfQueryDataSets int32, queryDataSets []ExtensionObjectDefinition, revisedContinuationPoint PascalByteString) QueryNextResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfQueryDataSets(noOfQueryDataSets).WithQueryDataSets(queryDataSets...).WithRevisedContinuationPoint(revisedContinuationPoint) +func (b *_QueryNextResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, queryDataSets []QueryDataSet, revisedContinuationPoint PascalByteString) QueryNextResponseBuilder { + return b.WithResponseHeader(responseHeader).WithQueryDataSets(queryDataSets...).WithRevisedContinuationPoint(revisedContinuationPoint) } -func (b *_QueryNextResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) QueryNextResponseBuilder { +func (b *_QueryNextResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) QueryNextResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_QueryNextResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) QueryNextResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_QueryNextResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) QueryNextResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_QueryNextResponseBuilder) WithNoOfQueryDataSets(noOfQueryDataSets int32) QueryNextResponseBuilder { - b.NoOfQueryDataSets = noOfQueryDataSets - return b -} - -func (b *_QueryNextResponseBuilder) WithQueryDataSets(queryDataSets ...ExtensionObjectDefinition) QueryNextResponseBuilder { +func (b *_QueryNextResponseBuilder) WithQueryDataSets(queryDataSets ...QueryDataSet) QueryNextResponseBuilder { b.QueryDataSets = queryDataSets return b } @@ -244,8 +233,8 @@ func (b *_QueryNextResponse) CreateQueryNextResponseBuilder() QueryNextResponseB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_QueryNextResponse) GetIdentifier() string { - return "624" +func (m *_QueryNextResponse) GetExtensionId() int32 { + return int32(624) } /////////////////////// @@ -262,15 +251,11 @@ func (m *_QueryNextResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_QueryNextResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_QueryNextResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_QueryNextResponse) GetNoOfQueryDataSets() int32 { - return m.NoOfQueryDataSets -} - -func (m *_QueryNextResponse) GetQueryDataSets() []ExtensionObjectDefinition { +func (m *_QueryNextResponse) GetQueryDataSets() []QueryDataSet { return m.QueryDataSets } @@ -304,7 +289,7 @@ func (m *_QueryNextResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfQueryDataSets) + // Implicit Field (noOfQueryDataSets) lengthInBits += 32 // Array field @@ -327,7 +312,7 @@ func (m *_QueryNextResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_QueryNextResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__queryNextResponse QueryNextResponse, err error) { +func (m *_QueryNextResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__queryNextResponse QueryNextResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -338,19 +323,19 @@ func (m *_QueryNextResponse) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfQueryDataSets, err := ReadSimpleField(ctx, "noOfQueryDataSets", ReadSignedInt(readBuffer, uint8(32))) + noOfQueryDataSets, err := ReadImplicitField[int32](ctx, "noOfQueryDataSets", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfQueryDataSets' field")) } - m.NoOfQueryDataSets = noOfQueryDataSets + _ = noOfQueryDataSets - queryDataSets, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "queryDataSets", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("579")), readBuffer), uint64(noOfQueryDataSets)) + queryDataSets, err := ReadCountArrayField[QueryDataSet](ctx, "queryDataSets", ReadComplex[QueryDataSet](ExtensionObjectDefinitionParseWithBufferProducer[QueryDataSet]((int32)(int32(579))), readBuffer), uint64(noOfQueryDataSets)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queryDataSets' field")) } @@ -387,11 +372,11 @@ func (m *_QueryNextResponse) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for QueryNextResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfQueryDataSets", m.GetNoOfQueryDataSets(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfQueryDataSets := int32(utils.InlineIf(bool((m.GetQueryDataSets()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetQueryDataSets()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfQueryDataSets", noOfQueryDataSets, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfQueryDataSets' field") } @@ -423,9 +408,8 @@ func (m *_QueryNextResponse) deepCopy() *_QueryNextResponse { } _QueryNextResponseCopy := &_QueryNextResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfQueryDataSets, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.QueryDataSets), + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[QueryDataSet, QueryDataSet](m.QueryDataSets), m.RevisedContinuationPoint.DeepCopy().(PascalByteString), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/Range.go b/plc4go/protocols/opcua/readwrite/model/Range.go index d2cc45b31f2..bfbbdb07674 100644 --- a/plc4go/protocols/opcua/readwrite/model/Range.go +++ b/plc4go/protocols/opcua/readwrite/model/Range.go @@ -174,8 +174,8 @@ func (b *_Range) CreateRangeBuilder() RangeBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Range) GetIdentifier() string { - return "886" +func (m *_Range) GetExtensionId() int32 { + return int32(886) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_Range) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Range) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__range Range, err error) { +func (m *_Range) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__range Range, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/RationalNumber.go b/plc4go/protocols/opcua/readwrite/model/RationalNumber.go index 79a8481044a..d4a5067af1f 100644 --- a/plc4go/protocols/opcua/readwrite/model/RationalNumber.go +++ b/plc4go/protocols/opcua/readwrite/model/RationalNumber.go @@ -174,8 +174,8 @@ func (b *_RationalNumber) CreateRationalNumberBuilder() RationalNumberBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RationalNumber) GetIdentifier() string { - return "18808" +func (m *_RationalNumber) GetExtensionId() int32 { + return int32(18808) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_RationalNumber) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RationalNumber) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__rationalNumber RationalNumber, err error) { +func (m *_RationalNumber) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__rationalNumber RationalNumber, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReadAnnotationDataDetails.go b/plc4go/protocols/opcua/readwrite/model/ReadAnnotationDataDetails.go new file mode 100644 index 00000000000..7c99de24e96 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadAnnotationDataDetails.go @@ -0,0 +1,321 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadAnnotationDataDetails is the corresponding interface of ReadAnnotationDataDetails +type ReadAnnotationDataDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetReqTimes returns ReqTimes (property field) + GetReqTimes() []int64 + // IsReadAnnotationDataDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadAnnotationDataDetails() + // CreateBuilder creates a ReadAnnotationDataDetailsBuilder + CreateReadAnnotationDataDetailsBuilder() ReadAnnotationDataDetailsBuilder +} + +// _ReadAnnotationDataDetails is the data-structure of this message +type _ReadAnnotationDataDetails struct { + ExtensionObjectDefinitionContract + ReqTimes []int64 +} + +var _ ReadAnnotationDataDetails = (*_ReadAnnotationDataDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadAnnotationDataDetails)(nil) + +// NewReadAnnotationDataDetails factory function for _ReadAnnotationDataDetails +func NewReadAnnotationDataDetails(reqTimes []int64) *_ReadAnnotationDataDetails { + _result := &_ReadAnnotationDataDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + ReqTimes: reqTimes, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadAnnotationDataDetailsBuilder is a builder for ReadAnnotationDataDetails +type ReadAnnotationDataDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(reqTimes []int64) ReadAnnotationDataDetailsBuilder + // WithReqTimes adds ReqTimes (property field) + WithReqTimes(...int64) ReadAnnotationDataDetailsBuilder + // Build builds the ReadAnnotationDataDetails or returns an error if something is wrong + Build() (ReadAnnotationDataDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadAnnotationDataDetails +} + +// NewReadAnnotationDataDetailsBuilder() creates a ReadAnnotationDataDetailsBuilder +func NewReadAnnotationDataDetailsBuilder() ReadAnnotationDataDetailsBuilder { + return &_ReadAnnotationDataDetailsBuilder{_ReadAnnotationDataDetails: new(_ReadAnnotationDataDetails)} +} + +type _ReadAnnotationDataDetailsBuilder struct { + *_ReadAnnotationDataDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadAnnotationDataDetailsBuilder) = (*_ReadAnnotationDataDetailsBuilder)(nil) + +func (b *_ReadAnnotationDataDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadAnnotationDataDetailsBuilder) WithMandatoryFields(reqTimes []int64) ReadAnnotationDataDetailsBuilder { + return b.WithReqTimes(reqTimes...) +} + +func (b *_ReadAnnotationDataDetailsBuilder) WithReqTimes(reqTimes ...int64) ReadAnnotationDataDetailsBuilder { + b.ReqTimes = reqTimes + return b +} + +func (b *_ReadAnnotationDataDetailsBuilder) Build() (ReadAnnotationDataDetails, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadAnnotationDataDetails.deepCopy(), nil +} + +func (b *_ReadAnnotationDataDetailsBuilder) MustBuild() ReadAnnotationDataDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadAnnotationDataDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadAnnotationDataDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadAnnotationDataDetailsBuilder) DeepCopy() any { + _copy := b.CreateReadAnnotationDataDetailsBuilder().(*_ReadAnnotationDataDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadAnnotationDataDetailsBuilder creates a ReadAnnotationDataDetailsBuilder +func (b *_ReadAnnotationDataDetails) CreateReadAnnotationDataDetailsBuilder() ReadAnnotationDataDetailsBuilder { + if b == nil { + return NewReadAnnotationDataDetailsBuilder() + } + return &_ReadAnnotationDataDetailsBuilder{_ReadAnnotationDataDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadAnnotationDataDetails) GetExtensionId() int32 { + return int32(23499) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadAnnotationDataDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadAnnotationDataDetails) GetReqTimes() []int64 { + return m.ReqTimes +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadAnnotationDataDetails(structType any) ReadAnnotationDataDetails { + if casted, ok := structType.(ReadAnnotationDataDetails); ok { + return casted + } + if casted, ok := structType.(*ReadAnnotationDataDetails); ok { + return *casted + } + return nil +} + +func (m *_ReadAnnotationDataDetails) GetTypeName() string { + return "ReadAnnotationDataDetails" +} + +func (m *_ReadAnnotationDataDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfReqTimes) + lengthInBits += 32 + + // Array field + if len(m.ReqTimes) > 0 { + lengthInBits += 64 * uint16(len(m.ReqTimes)) + } + + return lengthInBits +} + +func (m *_ReadAnnotationDataDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadAnnotationDataDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readAnnotationDataDetails ReadAnnotationDataDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadAnnotationDataDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadAnnotationDataDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfReqTimes, err := ReadImplicitField[int32](ctx, "noOfReqTimes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReqTimes' field")) + } + _ = noOfReqTimes + + reqTimes, err := ReadCountArrayField[int64](ctx, "reqTimes", ReadSignedLong(readBuffer, uint8(64)), uint64(noOfReqTimes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'reqTimes' field")) + } + m.ReqTimes = reqTimes + + if closeErr := readBuffer.CloseContext("ReadAnnotationDataDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadAnnotationDataDetails") + } + + return m, nil +} + +func (m *_ReadAnnotationDataDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadAnnotationDataDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadAnnotationDataDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadAnnotationDataDetails") + } + noOfReqTimes := int32(utils.InlineIf(bool((m.GetReqTimes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReqTimes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReqTimes", noOfReqTimes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfReqTimes' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "reqTimes", m.GetReqTimes(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'reqTimes' field") + } + + if popErr := writeBuffer.PopContext("ReadAnnotationDataDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadAnnotationDataDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadAnnotationDataDetails) IsReadAnnotationDataDetails() {} + +func (m *_ReadAnnotationDataDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadAnnotationDataDetails) deepCopy() *_ReadAnnotationDataDetails { + if m == nil { + return nil + } + _ReadAnnotationDataDetailsCopy := &_ReadAnnotationDataDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[int64, int64](m.ReqTimes), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadAnnotationDataDetailsCopy +} + +func (m *_ReadAnnotationDataDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadAtTimeDetails.go b/plc4go/protocols/opcua/readwrite/model/ReadAtTimeDetails.go new file mode 100644 index 00000000000..440a501e8f1 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadAtTimeDetails.go @@ -0,0 +1,366 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadAtTimeDetails is the corresponding interface of ReadAtTimeDetails +type ReadAtTimeDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetReqTimes returns ReqTimes (property field) + GetReqTimes() []int64 + // GetUseSimpleBounds returns UseSimpleBounds (property field) + GetUseSimpleBounds() bool + // IsReadAtTimeDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadAtTimeDetails() + // CreateBuilder creates a ReadAtTimeDetailsBuilder + CreateReadAtTimeDetailsBuilder() ReadAtTimeDetailsBuilder +} + +// _ReadAtTimeDetails is the data-structure of this message +type _ReadAtTimeDetails struct { + ExtensionObjectDefinitionContract + ReqTimes []int64 + UseSimpleBounds bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ ReadAtTimeDetails = (*_ReadAtTimeDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadAtTimeDetails)(nil) + +// NewReadAtTimeDetails factory function for _ReadAtTimeDetails +func NewReadAtTimeDetails(reqTimes []int64, useSimpleBounds bool) *_ReadAtTimeDetails { + _result := &_ReadAtTimeDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + ReqTimes: reqTimes, + UseSimpleBounds: useSimpleBounds, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadAtTimeDetailsBuilder is a builder for ReadAtTimeDetails +type ReadAtTimeDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(reqTimes []int64, useSimpleBounds bool) ReadAtTimeDetailsBuilder + // WithReqTimes adds ReqTimes (property field) + WithReqTimes(...int64) ReadAtTimeDetailsBuilder + // WithUseSimpleBounds adds UseSimpleBounds (property field) + WithUseSimpleBounds(bool) ReadAtTimeDetailsBuilder + // Build builds the ReadAtTimeDetails or returns an error if something is wrong + Build() (ReadAtTimeDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadAtTimeDetails +} + +// NewReadAtTimeDetailsBuilder() creates a ReadAtTimeDetailsBuilder +func NewReadAtTimeDetailsBuilder() ReadAtTimeDetailsBuilder { + return &_ReadAtTimeDetailsBuilder{_ReadAtTimeDetails: new(_ReadAtTimeDetails)} +} + +type _ReadAtTimeDetailsBuilder struct { + *_ReadAtTimeDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadAtTimeDetailsBuilder) = (*_ReadAtTimeDetailsBuilder)(nil) + +func (b *_ReadAtTimeDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadAtTimeDetailsBuilder) WithMandatoryFields(reqTimes []int64, useSimpleBounds bool) ReadAtTimeDetailsBuilder { + return b.WithReqTimes(reqTimes...).WithUseSimpleBounds(useSimpleBounds) +} + +func (b *_ReadAtTimeDetailsBuilder) WithReqTimes(reqTimes ...int64) ReadAtTimeDetailsBuilder { + b.ReqTimes = reqTimes + return b +} + +func (b *_ReadAtTimeDetailsBuilder) WithUseSimpleBounds(useSimpleBounds bool) ReadAtTimeDetailsBuilder { + b.UseSimpleBounds = useSimpleBounds + return b +} + +func (b *_ReadAtTimeDetailsBuilder) Build() (ReadAtTimeDetails, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadAtTimeDetails.deepCopy(), nil +} + +func (b *_ReadAtTimeDetailsBuilder) MustBuild() ReadAtTimeDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadAtTimeDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadAtTimeDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadAtTimeDetailsBuilder) DeepCopy() any { + _copy := b.CreateReadAtTimeDetailsBuilder().(*_ReadAtTimeDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadAtTimeDetailsBuilder creates a ReadAtTimeDetailsBuilder +func (b *_ReadAtTimeDetails) CreateReadAtTimeDetailsBuilder() ReadAtTimeDetailsBuilder { + if b == nil { + return NewReadAtTimeDetailsBuilder() + } + return &_ReadAtTimeDetailsBuilder{_ReadAtTimeDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadAtTimeDetails) GetExtensionId() int32 { + return int32(655) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadAtTimeDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadAtTimeDetails) GetReqTimes() []int64 { + return m.ReqTimes +} + +func (m *_ReadAtTimeDetails) GetUseSimpleBounds() bool { + return m.UseSimpleBounds +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadAtTimeDetails(structType any) ReadAtTimeDetails { + if casted, ok := structType.(ReadAtTimeDetails); ok { + return casted + } + if casted, ok := structType.(*ReadAtTimeDetails); ok { + return *casted + } + return nil +} + +func (m *_ReadAtTimeDetails) GetTypeName() string { + return "ReadAtTimeDetails" +} + +func (m *_ReadAtTimeDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfReqTimes) + lengthInBits += 32 + + // Array field + if len(m.ReqTimes) > 0 { + lengthInBits += 64 * uint16(len(m.ReqTimes)) + } + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (useSimpleBounds) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_ReadAtTimeDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadAtTimeDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readAtTimeDetails ReadAtTimeDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadAtTimeDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadAtTimeDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfReqTimes, err := ReadImplicitField[int32](ctx, "noOfReqTimes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfReqTimes' field")) + } + _ = noOfReqTimes + + reqTimes, err := ReadCountArrayField[int64](ctx, "reqTimes", ReadSignedLong(readBuffer, uint8(64)), uint64(noOfReqTimes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'reqTimes' field")) + } + m.ReqTimes = reqTimes + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + useSimpleBounds, err := ReadSimpleField(ctx, "useSimpleBounds", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'useSimpleBounds' field")) + } + m.UseSimpleBounds = useSimpleBounds + + if closeErr := readBuffer.CloseContext("ReadAtTimeDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadAtTimeDetails") + } + + return m, nil +} + +func (m *_ReadAtTimeDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadAtTimeDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadAtTimeDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadAtTimeDetails") + } + noOfReqTimes := int32(utils.InlineIf(bool((m.GetReqTimes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetReqTimes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfReqTimes", noOfReqTimes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfReqTimes' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "reqTimes", m.GetReqTimes(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'reqTimes' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "useSimpleBounds", m.GetUseSimpleBounds(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'useSimpleBounds' field") + } + + if popErr := writeBuffer.PopContext("ReadAtTimeDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadAtTimeDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadAtTimeDetails) IsReadAtTimeDetails() {} + +func (m *_ReadAtTimeDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadAtTimeDetails) deepCopy() *_ReadAtTimeDetails { + if m == nil { + return nil + } + _ReadAtTimeDetailsCopy := &_ReadAtTimeDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[int64, int64](m.ReqTimes), + m.UseSimpleBounds, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadAtTimeDetailsCopy +} + +func (m *_ReadAtTimeDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadEventDetails.go b/plc4go/protocols/opcua/readwrite/model/ReadEventDetails.go new file mode 100644 index 00000000000..ba13c29e2a9 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadEventDetails.go @@ -0,0 +1,417 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadEventDetails is the corresponding interface of ReadEventDetails +type ReadEventDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNumValuesPerNode returns NumValuesPerNode (property field) + GetNumValuesPerNode() uint32 + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetEndTime returns EndTime (property field) + GetEndTime() int64 + // GetFilter returns Filter (property field) + GetFilter() EventFilter + // IsReadEventDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadEventDetails() + // CreateBuilder creates a ReadEventDetailsBuilder + CreateReadEventDetailsBuilder() ReadEventDetailsBuilder +} + +// _ReadEventDetails is the data-structure of this message +type _ReadEventDetails struct { + ExtensionObjectDefinitionContract + NumValuesPerNode uint32 + StartTime int64 + EndTime int64 + Filter EventFilter +} + +var _ ReadEventDetails = (*_ReadEventDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadEventDetails)(nil) + +// NewReadEventDetails factory function for _ReadEventDetails +func NewReadEventDetails(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter) *_ReadEventDetails { + if filter == nil { + panic("filter of type EventFilter for ReadEventDetails must not be nil") + } + _result := &_ReadEventDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NumValuesPerNode: numValuesPerNode, + StartTime: startTime, + EndTime: endTime, + Filter: filter, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadEventDetailsBuilder is a builder for ReadEventDetails +type ReadEventDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter) ReadEventDetailsBuilder + // WithNumValuesPerNode adds NumValuesPerNode (property field) + WithNumValuesPerNode(uint32) ReadEventDetailsBuilder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) ReadEventDetailsBuilder + // WithEndTime adds EndTime (property field) + WithEndTime(int64) ReadEventDetailsBuilder + // WithFilter adds Filter (property field) + WithFilter(EventFilter) ReadEventDetailsBuilder + // WithFilterBuilder adds Filter (property field) which is build by the builder + WithFilterBuilder(func(EventFilterBuilder) EventFilterBuilder) ReadEventDetailsBuilder + // Build builds the ReadEventDetails or returns an error if something is wrong + Build() (ReadEventDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadEventDetails +} + +// NewReadEventDetailsBuilder() creates a ReadEventDetailsBuilder +func NewReadEventDetailsBuilder() ReadEventDetailsBuilder { + return &_ReadEventDetailsBuilder{_ReadEventDetails: new(_ReadEventDetails)} +} + +type _ReadEventDetailsBuilder struct { + *_ReadEventDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadEventDetailsBuilder) = (*_ReadEventDetailsBuilder)(nil) + +func (b *_ReadEventDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadEventDetailsBuilder) WithMandatoryFields(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter) ReadEventDetailsBuilder { + return b.WithNumValuesPerNode(numValuesPerNode).WithStartTime(startTime).WithEndTime(endTime).WithFilter(filter) +} + +func (b *_ReadEventDetailsBuilder) WithNumValuesPerNode(numValuesPerNode uint32) ReadEventDetailsBuilder { + b.NumValuesPerNode = numValuesPerNode + return b +} + +func (b *_ReadEventDetailsBuilder) WithStartTime(startTime int64) ReadEventDetailsBuilder { + b.StartTime = startTime + return b +} + +func (b *_ReadEventDetailsBuilder) WithEndTime(endTime int64) ReadEventDetailsBuilder { + b.EndTime = endTime + return b +} + +func (b *_ReadEventDetailsBuilder) WithFilter(filter EventFilter) ReadEventDetailsBuilder { + b.Filter = filter + return b +} + +func (b *_ReadEventDetailsBuilder) WithFilterBuilder(builderSupplier func(EventFilterBuilder) EventFilterBuilder) ReadEventDetailsBuilder { + builder := builderSupplier(b.Filter.CreateEventFilterBuilder()) + var err error + b.Filter, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "EventFilterBuilder failed")) + } + return b +} + +func (b *_ReadEventDetailsBuilder) Build() (ReadEventDetails, error) { + if b.Filter == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'filter' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadEventDetails.deepCopy(), nil +} + +func (b *_ReadEventDetailsBuilder) MustBuild() ReadEventDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadEventDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadEventDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadEventDetailsBuilder) DeepCopy() any { + _copy := b.CreateReadEventDetailsBuilder().(*_ReadEventDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadEventDetailsBuilder creates a ReadEventDetailsBuilder +func (b *_ReadEventDetails) CreateReadEventDetailsBuilder() ReadEventDetailsBuilder { + if b == nil { + return NewReadEventDetailsBuilder() + } + return &_ReadEventDetailsBuilder{_ReadEventDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadEventDetails) GetExtensionId() int32 { + return int32(646) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadEventDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadEventDetails) GetNumValuesPerNode() uint32 { + return m.NumValuesPerNode +} + +func (m *_ReadEventDetails) GetStartTime() int64 { + return m.StartTime +} + +func (m *_ReadEventDetails) GetEndTime() int64 { + return m.EndTime +} + +func (m *_ReadEventDetails) GetFilter() EventFilter { + return m.Filter +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadEventDetails(structType any) ReadEventDetails { + if casted, ok := structType.(ReadEventDetails); ok { + return casted + } + if casted, ok := structType.(*ReadEventDetails); ok { + return *casted + } + return nil +} + +func (m *_ReadEventDetails) GetTypeName() string { + return "ReadEventDetails" +} + +func (m *_ReadEventDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (numValuesPerNode) + lengthInBits += 32 + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (endTime) + lengthInBits += 64 + + // Simple field (filter) + lengthInBits += m.Filter.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_ReadEventDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadEventDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readEventDetails ReadEventDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadEventDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadEventDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + numValuesPerNode, err := ReadSimpleField(ctx, "numValuesPerNode", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'numValuesPerNode' field")) + } + m.NumValuesPerNode = numValuesPerNode + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + endTime, err := ReadSimpleField(ctx, "endTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endTime' field")) + } + m.EndTime = endTime + + filter, err := ReadSimpleField[EventFilter](ctx, "filter", ReadComplex[EventFilter](ExtensionObjectDefinitionParseWithBufferProducer[EventFilter]((int32)(int32(727))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) + } + m.Filter = filter + + if closeErr := readBuffer.CloseContext("ReadEventDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadEventDetails") + } + + return m, nil +} + +func (m *_ReadEventDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadEventDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadEventDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadEventDetails") + } + + if err := WriteSimpleField[uint32](ctx, "numValuesPerNode", m.GetNumValuesPerNode(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'numValuesPerNode' field") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[int64](ctx, "endTime", m.GetEndTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'endTime' field") + } + + if err := WriteSimpleField[EventFilter](ctx, "filter", m.GetFilter(), WriteComplex[EventFilter](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'filter' field") + } + + if popErr := writeBuffer.PopContext("ReadEventDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadEventDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadEventDetails) IsReadEventDetails() {} + +func (m *_ReadEventDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadEventDetails) deepCopy() *_ReadEventDetails { + if m == nil { + return nil + } + _ReadEventDetailsCopy := &_ReadEventDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NumValuesPerNode, + m.StartTime, + m.EndTime, + m.Filter.DeepCopy().(EventFilter), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadEventDetailsCopy +} + +func (m *_ReadEventDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadEventDetails2.go b/plc4go/protocols/opcua/readwrite/model/ReadEventDetails2.go new file mode 100644 index 00000000000..9f4aceb82f5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadEventDetails2.go @@ -0,0 +1,462 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadEventDetails2 is the corresponding interface of ReadEventDetails2 +type ReadEventDetails2 interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNumValuesPerNode returns NumValuesPerNode (property field) + GetNumValuesPerNode() uint32 + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetEndTime returns EndTime (property field) + GetEndTime() int64 + // GetFilter returns Filter (property field) + GetFilter() EventFilter + // GetReadModified returns ReadModified (property field) + GetReadModified() bool + // IsReadEventDetails2 is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadEventDetails2() + // CreateBuilder creates a ReadEventDetails2Builder + CreateReadEventDetails2Builder() ReadEventDetails2Builder +} + +// _ReadEventDetails2 is the data-structure of this message +type _ReadEventDetails2 struct { + ExtensionObjectDefinitionContract + NumValuesPerNode uint32 + StartTime int64 + EndTime int64 + Filter EventFilter + ReadModified bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ ReadEventDetails2 = (*_ReadEventDetails2)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadEventDetails2)(nil) + +// NewReadEventDetails2 factory function for _ReadEventDetails2 +func NewReadEventDetails2(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter, readModified bool) *_ReadEventDetails2 { + if filter == nil { + panic("filter of type EventFilter for ReadEventDetails2 must not be nil") + } + _result := &_ReadEventDetails2{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NumValuesPerNode: numValuesPerNode, + StartTime: startTime, + EndTime: endTime, + Filter: filter, + ReadModified: readModified, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadEventDetails2Builder is a builder for ReadEventDetails2 +type ReadEventDetails2Builder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter, readModified bool) ReadEventDetails2Builder + // WithNumValuesPerNode adds NumValuesPerNode (property field) + WithNumValuesPerNode(uint32) ReadEventDetails2Builder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) ReadEventDetails2Builder + // WithEndTime adds EndTime (property field) + WithEndTime(int64) ReadEventDetails2Builder + // WithFilter adds Filter (property field) + WithFilter(EventFilter) ReadEventDetails2Builder + // WithFilterBuilder adds Filter (property field) which is build by the builder + WithFilterBuilder(func(EventFilterBuilder) EventFilterBuilder) ReadEventDetails2Builder + // WithReadModified adds ReadModified (property field) + WithReadModified(bool) ReadEventDetails2Builder + // Build builds the ReadEventDetails2 or returns an error if something is wrong + Build() (ReadEventDetails2, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadEventDetails2 +} + +// NewReadEventDetails2Builder() creates a ReadEventDetails2Builder +func NewReadEventDetails2Builder() ReadEventDetails2Builder { + return &_ReadEventDetails2Builder{_ReadEventDetails2: new(_ReadEventDetails2)} +} + +type _ReadEventDetails2Builder struct { + *_ReadEventDetails2 + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadEventDetails2Builder) = (*_ReadEventDetails2Builder)(nil) + +func (b *_ReadEventDetails2Builder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadEventDetails2Builder) WithMandatoryFields(numValuesPerNode uint32, startTime int64, endTime int64, filter EventFilter, readModified bool) ReadEventDetails2Builder { + return b.WithNumValuesPerNode(numValuesPerNode).WithStartTime(startTime).WithEndTime(endTime).WithFilter(filter).WithReadModified(readModified) +} + +func (b *_ReadEventDetails2Builder) WithNumValuesPerNode(numValuesPerNode uint32) ReadEventDetails2Builder { + b.NumValuesPerNode = numValuesPerNode + return b +} + +func (b *_ReadEventDetails2Builder) WithStartTime(startTime int64) ReadEventDetails2Builder { + b.StartTime = startTime + return b +} + +func (b *_ReadEventDetails2Builder) WithEndTime(endTime int64) ReadEventDetails2Builder { + b.EndTime = endTime + return b +} + +func (b *_ReadEventDetails2Builder) WithFilter(filter EventFilter) ReadEventDetails2Builder { + b.Filter = filter + return b +} + +func (b *_ReadEventDetails2Builder) WithFilterBuilder(builderSupplier func(EventFilterBuilder) EventFilterBuilder) ReadEventDetails2Builder { + builder := builderSupplier(b.Filter.CreateEventFilterBuilder()) + var err error + b.Filter, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "EventFilterBuilder failed")) + } + return b +} + +func (b *_ReadEventDetails2Builder) WithReadModified(readModified bool) ReadEventDetails2Builder { + b.ReadModified = readModified + return b +} + +func (b *_ReadEventDetails2Builder) Build() (ReadEventDetails2, error) { + if b.Filter == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'filter' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadEventDetails2.deepCopy(), nil +} + +func (b *_ReadEventDetails2Builder) MustBuild() ReadEventDetails2 { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadEventDetails2Builder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadEventDetails2Builder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadEventDetails2Builder) DeepCopy() any { + _copy := b.CreateReadEventDetails2Builder().(*_ReadEventDetails2Builder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadEventDetails2Builder creates a ReadEventDetails2Builder +func (b *_ReadEventDetails2) CreateReadEventDetails2Builder() ReadEventDetails2Builder { + if b == nil { + return NewReadEventDetails2Builder() + } + return &_ReadEventDetails2Builder{_ReadEventDetails2: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadEventDetails2) GetExtensionId() int32 { + return int32(32801) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadEventDetails2) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadEventDetails2) GetNumValuesPerNode() uint32 { + return m.NumValuesPerNode +} + +func (m *_ReadEventDetails2) GetStartTime() int64 { + return m.StartTime +} + +func (m *_ReadEventDetails2) GetEndTime() int64 { + return m.EndTime +} + +func (m *_ReadEventDetails2) GetFilter() EventFilter { + return m.Filter +} + +func (m *_ReadEventDetails2) GetReadModified() bool { + return m.ReadModified +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadEventDetails2(structType any) ReadEventDetails2 { + if casted, ok := structType.(ReadEventDetails2); ok { + return casted + } + if casted, ok := structType.(*ReadEventDetails2); ok { + return *casted + } + return nil +} + +func (m *_ReadEventDetails2) GetTypeName() string { + return "ReadEventDetails2" +} + +func (m *_ReadEventDetails2) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (numValuesPerNode) + lengthInBits += 32 + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (endTime) + lengthInBits += 64 + + // Simple field (filter) + lengthInBits += m.Filter.GetLengthInBits(ctx) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (readModified) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_ReadEventDetails2) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadEventDetails2) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readEventDetails2 ReadEventDetails2, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadEventDetails2"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadEventDetails2") + } + currentPos := positionAware.GetPos() + _ = currentPos + + numValuesPerNode, err := ReadSimpleField(ctx, "numValuesPerNode", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'numValuesPerNode' field")) + } + m.NumValuesPerNode = numValuesPerNode + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + endTime, err := ReadSimpleField(ctx, "endTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endTime' field")) + } + m.EndTime = endTime + + filter, err := ReadSimpleField[EventFilter](ctx, "filter", ReadComplex[EventFilter](ExtensionObjectDefinitionParseWithBufferProducer[EventFilter]((int32)(int32(727))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) + } + m.Filter = filter + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + readModified, err := ReadSimpleField(ctx, "readModified", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'readModified' field")) + } + m.ReadModified = readModified + + if closeErr := readBuffer.CloseContext("ReadEventDetails2"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadEventDetails2") + } + + return m, nil +} + +func (m *_ReadEventDetails2) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadEventDetails2) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadEventDetails2"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadEventDetails2") + } + + if err := WriteSimpleField[uint32](ctx, "numValuesPerNode", m.GetNumValuesPerNode(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'numValuesPerNode' field") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[int64](ctx, "endTime", m.GetEndTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'endTime' field") + } + + if err := WriteSimpleField[EventFilter](ctx, "filter", m.GetFilter(), WriteComplex[EventFilter](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'filter' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "readModified", m.GetReadModified(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'readModified' field") + } + + if popErr := writeBuffer.PopContext("ReadEventDetails2"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadEventDetails2") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadEventDetails2) IsReadEventDetails2() {} + +func (m *_ReadEventDetails2) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadEventDetails2) deepCopy() *_ReadEventDetails2 { + if m == nil { + return nil + } + _ReadEventDetails2Copy := &_ReadEventDetails2{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NumValuesPerNode, + m.StartTime, + m.EndTime, + m.Filter.DeepCopy().(EventFilter), + m.ReadModified, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadEventDetails2Copy +} + +func (m *_ReadEventDetails2) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadProcessedDetails.go b/plc4go/protocols/opcua/readwrite/model/ReadProcessedDetails.go new file mode 100644 index 00000000000..9107be48a70 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadProcessedDetails.go @@ -0,0 +1,466 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadProcessedDetails is the corresponding interface of ReadProcessedDetails +type ReadProcessedDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetEndTime returns EndTime (property field) + GetEndTime() int64 + // GetProcessingInterval returns ProcessingInterval (property field) + GetProcessingInterval() float64 + // GetAggregateType returns AggregateType (property field) + GetAggregateType() []NodeId + // GetAggregateConfiguration returns AggregateConfiguration (property field) + GetAggregateConfiguration() AggregateConfiguration + // IsReadProcessedDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadProcessedDetails() + // CreateBuilder creates a ReadProcessedDetailsBuilder + CreateReadProcessedDetailsBuilder() ReadProcessedDetailsBuilder +} + +// _ReadProcessedDetails is the data-structure of this message +type _ReadProcessedDetails struct { + ExtensionObjectDefinitionContract + StartTime int64 + EndTime int64 + ProcessingInterval float64 + AggregateType []NodeId + AggregateConfiguration AggregateConfiguration +} + +var _ ReadProcessedDetails = (*_ReadProcessedDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadProcessedDetails)(nil) + +// NewReadProcessedDetails factory function for _ReadProcessedDetails +func NewReadProcessedDetails(startTime int64, endTime int64, processingInterval float64, aggregateType []NodeId, aggregateConfiguration AggregateConfiguration) *_ReadProcessedDetails { + if aggregateConfiguration == nil { + panic("aggregateConfiguration of type AggregateConfiguration for ReadProcessedDetails must not be nil") + } + _result := &_ReadProcessedDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + StartTime: startTime, + EndTime: endTime, + ProcessingInterval: processingInterval, + AggregateType: aggregateType, + AggregateConfiguration: aggregateConfiguration, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadProcessedDetailsBuilder is a builder for ReadProcessedDetails +type ReadProcessedDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(startTime int64, endTime int64, processingInterval float64, aggregateType []NodeId, aggregateConfiguration AggregateConfiguration) ReadProcessedDetailsBuilder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) ReadProcessedDetailsBuilder + // WithEndTime adds EndTime (property field) + WithEndTime(int64) ReadProcessedDetailsBuilder + // WithProcessingInterval adds ProcessingInterval (property field) + WithProcessingInterval(float64) ReadProcessedDetailsBuilder + // WithAggregateType adds AggregateType (property field) + WithAggregateType(...NodeId) ReadProcessedDetailsBuilder + // WithAggregateConfiguration adds AggregateConfiguration (property field) + WithAggregateConfiguration(AggregateConfiguration) ReadProcessedDetailsBuilder + // WithAggregateConfigurationBuilder adds AggregateConfiguration (property field) which is build by the builder + WithAggregateConfigurationBuilder(func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) ReadProcessedDetailsBuilder + // Build builds the ReadProcessedDetails or returns an error if something is wrong + Build() (ReadProcessedDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadProcessedDetails +} + +// NewReadProcessedDetailsBuilder() creates a ReadProcessedDetailsBuilder +func NewReadProcessedDetailsBuilder() ReadProcessedDetailsBuilder { + return &_ReadProcessedDetailsBuilder{_ReadProcessedDetails: new(_ReadProcessedDetails)} +} + +type _ReadProcessedDetailsBuilder struct { + *_ReadProcessedDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadProcessedDetailsBuilder) = (*_ReadProcessedDetailsBuilder)(nil) + +func (b *_ReadProcessedDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadProcessedDetailsBuilder) WithMandatoryFields(startTime int64, endTime int64, processingInterval float64, aggregateType []NodeId, aggregateConfiguration AggregateConfiguration) ReadProcessedDetailsBuilder { + return b.WithStartTime(startTime).WithEndTime(endTime).WithProcessingInterval(processingInterval).WithAggregateType(aggregateType...).WithAggregateConfiguration(aggregateConfiguration) +} + +func (b *_ReadProcessedDetailsBuilder) WithStartTime(startTime int64) ReadProcessedDetailsBuilder { + b.StartTime = startTime + return b +} + +func (b *_ReadProcessedDetailsBuilder) WithEndTime(endTime int64) ReadProcessedDetailsBuilder { + b.EndTime = endTime + return b +} + +func (b *_ReadProcessedDetailsBuilder) WithProcessingInterval(processingInterval float64) ReadProcessedDetailsBuilder { + b.ProcessingInterval = processingInterval + return b +} + +func (b *_ReadProcessedDetailsBuilder) WithAggregateType(aggregateType ...NodeId) ReadProcessedDetailsBuilder { + b.AggregateType = aggregateType + return b +} + +func (b *_ReadProcessedDetailsBuilder) WithAggregateConfiguration(aggregateConfiguration AggregateConfiguration) ReadProcessedDetailsBuilder { + b.AggregateConfiguration = aggregateConfiguration + return b +} + +func (b *_ReadProcessedDetailsBuilder) WithAggregateConfigurationBuilder(builderSupplier func(AggregateConfigurationBuilder) AggregateConfigurationBuilder) ReadProcessedDetailsBuilder { + builder := builderSupplier(b.AggregateConfiguration.CreateAggregateConfigurationBuilder()) + var err error + b.AggregateConfiguration, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "AggregateConfigurationBuilder failed")) + } + return b +} + +func (b *_ReadProcessedDetailsBuilder) Build() (ReadProcessedDetails, error) { + if b.AggregateConfiguration == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'aggregateConfiguration' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadProcessedDetails.deepCopy(), nil +} + +func (b *_ReadProcessedDetailsBuilder) MustBuild() ReadProcessedDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadProcessedDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadProcessedDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadProcessedDetailsBuilder) DeepCopy() any { + _copy := b.CreateReadProcessedDetailsBuilder().(*_ReadProcessedDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadProcessedDetailsBuilder creates a ReadProcessedDetailsBuilder +func (b *_ReadProcessedDetails) CreateReadProcessedDetailsBuilder() ReadProcessedDetailsBuilder { + if b == nil { + return NewReadProcessedDetailsBuilder() + } + return &_ReadProcessedDetailsBuilder{_ReadProcessedDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadProcessedDetails) GetExtensionId() int32 { + return int32(652) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadProcessedDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadProcessedDetails) GetStartTime() int64 { + return m.StartTime +} + +func (m *_ReadProcessedDetails) GetEndTime() int64 { + return m.EndTime +} + +func (m *_ReadProcessedDetails) GetProcessingInterval() float64 { + return m.ProcessingInterval +} + +func (m *_ReadProcessedDetails) GetAggregateType() []NodeId { + return m.AggregateType +} + +func (m *_ReadProcessedDetails) GetAggregateConfiguration() AggregateConfiguration { + return m.AggregateConfiguration +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadProcessedDetails(structType any) ReadProcessedDetails { + if casted, ok := structType.(ReadProcessedDetails); ok { + return casted + } + if casted, ok := structType.(*ReadProcessedDetails); ok { + return *casted + } + return nil +} + +func (m *_ReadProcessedDetails) GetTypeName() string { + return "ReadProcessedDetails" +} + +func (m *_ReadProcessedDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (endTime) + lengthInBits += 64 + + // Simple field (processingInterval) + lengthInBits += 64 + + // Implicit Field (noOfAggregateType) + lengthInBits += 32 + + // Array field + if len(m.AggregateType) > 0 { + for _curItem, element := range m.AggregateType { + arrayCtx := utils.CreateArrayContext(ctx, len(m.AggregateType), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (aggregateConfiguration) + lengthInBits += m.AggregateConfiguration.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_ReadProcessedDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadProcessedDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readProcessedDetails ReadProcessedDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadProcessedDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadProcessedDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + endTime, err := ReadSimpleField(ctx, "endTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endTime' field")) + } + m.EndTime = endTime + + processingInterval, err := ReadSimpleField(ctx, "processingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'processingInterval' field")) + } + m.ProcessingInterval = processingInterval + + noOfAggregateType, err := ReadImplicitField[int32](ctx, "noOfAggregateType", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAggregateType' field")) + } + _ = noOfAggregateType + + aggregateType, err := ReadCountArrayField[NodeId](ctx, "aggregateType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer), uint64(noOfAggregateType)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'aggregateType' field")) + } + m.AggregateType = aggregateType + + aggregateConfiguration, err := ReadSimpleField[AggregateConfiguration](ctx, "aggregateConfiguration", ReadComplex[AggregateConfiguration](ExtensionObjectDefinitionParseWithBufferProducer[AggregateConfiguration]((int32)(int32(950))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'aggregateConfiguration' field")) + } + m.AggregateConfiguration = aggregateConfiguration + + if closeErr := readBuffer.CloseContext("ReadProcessedDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadProcessedDetails") + } + + return m, nil +} + +func (m *_ReadProcessedDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadProcessedDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadProcessedDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadProcessedDetails") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[int64](ctx, "endTime", m.GetEndTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'endTime' field") + } + + if err := WriteSimpleField[float64](ctx, "processingInterval", m.GetProcessingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'processingInterval' field") + } + noOfAggregateType := int32(utils.InlineIf(bool((m.GetAggregateType()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAggregateType()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAggregateType", noOfAggregateType, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfAggregateType' field") + } + + if err := WriteComplexTypeArrayField(ctx, "aggregateType", m.GetAggregateType(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'aggregateType' field") + } + + if err := WriteSimpleField[AggregateConfiguration](ctx, "aggregateConfiguration", m.GetAggregateConfiguration(), WriteComplex[AggregateConfiguration](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'aggregateConfiguration' field") + } + + if popErr := writeBuffer.PopContext("ReadProcessedDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadProcessedDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadProcessedDetails) IsReadProcessedDetails() {} + +func (m *_ReadProcessedDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadProcessedDetails) deepCopy() *_ReadProcessedDetails { + if m == nil { + return nil + } + _ReadProcessedDetailsCopy := &_ReadProcessedDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.StartTime, + m.EndTime, + m.ProcessingInterval, + utils.DeepCopySlice[NodeId, NodeId](m.AggregateType), + m.AggregateConfiguration.DeepCopy().(AggregateConfiguration), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadProcessedDetailsCopy +} + +func (m *_ReadProcessedDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadRawModifiedDetails.go b/plc4go/protocols/opcua/readwrite/model/ReadRawModifiedDetails.go new file mode 100644 index 00000000000..b1a6d648b06 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReadRawModifiedDetails.go @@ -0,0 +1,453 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReadRawModifiedDetails is the corresponding interface of ReadRawModifiedDetails +type ReadRawModifiedDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetIsReadModified returns IsReadModified (property field) + GetIsReadModified() bool + // GetStartTime returns StartTime (property field) + GetStartTime() int64 + // GetEndTime returns EndTime (property field) + GetEndTime() int64 + // GetNumValuesPerNode returns NumValuesPerNode (property field) + GetNumValuesPerNode() uint32 + // GetReturnBounds returns ReturnBounds (property field) + GetReturnBounds() bool + // IsReadRawModifiedDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReadRawModifiedDetails() + // CreateBuilder creates a ReadRawModifiedDetailsBuilder + CreateReadRawModifiedDetailsBuilder() ReadRawModifiedDetailsBuilder +} + +// _ReadRawModifiedDetails is the data-structure of this message +type _ReadRawModifiedDetails struct { + ExtensionObjectDefinitionContract + IsReadModified bool + StartTime int64 + EndTime int64 + NumValuesPerNode uint32 + ReturnBounds bool + // Reserved Fields + reservedField0 *uint8 + reservedField1 *uint8 +} + +var _ ReadRawModifiedDetails = (*_ReadRawModifiedDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReadRawModifiedDetails)(nil) + +// NewReadRawModifiedDetails factory function for _ReadRawModifiedDetails +func NewReadRawModifiedDetails(isReadModified bool, startTime int64, endTime int64, numValuesPerNode uint32, returnBounds bool) *_ReadRawModifiedDetails { + _result := &_ReadRawModifiedDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + IsReadModified: isReadModified, + StartTime: startTime, + EndTime: endTime, + NumValuesPerNode: numValuesPerNode, + ReturnBounds: returnBounds, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReadRawModifiedDetailsBuilder is a builder for ReadRawModifiedDetails +type ReadRawModifiedDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(isReadModified bool, startTime int64, endTime int64, numValuesPerNode uint32, returnBounds bool) ReadRawModifiedDetailsBuilder + // WithIsReadModified adds IsReadModified (property field) + WithIsReadModified(bool) ReadRawModifiedDetailsBuilder + // WithStartTime adds StartTime (property field) + WithStartTime(int64) ReadRawModifiedDetailsBuilder + // WithEndTime adds EndTime (property field) + WithEndTime(int64) ReadRawModifiedDetailsBuilder + // WithNumValuesPerNode adds NumValuesPerNode (property field) + WithNumValuesPerNode(uint32) ReadRawModifiedDetailsBuilder + // WithReturnBounds adds ReturnBounds (property field) + WithReturnBounds(bool) ReadRawModifiedDetailsBuilder + // Build builds the ReadRawModifiedDetails or returns an error if something is wrong + Build() (ReadRawModifiedDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReadRawModifiedDetails +} + +// NewReadRawModifiedDetailsBuilder() creates a ReadRawModifiedDetailsBuilder +func NewReadRawModifiedDetailsBuilder() ReadRawModifiedDetailsBuilder { + return &_ReadRawModifiedDetailsBuilder{_ReadRawModifiedDetails: new(_ReadRawModifiedDetails)} +} + +type _ReadRawModifiedDetailsBuilder struct { + *_ReadRawModifiedDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReadRawModifiedDetailsBuilder) = (*_ReadRawModifiedDetailsBuilder)(nil) + +func (b *_ReadRawModifiedDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReadRawModifiedDetailsBuilder) WithMandatoryFields(isReadModified bool, startTime int64, endTime int64, numValuesPerNode uint32, returnBounds bool) ReadRawModifiedDetailsBuilder { + return b.WithIsReadModified(isReadModified).WithStartTime(startTime).WithEndTime(endTime).WithNumValuesPerNode(numValuesPerNode).WithReturnBounds(returnBounds) +} + +func (b *_ReadRawModifiedDetailsBuilder) WithIsReadModified(isReadModified bool) ReadRawModifiedDetailsBuilder { + b.IsReadModified = isReadModified + return b +} + +func (b *_ReadRawModifiedDetailsBuilder) WithStartTime(startTime int64) ReadRawModifiedDetailsBuilder { + b.StartTime = startTime + return b +} + +func (b *_ReadRawModifiedDetailsBuilder) WithEndTime(endTime int64) ReadRawModifiedDetailsBuilder { + b.EndTime = endTime + return b +} + +func (b *_ReadRawModifiedDetailsBuilder) WithNumValuesPerNode(numValuesPerNode uint32) ReadRawModifiedDetailsBuilder { + b.NumValuesPerNode = numValuesPerNode + return b +} + +func (b *_ReadRawModifiedDetailsBuilder) WithReturnBounds(returnBounds bool) ReadRawModifiedDetailsBuilder { + b.ReturnBounds = returnBounds + return b +} + +func (b *_ReadRawModifiedDetailsBuilder) Build() (ReadRawModifiedDetails, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReadRawModifiedDetails.deepCopy(), nil +} + +func (b *_ReadRawModifiedDetailsBuilder) MustBuild() ReadRawModifiedDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReadRawModifiedDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReadRawModifiedDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReadRawModifiedDetailsBuilder) DeepCopy() any { + _copy := b.CreateReadRawModifiedDetailsBuilder().(*_ReadRawModifiedDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReadRawModifiedDetailsBuilder creates a ReadRawModifiedDetailsBuilder +func (b *_ReadRawModifiedDetails) CreateReadRawModifiedDetailsBuilder() ReadRawModifiedDetailsBuilder { + if b == nil { + return NewReadRawModifiedDetailsBuilder() + } + return &_ReadRawModifiedDetailsBuilder{_ReadRawModifiedDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReadRawModifiedDetails) GetExtensionId() int32 { + return int32(649) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReadRawModifiedDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReadRawModifiedDetails) GetIsReadModified() bool { + return m.IsReadModified +} + +func (m *_ReadRawModifiedDetails) GetStartTime() int64 { + return m.StartTime +} + +func (m *_ReadRawModifiedDetails) GetEndTime() int64 { + return m.EndTime +} + +func (m *_ReadRawModifiedDetails) GetNumValuesPerNode() uint32 { + return m.NumValuesPerNode +} + +func (m *_ReadRawModifiedDetails) GetReturnBounds() bool { + return m.ReturnBounds +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReadRawModifiedDetails(structType any) ReadRawModifiedDetails { + if casted, ok := structType.(ReadRawModifiedDetails); ok { + return casted + } + if casted, ok := structType.(*ReadRawModifiedDetails); ok { + return *casted + } + return nil +} + +func (m *_ReadRawModifiedDetails) GetTypeName() string { + return "ReadRawModifiedDetails" +} + +func (m *_ReadRawModifiedDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (isReadModified) + lengthInBits += 1 + + // Simple field (startTime) + lengthInBits += 64 + + // Simple field (endTime) + lengthInBits += 64 + + // Simple field (numValuesPerNode) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (returnBounds) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_ReadRawModifiedDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReadRawModifiedDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readRawModifiedDetails ReadRawModifiedDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReadRawModifiedDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReadRawModifiedDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + isReadModified, err := ReadSimpleField(ctx, "isReadModified", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isReadModified' field")) + } + m.IsReadModified = isReadModified + + startTime, err := ReadSimpleField(ctx, "startTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'startTime' field")) + } + m.StartTime = startTime + + endTime, err := ReadSimpleField(ctx, "endTime", ReadSignedLong(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'endTime' field")) + } + m.EndTime = endTime + + numValuesPerNode, err := ReadSimpleField(ctx, "numValuesPerNode", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'numValuesPerNode' field")) + } + m.NumValuesPerNode = numValuesPerNode + + reservedField1, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField1 = reservedField1 + + returnBounds, err := ReadSimpleField(ctx, "returnBounds", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'returnBounds' field")) + } + m.ReturnBounds = returnBounds + + if closeErr := readBuffer.CloseContext("ReadRawModifiedDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReadRawModifiedDetails") + } + + return m, nil +} + +func (m *_ReadRawModifiedDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReadRawModifiedDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReadRawModifiedDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReadRawModifiedDetails") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "isReadModified", m.GetIsReadModified(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isReadModified' field") + } + + if err := WriteSimpleField[int64](ctx, "startTime", m.GetStartTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'startTime' field") + } + + if err := WriteSimpleField[int64](ctx, "endTime", m.GetEndTime(), WriteSignedLong(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'endTime' field") + } + + if err := WriteSimpleField[uint32](ctx, "numValuesPerNode", m.GetNumValuesPerNode(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'numValuesPerNode' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 2") + } + + if err := WriteSimpleField[bool](ctx, "returnBounds", m.GetReturnBounds(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'returnBounds' field") + } + + if popErr := writeBuffer.PopContext("ReadRawModifiedDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReadRawModifiedDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReadRawModifiedDetails) IsReadRawModifiedDetails() {} + +func (m *_ReadRawModifiedDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReadRawModifiedDetails) deepCopy() *_ReadRawModifiedDetails { + if m == nil { + return nil + } + _ReadRawModifiedDetailsCopy := &_ReadRawModifiedDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.IsReadModified, + m.StartTime, + m.EndTime, + m.NumValuesPerNode, + m.ReturnBounds, + m.reservedField0, + m.reservedField1, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReadRawModifiedDetailsCopy +} + +func (m *_ReadRawModifiedDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReadRequest.go b/plc4go/protocols/opcua/readwrite/model/ReadRequest.go index e97a00b8ebc..8d0295f1436 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReadRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/ReadRequest.go @@ -41,15 +41,13 @@ type ReadRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetMaxAge returns MaxAge (property field) GetMaxAge() float64 // GetTimestampsToReturn returns TimestampsToReturn (property field) GetTimestampsToReturn() TimestampsToReturn - // GetNoOfNodesToRead returns NoOfNodesToRead (property field) - GetNoOfNodesToRead() int32 // GetNodesToRead returns NodesToRead (property field) - GetNodesToRead() []ExtensionObjectDefinition + GetNodesToRead() []ReadValueId // IsReadRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsReadRequest() // CreateBuilder creates a ReadRequestBuilder @@ -59,27 +57,25 @@ type ReadRequest interface { // _ReadRequest is the data-structure of this message type _ReadRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader MaxAge float64 TimestampsToReturn TimestampsToReturn - NoOfNodesToRead int32 - NodesToRead []ExtensionObjectDefinition + NodesToRead []ReadValueId } var _ ReadRequest = (*_ReadRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ReadRequest)(nil) // NewReadRequest factory function for _ReadRequest -func NewReadRequest(requestHeader ExtensionObjectDefinition, maxAge float64, timestampsToReturn TimestampsToReturn, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) *_ReadRequest { +func NewReadRequest(requestHeader RequestHeader, maxAge float64, timestampsToReturn TimestampsToReturn, nodesToRead []ReadValueId) *_ReadRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for ReadRequest must not be nil") + panic("requestHeader of type RequestHeader for ReadRequest must not be nil") } _result := &_ReadRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, MaxAge: maxAge, TimestampsToReturn: timestampsToReturn, - NoOfNodesToRead: noOfNodesToRead, NodesToRead: nodesToRead, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,19 +91,17 @@ func NewReadRequest(requestHeader ExtensionObjectDefinition, maxAge float64, tim type ReadRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, maxAge float64, timestampsToReturn TimestampsToReturn, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) ReadRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, maxAge float64, timestampsToReturn TimestampsToReturn, nodesToRead []ReadValueId) ReadRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) ReadRequestBuilder + WithRequestHeader(RequestHeader) ReadRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ReadRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) ReadRequestBuilder // WithMaxAge adds MaxAge (property field) WithMaxAge(float64) ReadRequestBuilder // WithTimestampsToReturn adds TimestampsToReturn (property field) WithTimestampsToReturn(TimestampsToReturn) ReadRequestBuilder - // WithNoOfNodesToRead adds NoOfNodesToRead (property field) - WithNoOfNodesToRead(int32) ReadRequestBuilder // WithNodesToRead adds NodesToRead (property field) - WithNodesToRead(...ExtensionObjectDefinition) ReadRequestBuilder + WithNodesToRead(...ReadValueId) ReadRequestBuilder // Build builds the ReadRequest or returns an error if something is wrong Build() (ReadRequest, error) // MustBuild does the same as Build but panics on error @@ -133,24 +127,24 @@ func (b *_ReadRequestBuilder) setParent(contract ExtensionObjectDefinitionContra b.ExtensionObjectDefinitionContract = contract } -func (b *_ReadRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, maxAge float64, timestampsToReturn TimestampsToReturn, noOfNodesToRead int32, nodesToRead []ExtensionObjectDefinition) ReadRequestBuilder { - return b.WithRequestHeader(requestHeader).WithMaxAge(maxAge).WithTimestampsToReturn(timestampsToReturn).WithNoOfNodesToRead(noOfNodesToRead).WithNodesToRead(nodesToRead...) +func (b *_ReadRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, maxAge float64, timestampsToReturn TimestampsToReturn, nodesToRead []ReadValueId) ReadRequestBuilder { + return b.WithRequestHeader(requestHeader).WithMaxAge(maxAge).WithTimestampsToReturn(timestampsToReturn).WithNodesToRead(nodesToRead...) } -func (b *_ReadRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) ReadRequestBuilder { +func (b *_ReadRequestBuilder) WithRequestHeader(requestHeader RequestHeader) ReadRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_ReadRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ReadRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ReadRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) ReadRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -165,12 +159,7 @@ func (b *_ReadRequestBuilder) WithTimestampsToReturn(timestampsToReturn Timestam return b } -func (b *_ReadRequestBuilder) WithNoOfNodesToRead(noOfNodesToRead int32) ReadRequestBuilder { - b.NoOfNodesToRead = noOfNodesToRead - return b -} - -func (b *_ReadRequestBuilder) WithNodesToRead(nodesToRead ...ExtensionObjectDefinition) ReadRequestBuilder { +func (b *_ReadRequestBuilder) WithNodesToRead(nodesToRead ...ReadValueId) ReadRequestBuilder { b.NodesToRead = nodesToRead return b } @@ -231,8 +220,8 @@ func (b *_ReadRequest) CreateReadRequestBuilder() ReadRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReadRequest) GetIdentifier() string { - return "631" +func (m *_ReadRequest) GetExtensionId() int32 { + return int32(631) } /////////////////////// @@ -249,7 +238,7 @@ func (m *_ReadRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ReadRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_ReadRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -261,11 +250,7 @@ func (m *_ReadRequest) GetTimestampsToReturn() TimestampsToReturn { return m.TimestampsToReturn } -func (m *_ReadRequest) GetNoOfNodesToRead() int32 { - return m.NoOfNodesToRead -} - -func (m *_ReadRequest) GetNodesToRead() []ExtensionObjectDefinition { +func (m *_ReadRequest) GetNodesToRead() []ReadValueId { return m.NodesToRead } @@ -301,7 +286,7 @@ func (m *_ReadRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (timestampsToReturn) lengthInBits += 32 - // Simple field (noOfNodesToRead) + // Implicit Field (noOfNodesToRead) lengthInBits += 32 // Array field @@ -321,7 +306,7 @@ func (m *_ReadRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__readRequest ReadRequest, err error) { +func (m *_ReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readRequest ReadRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -332,7 +317,7 @@ func (m *_ReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, p currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -350,13 +335,13 @@ func (m *_ReadRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, p } m.TimestampsToReturn = timestampsToReturn - noOfNodesToRead, err := ReadSimpleField(ctx, "noOfNodesToRead", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToRead, err := ReadImplicitField[int32](ctx, "noOfNodesToRead", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToRead' field")) } - m.NoOfNodesToRead = noOfNodesToRead + _ = noOfNodesToRead - nodesToRead, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToRead", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("628")), readBuffer), uint64(noOfNodesToRead)) + nodesToRead, err := ReadCountArrayField[ReadValueId](ctx, "nodesToRead", ReadComplex[ReadValueId](ExtensionObjectDefinitionParseWithBufferProducer[ReadValueId]((int32)(int32(628))), readBuffer), uint64(noOfNodesToRead)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToRead' field")) } @@ -387,7 +372,7 @@ func (m *_ReadRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuffer return errors.Wrap(pushErr, "Error pushing for ReadRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -398,8 +383,8 @@ func (m *_ReadRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuffer if err := WriteSimpleEnumField[TimestampsToReturn](ctx, "timestampsToReturn", "TimestampsToReturn", m.GetTimestampsToReturn(), WriteEnum[TimestampsToReturn, uint32](TimestampsToReturn.GetValue, TimestampsToReturn.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'timestampsToReturn' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToRead", m.GetNoOfNodesToRead(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToRead := int32(utils.InlineIf(bool((m.GetNodesToRead()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToRead()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToRead", noOfNodesToRead, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToRead' field") } @@ -427,11 +412,10 @@ func (m *_ReadRequest) deepCopy() *_ReadRequest { } _ReadRequestCopy := &_ReadRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.MaxAge, m.TimestampsToReturn, - m.NoOfNodesToRead, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToRead), + utils.DeepCopySlice[ReadValueId, ReadValueId](m.NodesToRead), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ReadRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/ReadResponse.go b/plc4go/protocols/opcua/readwrite/model/ReadResponse.go index 6da9ad9bfa4..647d330772e 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReadResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/ReadResponse.go @@ -41,13 +41,9 @@ type ReadResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []DataValue - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsReadResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type ReadResponse interface { // _ReadResponse is the data-structure of this message type _ReadResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []DataValue - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []DataValue + DiagnosticInfos []DiagnosticInfo } var _ ReadResponse = (*_ReadResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ReadResponse)(nil) // NewReadResponse factory function for _ReadResponse -func NewReadResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []DataValue, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_ReadResponse { +func NewReadResponse(responseHeader ResponseHeader, results []DataValue, diagnosticInfos []DiagnosticInfo) *_ReadResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for ReadResponse must not be nil") + panic("responseHeader of type ResponseHeader for ReadResponse must not be nil") } _result := &_ReadResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewReadResponse(responseHeader ExtensionObjectDefinition, noOfResults int32 type ReadResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []DataValue, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ReadResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []DataValue, diagnosticInfos []DiagnosticInfo) ReadResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) ReadResponseBuilder + WithResponseHeader(ResponseHeader) ReadResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ReadResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) ReadResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) ReadResponseBuilder // WithResults adds Results (property field) WithResults(...DataValue) ReadResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) ReadResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) ReadResponseBuilder // Build builds the ReadResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_ReadResponseBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_ReadResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []DataValue, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) ReadResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_ReadResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []DataValue, diagnosticInfos []DiagnosticInfo) ReadResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_ReadResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) ReadResponseBuilder { +func (b *_ReadResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) ReadResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_ReadResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ReadResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ReadResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) ReadResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_ReadResponseBuilder) WithNoOfResults(noOfResults int32) ReadResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_ReadResponseBuilder) WithResults(results ...DataValue) ReadResponseBuilder { b.Results = results return b } -func (b *_ReadResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) ReadResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_ReadResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) ReadResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_ReadResponse) CreateReadResponseBuilder() ReadResponseBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReadResponse) GetIdentifier() string { - return "634" +func (m *_ReadResponse) GetExtensionId() int32 { + return int32(634) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_ReadResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ReadResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_ReadResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_ReadResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_ReadResponse) GetResults() []DataValue { return m.Results } -func (m *_ReadResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_ReadResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_ReadResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_ReadResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_ReadResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__readResponse ReadResponse, err error) { +func (m *_ReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readResponse ReadResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_ReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[DataValue](ctx, "results", ReadComplex[DataValue](DataValueParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_ReadResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_ReadResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuffe return errors.Wrap(pushErr, "Error pushing for ReadResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_ReadResponse) deepCopy() *_ReadResponse { } _ReadResponseCopy := &_ReadResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[DataValue, DataValue](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/ReadValueId.go b/plc4go/protocols/opcua/readwrite/model/ReadValueId.go index 82c7914f04a..34b75b91026 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReadValueId.go +++ b/plc4go/protocols/opcua/readwrite/model/ReadValueId.go @@ -268,8 +268,8 @@ func (b *_ReadValueId) CreateReadValueIdBuilder() ReadValueIdBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReadValueId) GetIdentifier() string { - return "628" +func (m *_ReadValueId) GetExtensionId() int32 { + return int32(628) } /////////////////////// @@ -344,7 +344,7 @@ func (m *_ReadValueId) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ReadValueId) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__readValueId ReadValueId, err error) { +func (m *_ReadValueId) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readValueId ReadValueId, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReaderGroupDataType.go b/plc4go/protocols/opcua/readwrite/model/ReaderGroupDataType.go new file mode 100644 index 00000000000..34fb6846d03 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReaderGroupDataType.go @@ -0,0 +1,739 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReaderGroupDataType is the corresponding interface of ReaderGroupDataType +type ReaderGroupDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetName returns Name (property field) + GetName() PascalString + // GetEnabled returns Enabled (property field) + GetEnabled() bool + // GetSecurityMode returns SecurityMode (property field) + GetSecurityMode() MessageSecurityMode + // GetSecurityGroupId returns SecurityGroupId (property field) + GetSecurityGroupId() PascalString + // GetSecurityKeyServices returns SecurityKeyServices (property field) + GetSecurityKeyServices() []EndpointDescription + // GetMaxNetworkMessageSize returns MaxNetworkMessageSize (property field) + GetMaxNetworkMessageSize() uint32 + // GetGroupProperties returns GroupProperties (property field) + GetGroupProperties() []KeyValuePair + // GetTransportSettings returns TransportSettings (property field) + GetTransportSettings() ExtensionObject + // GetMessageSettings returns MessageSettings (property field) + GetMessageSettings() ExtensionObject + // GetDataSetReaders returns DataSetReaders (property field) + GetDataSetReaders() []DataSetReaderDataType + // IsReaderGroupDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReaderGroupDataType() + // CreateBuilder creates a ReaderGroupDataTypeBuilder + CreateReaderGroupDataTypeBuilder() ReaderGroupDataTypeBuilder +} + +// _ReaderGroupDataType is the data-structure of this message +type _ReaderGroupDataType struct { + ExtensionObjectDefinitionContract + Name PascalString + Enabled bool + SecurityMode MessageSecurityMode + SecurityGroupId PascalString + SecurityKeyServices []EndpointDescription + MaxNetworkMessageSize uint32 + GroupProperties []KeyValuePair + TransportSettings ExtensionObject + MessageSettings ExtensionObject + DataSetReaders []DataSetReaderDataType + // Reserved Fields + reservedField0 *uint8 +} + +var _ ReaderGroupDataType = (*_ReaderGroupDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReaderGroupDataType)(nil) + +// NewReaderGroupDataType factory function for _ReaderGroupDataType +func NewReaderGroupDataType(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetReaders []DataSetReaderDataType) *_ReaderGroupDataType { + if name == nil { + panic("name of type PascalString for ReaderGroupDataType must not be nil") + } + if securityGroupId == nil { + panic("securityGroupId of type PascalString for ReaderGroupDataType must not be nil") + } + if transportSettings == nil { + panic("transportSettings of type ExtensionObject for ReaderGroupDataType must not be nil") + } + if messageSettings == nil { + panic("messageSettings of type ExtensionObject for ReaderGroupDataType must not be nil") + } + _result := &_ReaderGroupDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Name: name, + Enabled: enabled, + SecurityMode: securityMode, + SecurityGroupId: securityGroupId, + SecurityKeyServices: securityKeyServices, + MaxNetworkMessageSize: maxNetworkMessageSize, + GroupProperties: groupProperties, + TransportSettings: transportSettings, + MessageSettings: messageSettings, + DataSetReaders: dataSetReaders, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReaderGroupDataTypeBuilder is a builder for ReaderGroupDataType +type ReaderGroupDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetReaders []DataSetReaderDataType) ReaderGroupDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) ReaderGroupDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) ReaderGroupDataTypeBuilder + // WithEnabled adds Enabled (property field) + WithEnabled(bool) ReaderGroupDataTypeBuilder + // WithSecurityMode adds SecurityMode (property field) + WithSecurityMode(MessageSecurityMode) ReaderGroupDataTypeBuilder + // WithSecurityGroupId adds SecurityGroupId (property field) + WithSecurityGroupId(PascalString) ReaderGroupDataTypeBuilder + // WithSecurityGroupIdBuilder adds SecurityGroupId (property field) which is build by the builder + WithSecurityGroupIdBuilder(func(PascalStringBuilder) PascalStringBuilder) ReaderGroupDataTypeBuilder + // WithSecurityKeyServices adds SecurityKeyServices (property field) + WithSecurityKeyServices(...EndpointDescription) ReaderGroupDataTypeBuilder + // WithMaxNetworkMessageSize adds MaxNetworkMessageSize (property field) + WithMaxNetworkMessageSize(uint32) ReaderGroupDataTypeBuilder + // WithGroupProperties adds GroupProperties (property field) + WithGroupProperties(...KeyValuePair) ReaderGroupDataTypeBuilder + // WithTransportSettings adds TransportSettings (property field) + WithTransportSettings(ExtensionObject) ReaderGroupDataTypeBuilder + // WithTransportSettingsBuilder adds TransportSettings (property field) which is build by the builder + WithTransportSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) ReaderGroupDataTypeBuilder + // WithMessageSettings adds MessageSettings (property field) + WithMessageSettings(ExtensionObject) ReaderGroupDataTypeBuilder + // WithMessageSettingsBuilder adds MessageSettings (property field) which is build by the builder + WithMessageSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) ReaderGroupDataTypeBuilder + // WithDataSetReaders adds DataSetReaders (property field) + WithDataSetReaders(...DataSetReaderDataType) ReaderGroupDataTypeBuilder + // Build builds the ReaderGroupDataType or returns an error if something is wrong + Build() (ReaderGroupDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReaderGroupDataType +} + +// NewReaderGroupDataTypeBuilder() creates a ReaderGroupDataTypeBuilder +func NewReaderGroupDataTypeBuilder() ReaderGroupDataTypeBuilder { + return &_ReaderGroupDataTypeBuilder{_ReaderGroupDataType: new(_ReaderGroupDataType)} +} + +type _ReaderGroupDataTypeBuilder struct { + *_ReaderGroupDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReaderGroupDataTypeBuilder) = (*_ReaderGroupDataTypeBuilder)(nil) + +func (b *_ReaderGroupDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReaderGroupDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetReaders []DataSetReaderDataType) ReaderGroupDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithSecurityMode(securityMode).WithSecurityGroupId(securityGroupId).WithSecurityKeyServices(securityKeyServices...).WithMaxNetworkMessageSize(maxNetworkMessageSize).WithGroupProperties(groupProperties...).WithTransportSettings(transportSettings).WithMessageSettings(messageSettings).WithDataSetReaders(dataSetReaders...) +} + +func (b *_ReaderGroupDataTypeBuilder) WithName(name PascalString) ReaderGroupDataTypeBuilder { + b.Name = name + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) ReaderGroupDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithEnabled(enabled bool) ReaderGroupDataTypeBuilder { + b.Enabled = enabled + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithSecurityMode(securityMode MessageSecurityMode) ReaderGroupDataTypeBuilder { + b.SecurityMode = securityMode + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithSecurityGroupId(securityGroupId PascalString) ReaderGroupDataTypeBuilder { + b.SecurityGroupId = securityGroupId + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithSecurityGroupIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) ReaderGroupDataTypeBuilder { + builder := builderSupplier(b.SecurityGroupId.CreatePascalStringBuilder()) + var err error + b.SecurityGroupId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithSecurityKeyServices(securityKeyServices ...EndpointDescription) ReaderGroupDataTypeBuilder { + b.SecurityKeyServices = securityKeyServices + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithMaxNetworkMessageSize(maxNetworkMessageSize uint32) ReaderGroupDataTypeBuilder { + b.MaxNetworkMessageSize = maxNetworkMessageSize + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithGroupProperties(groupProperties ...KeyValuePair) ReaderGroupDataTypeBuilder { + b.GroupProperties = groupProperties + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithTransportSettings(transportSettings ExtensionObject) ReaderGroupDataTypeBuilder { + b.TransportSettings = transportSettings + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithTransportSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) ReaderGroupDataTypeBuilder { + builder := builderSupplier(b.TransportSettings.CreateExtensionObjectBuilder()) + var err error + b.TransportSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithMessageSettings(messageSettings ExtensionObject) ReaderGroupDataTypeBuilder { + b.MessageSettings = messageSettings + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithMessageSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) ReaderGroupDataTypeBuilder { + builder := builderSupplier(b.MessageSettings.CreateExtensionObjectBuilder()) + var err error + b.MessageSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_ReaderGroupDataTypeBuilder) WithDataSetReaders(dataSetReaders ...DataSetReaderDataType) ReaderGroupDataTypeBuilder { + b.DataSetReaders = dataSetReaders + return b +} + +func (b *_ReaderGroupDataTypeBuilder) Build() (ReaderGroupDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.SecurityGroupId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'securityGroupId' not set")) + } + if b.TransportSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'transportSettings' not set")) + } + if b.MessageSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'messageSettings' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReaderGroupDataType.deepCopy(), nil +} + +func (b *_ReaderGroupDataTypeBuilder) MustBuild() ReaderGroupDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReaderGroupDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReaderGroupDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReaderGroupDataTypeBuilder) DeepCopy() any { + _copy := b.CreateReaderGroupDataTypeBuilder().(*_ReaderGroupDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReaderGroupDataTypeBuilder creates a ReaderGroupDataTypeBuilder +func (b *_ReaderGroupDataType) CreateReaderGroupDataTypeBuilder() ReaderGroupDataTypeBuilder { + if b == nil { + return NewReaderGroupDataTypeBuilder() + } + return &_ReaderGroupDataTypeBuilder{_ReaderGroupDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReaderGroupDataType) GetExtensionId() int32 { + return int32(15522) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReaderGroupDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReaderGroupDataType) GetName() PascalString { + return m.Name +} + +func (m *_ReaderGroupDataType) GetEnabled() bool { + return m.Enabled +} + +func (m *_ReaderGroupDataType) GetSecurityMode() MessageSecurityMode { + return m.SecurityMode +} + +func (m *_ReaderGroupDataType) GetSecurityGroupId() PascalString { + return m.SecurityGroupId +} + +func (m *_ReaderGroupDataType) GetSecurityKeyServices() []EndpointDescription { + return m.SecurityKeyServices +} + +func (m *_ReaderGroupDataType) GetMaxNetworkMessageSize() uint32 { + return m.MaxNetworkMessageSize +} + +func (m *_ReaderGroupDataType) GetGroupProperties() []KeyValuePair { + return m.GroupProperties +} + +func (m *_ReaderGroupDataType) GetTransportSettings() ExtensionObject { + return m.TransportSettings +} + +func (m *_ReaderGroupDataType) GetMessageSettings() ExtensionObject { + return m.MessageSettings +} + +func (m *_ReaderGroupDataType) GetDataSetReaders() []DataSetReaderDataType { + return m.DataSetReaders +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReaderGroupDataType(structType any) ReaderGroupDataType { + if casted, ok := structType.(ReaderGroupDataType); ok { + return casted + } + if casted, ok := structType.(*ReaderGroupDataType); ok { + return *casted + } + return nil +} + +func (m *_ReaderGroupDataType) GetTypeName() string { + return "ReaderGroupDataType" +} + +func (m *_ReaderGroupDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (enabled) + lengthInBits += 1 + + // Simple field (securityMode) + lengthInBits += 32 + + // Simple field (securityGroupId) + lengthInBits += m.SecurityGroupId.GetLengthInBits(ctx) + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32 + + // Array field + if len(m.SecurityKeyServices) > 0 { + for _curItem, element := range m.SecurityKeyServices { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SecurityKeyServices), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (maxNetworkMessageSize) + lengthInBits += 32 + + // Implicit Field (noOfGroupProperties) + lengthInBits += 32 + + // Array field + if len(m.GroupProperties) > 0 { + for _curItem, element := range m.GroupProperties { + arrayCtx := utils.CreateArrayContext(ctx, len(m.GroupProperties), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (transportSettings) + lengthInBits += m.TransportSettings.GetLengthInBits(ctx) + + // Simple field (messageSettings) + lengthInBits += m.MessageSettings.GetLengthInBits(ctx) + + // Implicit Field (noOfDataSetReaders) + lengthInBits += 32 + + // Array field + if len(m.DataSetReaders) > 0 { + for _curItem, element := range m.DataSetReaders { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetReaders), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_ReaderGroupDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReaderGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readerGroupDataType ReaderGroupDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReaderGroupDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReaderGroupDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + enabled, err := ReadSimpleField(ctx, "enabled", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enabled' field")) + } + m.Enabled = enabled + + securityMode, err := ReadEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", ReadEnum(MessageSecurityModeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityMode' field")) + } + m.SecurityMode = securityMode + + securityGroupId, err := ReadSimpleField[PascalString](ctx, "securityGroupId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityGroupId' field")) + } + m.SecurityGroupId = securityGroupId + + noOfSecurityKeyServices, err := ReadImplicitField[int32](ctx, "noOfSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityKeyServices' field")) + } + _ = noOfSecurityKeyServices + + securityKeyServices, err := ReadCountArrayField[EndpointDescription](ctx, "securityKeyServices", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfSecurityKeyServices)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityKeyServices' field")) + } + m.SecurityKeyServices = securityKeyServices + + maxNetworkMessageSize, err := ReadSimpleField(ctx, "maxNetworkMessageSize", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'maxNetworkMessageSize' field")) + } + m.MaxNetworkMessageSize = maxNetworkMessageSize + + noOfGroupProperties, err := ReadImplicitField[int32](ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfGroupProperties' field")) + } + _ = noOfGroupProperties + + groupProperties, err := ReadCountArrayField[KeyValuePair](ctx, "groupProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfGroupProperties)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupProperties' field")) + } + m.GroupProperties = groupProperties + + transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transportSettings' field")) + } + m.TransportSettings = transportSettings + + messageSettings, err := ReadSimpleField[ExtensionObject](ctx, "messageSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageSettings' field")) + } + m.MessageSettings = messageSettings + + noOfDataSetReaders, err := ReadImplicitField[int32](ctx, "noOfDataSetReaders", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetReaders' field")) + } + _ = noOfDataSetReaders + + dataSetReaders, err := ReadCountArrayField[DataSetReaderDataType](ctx, "dataSetReaders", ReadComplex[DataSetReaderDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetReaderDataType]((int32)(int32(15625))), readBuffer), uint64(noOfDataSetReaders)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetReaders' field")) + } + m.DataSetReaders = dataSetReaders + + if closeErr := readBuffer.CloseContext("ReaderGroupDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReaderGroupDataType") + } + + return m, nil +} + +func (m *_ReaderGroupDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReaderGroupDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReaderGroupDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReaderGroupDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "enabled", m.GetEnabled(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'enabled' field") + } + + if err := WriteSimpleEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", m.GetSecurityMode(), WriteEnum[MessageSecurityMode, uint32](MessageSecurityMode.GetValue, MessageSecurityMode.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'securityMode' field") + } + + if err := WriteSimpleField[PascalString](ctx, "securityGroupId", m.GetSecurityGroupId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'securityGroupId' field") + } + noOfSecurityKeyServices := int32(utils.InlineIf(bool((m.GetSecurityKeyServices()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityKeyServices()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityKeyServices", noOfSecurityKeyServices, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSecurityKeyServices' field") + } + + if err := WriteComplexTypeArrayField(ctx, "securityKeyServices", m.GetSecurityKeyServices(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'securityKeyServices' field") + } + + if err := WriteSimpleField[uint32](ctx, "maxNetworkMessageSize", m.GetMaxNetworkMessageSize(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'maxNetworkMessageSize' field") + } + noOfGroupProperties := int32(utils.InlineIf(bool((m.GetGroupProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetGroupProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfGroupProperties", noOfGroupProperties, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfGroupProperties' field") + } + + if err := WriteComplexTypeArrayField(ctx, "groupProperties", m.GetGroupProperties(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'groupProperties' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "transportSettings", m.GetTransportSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'transportSettings' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "messageSettings", m.GetMessageSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'messageSettings' field") + } + noOfDataSetReaders := int32(utils.InlineIf(bool((m.GetDataSetReaders()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetReaders()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetReaders", noOfDataSetReaders, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetReaders' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetReaders", m.GetDataSetReaders(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetReaders' field") + } + + if popErr := writeBuffer.PopContext("ReaderGroupDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReaderGroupDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReaderGroupDataType) IsReaderGroupDataType() {} + +func (m *_ReaderGroupDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReaderGroupDataType) deepCopy() *_ReaderGroupDataType { + if m == nil { + return nil + } + _ReaderGroupDataTypeCopy := &_ReaderGroupDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Name.DeepCopy().(PascalString), + m.Enabled, + m.SecurityMode, + m.SecurityGroupId.DeepCopy().(PascalString), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.SecurityKeyServices), + m.MaxNetworkMessageSize, + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.GroupProperties), + m.TransportSettings.DeepCopy().(ExtensionObject), + m.MessageSettings.DeepCopy().(ExtensionObject), + utils.DeepCopySlice[DataSetReaderDataType, DataSetReaderDataType](m.DataSetReaders), + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReaderGroupDataTypeCopy +} + +func (m *_ReaderGroupDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReaderGroupMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/ReaderGroupMessageDataType.go index 0b45de315dd..c60cd477750 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReaderGroupMessageDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ReaderGroupMessageDataType.go @@ -150,8 +150,8 @@ func (b *_ReaderGroupMessageDataType) CreateReaderGroupMessageDataTypeBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReaderGroupMessageDataType) GetIdentifier() string { - return "15624" +func (m *_ReaderGroupMessageDataType) GetExtensionId() int32 { + return int32(15624) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_ReaderGroupMessageDataType) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_ReaderGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__readerGroupMessageDataType ReaderGroupMessageDataType, err error) { +func (m *_ReaderGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readerGroupMessageDataType ReaderGroupMessageDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReaderGroupTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/ReaderGroupTransportDataType.go index 7a55ff181d0..d377c1a66eb 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReaderGroupTransportDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ReaderGroupTransportDataType.go @@ -150,8 +150,8 @@ func (b *_ReaderGroupTransportDataType) CreateReaderGroupTransportDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReaderGroupTransportDataType) GetIdentifier() string { - return "15623" +func (m *_ReaderGroupTransportDataType) GetExtensionId() int32 { + return int32(15623) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_ReaderGroupTransportDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_ReaderGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__readerGroupTransportDataType ReaderGroupTransportDataType, err error) { +func (m *_ReaderGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__readerGroupTransportDataType ReaderGroupTransportDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReceiveQosDataType.go b/plc4go/protocols/opcua/readwrite/model/ReceiveQosDataType.go new file mode 100644 index 00000000000..9b2831c8bd9 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReceiveQosDataType.go @@ -0,0 +1,265 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReceiveQosDataType is the corresponding interface of ReceiveQosDataType +type ReceiveQosDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // IsReceiveQosDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReceiveQosDataType() + // CreateBuilder creates a ReceiveQosDataTypeBuilder + CreateReceiveQosDataTypeBuilder() ReceiveQosDataTypeBuilder +} + +// _ReceiveQosDataType is the data-structure of this message +type _ReceiveQosDataType struct { + ExtensionObjectDefinitionContract +} + +var _ ReceiveQosDataType = (*_ReceiveQosDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReceiveQosDataType)(nil) + +// NewReceiveQosDataType factory function for _ReceiveQosDataType +func NewReceiveQosDataType() *_ReceiveQosDataType { + _result := &_ReceiveQosDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReceiveQosDataTypeBuilder is a builder for ReceiveQosDataType +type ReceiveQosDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields() ReceiveQosDataTypeBuilder + // Build builds the ReceiveQosDataType or returns an error if something is wrong + Build() (ReceiveQosDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReceiveQosDataType +} + +// NewReceiveQosDataTypeBuilder() creates a ReceiveQosDataTypeBuilder +func NewReceiveQosDataTypeBuilder() ReceiveQosDataTypeBuilder { + return &_ReceiveQosDataTypeBuilder{_ReceiveQosDataType: new(_ReceiveQosDataType)} +} + +type _ReceiveQosDataTypeBuilder struct { + *_ReceiveQosDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReceiveQosDataTypeBuilder) = (*_ReceiveQosDataTypeBuilder)(nil) + +func (b *_ReceiveQosDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReceiveQosDataTypeBuilder) WithMandatoryFields() ReceiveQosDataTypeBuilder { + return b +} + +func (b *_ReceiveQosDataTypeBuilder) Build() (ReceiveQosDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReceiveQosDataType.deepCopy(), nil +} + +func (b *_ReceiveQosDataTypeBuilder) MustBuild() ReceiveQosDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReceiveQosDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReceiveQosDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReceiveQosDataTypeBuilder) DeepCopy() any { + _copy := b.CreateReceiveQosDataTypeBuilder().(*_ReceiveQosDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReceiveQosDataTypeBuilder creates a ReceiveQosDataTypeBuilder +func (b *_ReceiveQosDataType) CreateReceiveQosDataTypeBuilder() ReceiveQosDataTypeBuilder { + if b == nil { + return NewReceiveQosDataTypeBuilder() + } + return &_ReceiveQosDataTypeBuilder{_ReceiveQosDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReceiveQosDataType) GetExtensionId() int32 { + return int32(23610) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReceiveQosDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +// Deprecated: use the interface for direct cast +func CastReceiveQosDataType(structType any) ReceiveQosDataType { + if casted, ok := structType.(ReceiveQosDataType); ok { + return casted + } + if casted, ok := structType.(*ReceiveQosDataType); ok { + return *casted + } + return nil +} + +func (m *_ReceiveQosDataType) GetTypeName() string { + return "ReceiveQosDataType" +} + +func (m *_ReceiveQosDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + return lengthInBits +} + +func (m *_ReceiveQosDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReceiveQosDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__receiveQosDataType ReceiveQosDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReceiveQosDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReceiveQosDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("ReceiveQosDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReceiveQosDataType") + } + + return m, nil +} + +func (m *_ReceiveQosDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReceiveQosDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReceiveQosDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReceiveQosDataType") + } + + if popErr := writeBuffer.PopContext("ReceiveQosDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReceiveQosDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReceiveQosDataType) IsReceiveQosDataType() {} + +func (m *_ReceiveQosDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReceiveQosDataType) deepCopy() *_ReceiveQosDataType { + if m == nil { + return nil + } + _ReceiveQosDataTypeCopy := &_ReceiveQosDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReceiveQosDataTypeCopy +} + +func (m *_ReceiveQosDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ReceiveQosPriorityDataType.go b/plc4go/protocols/opcua/readwrite/model/ReceiveQosPriorityDataType.go new file mode 100644 index 00000000000..af0bebba8bf --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReceiveQosPriorityDataType.go @@ -0,0 +1,330 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReceiveQosPriorityDataType is the corresponding interface of ReceiveQosPriorityDataType +type ReceiveQosPriorityDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetPriorityLabel returns PriorityLabel (property field) + GetPriorityLabel() PascalString + // IsReceiveQosPriorityDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReceiveQosPriorityDataType() + // CreateBuilder creates a ReceiveQosPriorityDataTypeBuilder + CreateReceiveQosPriorityDataTypeBuilder() ReceiveQosPriorityDataTypeBuilder +} + +// _ReceiveQosPriorityDataType is the data-structure of this message +type _ReceiveQosPriorityDataType struct { + ExtensionObjectDefinitionContract + PriorityLabel PascalString +} + +var _ ReceiveQosPriorityDataType = (*_ReceiveQosPriorityDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReceiveQosPriorityDataType)(nil) + +// NewReceiveQosPriorityDataType factory function for _ReceiveQosPriorityDataType +func NewReceiveQosPriorityDataType(priorityLabel PascalString) *_ReceiveQosPriorityDataType { + if priorityLabel == nil { + panic("priorityLabel of type PascalString for ReceiveQosPriorityDataType must not be nil") + } + _result := &_ReceiveQosPriorityDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PriorityLabel: priorityLabel, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReceiveQosPriorityDataTypeBuilder is a builder for ReceiveQosPriorityDataType +type ReceiveQosPriorityDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(priorityLabel PascalString) ReceiveQosPriorityDataTypeBuilder + // WithPriorityLabel adds PriorityLabel (property field) + WithPriorityLabel(PascalString) ReceiveQosPriorityDataTypeBuilder + // WithPriorityLabelBuilder adds PriorityLabel (property field) which is build by the builder + WithPriorityLabelBuilder(func(PascalStringBuilder) PascalStringBuilder) ReceiveQosPriorityDataTypeBuilder + // Build builds the ReceiveQosPriorityDataType or returns an error if something is wrong + Build() (ReceiveQosPriorityDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReceiveQosPriorityDataType +} + +// NewReceiveQosPriorityDataTypeBuilder() creates a ReceiveQosPriorityDataTypeBuilder +func NewReceiveQosPriorityDataTypeBuilder() ReceiveQosPriorityDataTypeBuilder { + return &_ReceiveQosPriorityDataTypeBuilder{_ReceiveQosPriorityDataType: new(_ReceiveQosPriorityDataType)} +} + +type _ReceiveQosPriorityDataTypeBuilder struct { + *_ReceiveQosPriorityDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReceiveQosPriorityDataTypeBuilder) = (*_ReceiveQosPriorityDataTypeBuilder)(nil) + +func (b *_ReceiveQosPriorityDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) WithMandatoryFields(priorityLabel PascalString) ReceiveQosPriorityDataTypeBuilder { + return b.WithPriorityLabel(priorityLabel) +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) WithPriorityLabel(priorityLabel PascalString) ReceiveQosPriorityDataTypeBuilder { + b.PriorityLabel = priorityLabel + return b +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) WithPriorityLabelBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) ReceiveQosPriorityDataTypeBuilder { + builder := builderSupplier(b.PriorityLabel.CreatePascalStringBuilder()) + var err error + b.PriorityLabel, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) Build() (ReceiveQosPriorityDataType, error) { + if b.PriorityLabel == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'priorityLabel' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReceiveQosPriorityDataType.deepCopy(), nil +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) MustBuild() ReceiveQosPriorityDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReceiveQosPriorityDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReceiveQosPriorityDataTypeBuilder) DeepCopy() any { + _copy := b.CreateReceiveQosPriorityDataTypeBuilder().(*_ReceiveQosPriorityDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReceiveQosPriorityDataTypeBuilder creates a ReceiveQosPriorityDataTypeBuilder +func (b *_ReceiveQosPriorityDataType) CreateReceiveQosPriorityDataTypeBuilder() ReceiveQosPriorityDataTypeBuilder { + if b == nil { + return NewReceiveQosPriorityDataTypeBuilder() + } + return &_ReceiveQosPriorityDataTypeBuilder{_ReceiveQosPriorityDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReceiveQosPriorityDataType) GetExtensionId() int32 { + return int32(23611) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReceiveQosPriorityDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReceiveQosPriorityDataType) GetPriorityLabel() PascalString { + return m.PriorityLabel +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReceiveQosPriorityDataType(structType any) ReceiveQosPriorityDataType { + if casted, ok := structType.(ReceiveQosPriorityDataType); ok { + return casted + } + if casted, ok := structType.(*ReceiveQosPriorityDataType); ok { + return *casted + } + return nil +} + +func (m *_ReceiveQosPriorityDataType) GetTypeName() string { + return "ReceiveQosPriorityDataType" +} + +func (m *_ReceiveQosPriorityDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (priorityLabel) + lengthInBits += m.PriorityLabel.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_ReceiveQosPriorityDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReceiveQosPriorityDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__receiveQosPriorityDataType ReceiveQosPriorityDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReceiveQosPriorityDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReceiveQosPriorityDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + priorityLabel, err := ReadSimpleField[PascalString](ctx, "priorityLabel", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'priorityLabel' field")) + } + m.PriorityLabel = priorityLabel + + if closeErr := readBuffer.CloseContext("ReceiveQosPriorityDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReceiveQosPriorityDataType") + } + + return m, nil +} + +func (m *_ReceiveQosPriorityDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReceiveQosPriorityDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReceiveQosPriorityDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReceiveQosPriorityDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "priorityLabel", m.GetPriorityLabel(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'priorityLabel' field") + } + + if popErr := writeBuffer.PopContext("ReceiveQosPriorityDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReceiveQosPriorityDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReceiveQosPriorityDataType) IsReceiveQosPriorityDataType() {} + +func (m *_ReceiveQosPriorityDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReceiveQosPriorityDataType) deepCopy() *_ReceiveQosPriorityDataType { + if m == nil { + return nil + } + _ReceiveQosPriorityDataTypeCopy := &_ReceiveQosPriorityDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PriorityLabel.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReceiveQosPriorityDataTypeCopy +} + +func (m *_ReceiveQosPriorityDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/RedundantServerDataType.go b/plc4go/protocols/opcua/readwrite/model/RedundantServerDataType.go index 31ecdc36531..a9295caef48 100644 --- a/plc4go/protocols/opcua/readwrite/model/RedundantServerDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/RedundantServerDataType.go @@ -209,8 +209,8 @@ func (b *_RedundantServerDataType) CreateRedundantServerDataTypeBuilder() Redund /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RedundantServerDataType) GetIdentifier() string { - return "855" +func (m *_RedundantServerDataType) GetExtensionId() int32 { + return int32(855) } /////////////////////// @@ -278,7 +278,7 @@ func (m *_RedundantServerDataType) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_RedundantServerDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__redundantServerDataType RedundantServerDataType, err error) { +func (m *_RedundantServerDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__redundantServerDataType RedundantServerDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReferenceDescription.go b/plc4go/protocols/opcua/readwrite/model/ReferenceDescription.go index bc54a20ca7c..3d4941082de 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReferenceDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/ReferenceDescription.go @@ -351,8 +351,8 @@ func (b *_ReferenceDescription) CreateReferenceDescriptionBuilder() ReferenceDes /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReferenceDescription) GetIdentifier() string { - return "520" +func (m *_ReferenceDescription) GetExtensionId() int32 { + return int32(520) } /////////////////////// @@ -451,7 +451,7 @@ func (m *_ReferenceDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ReferenceDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__referenceDescription ReferenceDescription, err error) { +func (m *_ReferenceDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__referenceDescription ReferenceDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReferenceDescriptionDataType.go b/plc4go/protocols/opcua/readwrite/model/ReferenceDescriptionDataType.go index 5a252eedcf7..a7e07a2af8b 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReferenceDescriptionDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ReferenceDescriptionDataType.go @@ -270,8 +270,8 @@ func (b *_ReferenceDescriptionDataType) CreateReferenceDescriptionDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReferenceDescriptionDataType) GetIdentifier() string { - return "32661" +func (m *_ReferenceDescriptionDataType) GetExtensionId() int32 { + return int32(32661) } /////////////////////// @@ -349,7 +349,7 @@ func (m *_ReferenceDescriptionDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_ReferenceDescriptionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__referenceDescriptionDataType ReferenceDescriptionDataType, err error) { +func (m *_ReferenceDescriptionDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__referenceDescriptionDataType ReferenceDescriptionDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReferenceListEntryDataType.go b/plc4go/protocols/opcua/readwrite/model/ReferenceListEntryDataType.go index 620201bf2ff..241ebca61d0 100644 --- a/plc4go/protocols/opcua/readwrite/model/ReferenceListEntryDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ReferenceListEntryDataType.go @@ -235,8 +235,8 @@ func (b *_ReferenceListEntryDataType) CreateReferenceListEntryDataTypeBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ReferenceListEntryDataType) GetIdentifier() string { - return "32662" +func (m *_ReferenceListEntryDataType) GetExtensionId() int32 { + return int32(32662) } /////////////////////// @@ -307,7 +307,7 @@ func (m *_ReferenceListEntryDataType) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_ReferenceListEntryDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__referenceListEntryDataType ReferenceListEntryDataType, err error) { +func (m *_ReferenceListEntryDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__referenceListEntryDataType ReferenceListEntryDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ReferenceTypeAttributes.go b/plc4go/protocols/opcua/readwrite/model/ReferenceTypeAttributes.go new file mode 100644 index 00000000000..bf6fdba3bcd --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ReferenceTypeAttributes.go @@ -0,0 +1,597 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ReferenceTypeAttributes is the corresponding interface of ReferenceTypeAttributes +type ReferenceTypeAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetSymmetric returns Symmetric (property field) + GetSymmetric() bool + // GetIsAbstract returns IsAbstract (property field) + GetIsAbstract() bool + // GetInverseName returns InverseName (property field) + GetInverseName() LocalizedText + // IsReferenceTypeAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsReferenceTypeAttributes() + // CreateBuilder creates a ReferenceTypeAttributesBuilder + CreateReferenceTypeAttributesBuilder() ReferenceTypeAttributesBuilder +} + +// _ReferenceTypeAttributes is the data-structure of this message +type _ReferenceTypeAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + Symmetric bool + IsAbstract bool + InverseName LocalizedText + // Reserved Fields + reservedField0 *uint8 +} + +var _ ReferenceTypeAttributes = (*_ReferenceTypeAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ReferenceTypeAttributes)(nil) + +// NewReferenceTypeAttributes factory function for _ReferenceTypeAttributes +func NewReferenceTypeAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, symmetric bool, isAbstract bool, inverseName LocalizedText) *_ReferenceTypeAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for ReferenceTypeAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for ReferenceTypeAttributes must not be nil") + } + if inverseName == nil { + panic("inverseName of type LocalizedText for ReferenceTypeAttributes must not be nil") + } + _result := &_ReferenceTypeAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + Symmetric: symmetric, + IsAbstract: isAbstract, + InverseName: inverseName, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ReferenceTypeAttributesBuilder is a builder for ReferenceTypeAttributes +type ReferenceTypeAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, symmetric bool, isAbstract bool, inverseName LocalizedText) ReferenceTypeAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) ReferenceTypeAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) ReferenceTypeAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) ReferenceTypeAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) ReferenceTypeAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) ReferenceTypeAttributesBuilder + // WithSymmetric adds Symmetric (property field) + WithSymmetric(bool) ReferenceTypeAttributesBuilder + // WithIsAbstract adds IsAbstract (property field) + WithIsAbstract(bool) ReferenceTypeAttributesBuilder + // WithInverseName adds InverseName (property field) + WithInverseName(LocalizedText) ReferenceTypeAttributesBuilder + // WithInverseNameBuilder adds InverseName (property field) which is build by the builder + WithInverseNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder + // Build builds the ReferenceTypeAttributes or returns an error if something is wrong + Build() (ReferenceTypeAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() ReferenceTypeAttributes +} + +// NewReferenceTypeAttributesBuilder() creates a ReferenceTypeAttributesBuilder +func NewReferenceTypeAttributesBuilder() ReferenceTypeAttributesBuilder { + return &_ReferenceTypeAttributesBuilder{_ReferenceTypeAttributes: new(_ReferenceTypeAttributes)} +} + +type _ReferenceTypeAttributesBuilder struct { + *_ReferenceTypeAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ReferenceTypeAttributesBuilder) = (*_ReferenceTypeAttributesBuilder)(nil) + +func (b *_ReferenceTypeAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ReferenceTypeAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, symmetric bool, isAbstract bool, inverseName LocalizedText) ReferenceTypeAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithSymmetric(symmetric).WithIsAbstract(isAbstract).WithInverseName(inverseName) +} + +func (b *_ReferenceTypeAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) ReferenceTypeAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithDisplayName(displayName LocalizedText) ReferenceTypeAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithDescription(description LocalizedText) ReferenceTypeAttributesBuilder { + b.Description = description + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithWriteMask(writeMask uint32) ReferenceTypeAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithUserWriteMask(userWriteMask uint32) ReferenceTypeAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithSymmetric(symmetric bool) ReferenceTypeAttributesBuilder { + b.Symmetric = symmetric + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithIsAbstract(isAbstract bool) ReferenceTypeAttributesBuilder { + b.IsAbstract = isAbstract + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithInverseName(inverseName LocalizedText) ReferenceTypeAttributesBuilder { + b.InverseName = inverseName + return b +} + +func (b *_ReferenceTypeAttributesBuilder) WithInverseNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ReferenceTypeAttributesBuilder { + builder := builderSupplier(b.InverseName.CreateLocalizedTextBuilder()) + var err error + b.InverseName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ReferenceTypeAttributesBuilder) Build() (ReferenceTypeAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.InverseName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'inverseName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ReferenceTypeAttributes.deepCopy(), nil +} + +func (b *_ReferenceTypeAttributesBuilder) MustBuild() ReferenceTypeAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ReferenceTypeAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ReferenceTypeAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ReferenceTypeAttributesBuilder) DeepCopy() any { + _copy := b.CreateReferenceTypeAttributesBuilder().(*_ReferenceTypeAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateReferenceTypeAttributesBuilder creates a ReferenceTypeAttributesBuilder +func (b *_ReferenceTypeAttributes) CreateReferenceTypeAttributesBuilder() ReferenceTypeAttributesBuilder { + if b == nil { + return NewReferenceTypeAttributesBuilder() + } + return &_ReferenceTypeAttributesBuilder{_ReferenceTypeAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ReferenceTypeAttributes) GetExtensionId() int32 { + return int32(369) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ReferenceTypeAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ReferenceTypeAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_ReferenceTypeAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_ReferenceTypeAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_ReferenceTypeAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_ReferenceTypeAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_ReferenceTypeAttributes) GetSymmetric() bool { + return m.Symmetric +} + +func (m *_ReferenceTypeAttributes) GetIsAbstract() bool { + return m.IsAbstract +} + +func (m *_ReferenceTypeAttributes) GetInverseName() LocalizedText { + return m.InverseName +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastReferenceTypeAttributes(structType any) ReferenceTypeAttributes { + if casted, ok := structType.(ReferenceTypeAttributes); ok { + return casted + } + if casted, ok := structType.(*ReferenceTypeAttributes); ok { + return *casted + } + return nil +} + +func (m *_ReferenceTypeAttributes) GetTypeName() string { + return "ReferenceTypeAttributes" +} + +func (m *_ReferenceTypeAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 6 + + // Simple field (symmetric) + lengthInBits += 1 + + // Simple field (isAbstract) + lengthInBits += 1 + + // Simple field (inverseName) + lengthInBits += m.InverseName.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_ReferenceTypeAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ReferenceTypeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__referenceTypeAttributes ReferenceTypeAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ReferenceTypeAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ReferenceTypeAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(6)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + symmetric, err := ReadSimpleField(ctx, "symmetric", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'symmetric' field")) + } + m.Symmetric = symmetric + + isAbstract, err := ReadSimpleField(ctx, "isAbstract", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isAbstract' field")) + } + m.IsAbstract = isAbstract + + inverseName, err := ReadSimpleField[LocalizedText](ctx, "inverseName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'inverseName' field")) + } + m.InverseName = inverseName + + if closeErr := readBuffer.CloseContext("ReferenceTypeAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ReferenceTypeAttributes") + } + + return m, nil +} + +func (m *_ReferenceTypeAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ReferenceTypeAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ReferenceTypeAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ReferenceTypeAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 6)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "symmetric", m.GetSymmetric(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'symmetric' field") + } + + if err := WriteSimpleField[bool](ctx, "isAbstract", m.GetIsAbstract(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isAbstract' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "inverseName", m.GetInverseName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'inverseName' field") + } + + if popErr := writeBuffer.PopContext("ReferenceTypeAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ReferenceTypeAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ReferenceTypeAttributes) IsReferenceTypeAttributes() {} + +func (m *_ReferenceTypeAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ReferenceTypeAttributes) deepCopy() *_ReferenceTypeAttributes { + if m == nil { + return nil + } + _ReferenceTypeAttributesCopy := &_ReferenceTypeAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.Symmetric, + m.IsAbstract, + m.InverseName.DeepCopy().(LocalizedText), + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ReferenceTypeAttributesCopy +} + +func (m *_ReferenceTypeAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterNodesRequest.go b/plc4go/protocols/opcua/readwrite/model/RegisterNodesRequest.go index f5dd8cce13f..08251af8787 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterNodesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterNodesRequest.go @@ -41,9 +41,7 @@ type RegisterNodesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfNodesToRegister returns NoOfNodesToRegister (property field) - GetNoOfNodesToRegister() int32 + GetRequestHeader() RequestHeader // GetNodesToRegister returns NodesToRegister (property field) GetNodesToRegister() []NodeId // IsRegisterNodesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type RegisterNodesRequest interface { // _RegisterNodesRequest is the data-structure of this message type _RegisterNodesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfNodesToRegister int32 - NodesToRegister []NodeId + RequestHeader RequestHeader + NodesToRegister []NodeId } var _ RegisterNodesRequest = (*_RegisterNodesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterNodesRequest)(nil) // NewRegisterNodesRequest factory function for _RegisterNodesRequest -func NewRegisterNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToRegister int32, nodesToRegister []NodeId) *_RegisterNodesRequest { +func NewRegisterNodesRequest(requestHeader RequestHeader, nodesToRegister []NodeId) *_RegisterNodesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for RegisterNodesRequest must not be nil") + panic("requestHeader of type RequestHeader for RegisterNodesRequest must not be nil") } _result := &_RegisterNodesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfNodesToRegister: noOfNodesToRegister, NodesToRegister: nodesToRegister, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewRegisterNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesT type RegisterNodesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToRegister int32, nodesToRegister []NodeId) RegisterNodesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, nodesToRegister []NodeId) RegisterNodesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) RegisterNodesRequestBuilder + WithRequestHeader(RequestHeader) RegisterNodesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterNodesRequestBuilder - // WithNoOfNodesToRegister adds NoOfNodesToRegister (property field) - WithNoOfNodesToRegister(int32) RegisterNodesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterNodesRequestBuilder // WithNodesToRegister adds NodesToRegister (property field) WithNodesToRegister(...NodeId) RegisterNodesRequestBuilder // Build builds the RegisterNodesRequest or returns an error if something is wrong @@ -121,33 +115,28 @@ func (b *_RegisterNodesRequestBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterNodesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToRegister int32, nodesToRegister []NodeId) RegisterNodesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfNodesToRegister(noOfNodesToRegister).WithNodesToRegister(nodesToRegister...) +func (b *_RegisterNodesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, nodesToRegister []NodeId) RegisterNodesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithNodesToRegister(nodesToRegister...) } -func (b *_RegisterNodesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) RegisterNodesRequestBuilder { +func (b *_RegisterNodesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) RegisterNodesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_RegisterNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterNodesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterNodesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_RegisterNodesRequestBuilder) WithNoOfNodesToRegister(noOfNodesToRegister int32) RegisterNodesRequestBuilder { - b.NoOfNodesToRegister = noOfNodesToRegister - return b -} - func (b *_RegisterNodesRequestBuilder) WithNodesToRegister(nodesToRegister ...NodeId) RegisterNodesRequestBuilder { b.NodesToRegister = nodesToRegister return b @@ -209,8 +198,8 @@ func (b *_RegisterNodesRequest) CreateRegisterNodesRequestBuilder() RegisterNode /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterNodesRequest) GetIdentifier() string { - return "560" +func (m *_RegisterNodesRequest) GetExtensionId() int32 { + return int32(560) } /////////////////////// @@ -227,14 +216,10 @@ func (m *_RegisterNodesRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterNodesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_RegisterNodesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_RegisterNodesRequest) GetNoOfNodesToRegister() int32 { - return m.NoOfNodesToRegister -} - func (m *_RegisterNodesRequest) GetNodesToRegister() []NodeId { return m.NodesToRegister } @@ -265,7 +250,7 @@ func (m *_RegisterNodesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfNodesToRegister) + // Implicit Field (noOfNodesToRegister) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_RegisterNodesRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerNodesRequest RegisterNodesRequest, err error) { +func (m *_RegisterNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerNodesRequest RegisterNodesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,17 +281,17 @@ func (m *_RegisterNodesRequest) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfNodesToRegister, err := ReadSimpleField(ctx, "noOfNodesToRegister", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToRegister, err := ReadImplicitField[int32](ctx, "noOfNodesToRegister", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToRegister' field")) } - m.NoOfNodesToRegister = noOfNodesToRegister + _ = noOfNodesToRegister nodesToRegister, err := ReadCountArrayField[NodeId](ctx, "nodesToRegister", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer), uint64(noOfNodesToRegister)) if err != nil { @@ -339,11 +324,11 @@ func (m *_RegisterNodesRequest) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for RegisterNodesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToRegister", m.GetNoOfNodesToRegister(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToRegister := int32(utils.InlineIf(bool((m.GetNodesToRegister()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToRegister()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToRegister", noOfNodesToRegister, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToRegister' field") } @@ -371,8 +356,7 @@ func (m *_RegisterNodesRequest) deepCopy() *_RegisterNodesRequest { } _RegisterNodesRequestCopy := &_RegisterNodesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodesToRegister, + m.RequestHeader.DeepCopy().(RequestHeader), utils.DeepCopySlice[NodeId, NodeId](m.NodesToRegister), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterNodesResponse.go b/plc4go/protocols/opcua/readwrite/model/RegisterNodesResponse.go index 7efae45e92e..5de723b828b 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterNodesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterNodesResponse.go @@ -41,9 +41,7 @@ type RegisterNodesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfRegisteredNodeIds returns NoOfRegisteredNodeIds (property field) - GetNoOfRegisteredNodeIds() int32 + GetResponseHeader() ResponseHeader // GetRegisteredNodeIds returns RegisteredNodeIds (property field) GetRegisteredNodeIds() []NodeId // IsRegisterNodesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type RegisterNodesResponse interface { // _RegisterNodesResponse is the data-structure of this message type _RegisterNodesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfRegisteredNodeIds int32 - RegisteredNodeIds []NodeId + ResponseHeader ResponseHeader + RegisteredNodeIds []NodeId } var _ RegisterNodesResponse = (*_RegisterNodesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterNodesResponse)(nil) // NewRegisterNodesResponse factory function for _RegisterNodesResponse -func NewRegisterNodesResponse(responseHeader ExtensionObjectDefinition, noOfRegisteredNodeIds int32, registeredNodeIds []NodeId) *_RegisterNodesResponse { +func NewRegisterNodesResponse(responseHeader ResponseHeader, registeredNodeIds []NodeId) *_RegisterNodesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for RegisterNodesResponse must not be nil") + panic("responseHeader of type ResponseHeader for RegisterNodesResponse must not be nil") } _result := &_RegisterNodesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfRegisteredNodeIds: noOfRegisteredNodeIds, RegisteredNodeIds: registeredNodeIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewRegisterNodesResponse(responseHeader ExtensionObjectDefinition, noOfRegi type RegisterNodesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfRegisteredNodeIds int32, registeredNodeIds []NodeId) RegisterNodesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, registeredNodeIds []NodeId) RegisterNodesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) RegisterNodesResponseBuilder + WithResponseHeader(ResponseHeader) RegisterNodesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterNodesResponseBuilder - // WithNoOfRegisteredNodeIds adds NoOfRegisteredNodeIds (property field) - WithNoOfRegisteredNodeIds(int32) RegisterNodesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterNodesResponseBuilder // WithRegisteredNodeIds adds RegisteredNodeIds (property field) WithRegisteredNodeIds(...NodeId) RegisterNodesResponseBuilder // Build builds the RegisterNodesResponse or returns an error if something is wrong @@ -121,33 +115,28 @@ func (b *_RegisterNodesResponseBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterNodesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfRegisteredNodeIds int32, registeredNodeIds []NodeId) RegisterNodesResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfRegisteredNodeIds(noOfRegisteredNodeIds).WithRegisteredNodeIds(registeredNodeIds...) +func (b *_RegisterNodesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, registeredNodeIds []NodeId) RegisterNodesResponseBuilder { + return b.WithResponseHeader(responseHeader).WithRegisteredNodeIds(registeredNodeIds...) } -func (b *_RegisterNodesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) RegisterNodesResponseBuilder { +func (b *_RegisterNodesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) RegisterNodesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_RegisterNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterNodesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterNodesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_RegisterNodesResponseBuilder) WithNoOfRegisteredNodeIds(noOfRegisteredNodeIds int32) RegisterNodesResponseBuilder { - b.NoOfRegisteredNodeIds = noOfRegisteredNodeIds - return b -} - func (b *_RegisterNodesResponseBuilder) WithRegisteredNodeIds(registeredNodeIds ...NodeId) RegisterNodesResponseBuilder { b.RegisteredNodeIds = registeredNodeIds return b @@ -209,8 +198,8 @@ func (b *_RegisterNodesResponse) CreateRegisterNodesResponseBuilder() RegisterNo /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterNodesResponse) GetIdentifier() string { - return "563" +func (m *_RegisterNodesResponse) GetExtensionId() int32 { + return int32(563) } /////////////////////// @@ -227,14 +216,10 @@ func (m *_RegisterNodesResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterNodesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_RegisterNodesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_RegisterNodesResponse) GetNoOfRegisteredNodeIds() int32 { - return m.NoOfRegisteredNodeIds -} - func (m *_RegisterNodesResponse) GetRegisteredNodeIds() []NodeId { return m.RegisteredNodeIds } @@ -265,7 +250,7 @@ func (m *_RegisterNodesResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfRegisteredNodeIds) + // Implicit Field (noOfRegisteredNodeIds) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_RegisterNodesResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerNodesResponse RegisterNodesResponse, err error) { +func (m *_RegisterNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerNodesResponse RegisterNodesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,17 +281,17 @@ func (m *_RegisterNodesResponse) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfRegisteredNodeIds, err := ReadSimpleField(ctx, "noOfRegisteredNodeIds", ReadSignedInt(readBuffer, uint8(32))) + noOfRegisteredNodeIds, err := ReadImplicitField[int32](ctx, "noOfRegisteredNodeIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfRegisteredNodeIds' field")) } - m.NoOfRegisteredNodeIds = noOfRegisteredNodeIds + _ = noOfRegisteredNodeIds registeredNodeIds, err := ReadCountArrayField[NodeId](ctx, "registeredNodeIds", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer), uint64(noOfRegisteredNodeIds)) if err != nil { @@ -339,11 +324,11 @@ func (m *_RegisterNodesResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for RegisterNodesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfRegisteredNodeIds", m.GetNoOfRegisteredNodeIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfRegisteredNodeIds := int32(utils.InlineIf(bool((m.GetRegisteredNodeIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetRegisteredNodeIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfRegisteredNodeIds", noOfRegisteredNodeIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfRegisteredNodeIds' field") } @@ -371,8 +356,7 @@ func (m *_RegisterNodesResponse) deepCopy() *_RegisterNodesResponse { } _RegisterNodesResponseCopy := &_RegisterNodesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfRegisteredNodeIds, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[NodeId, NodeId](m.RegisteredNodeIds), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterServer2Request.go b/plc4go/protocols/opcua/readwrite/model/RegisterServer2Request.go index 5c64347557c..b79a1374d0b 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterServer2Request.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterServer2Request.go @@ -41,11 +41,9 @@ type RegisterServer2Request interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetServer returns Server (property field) - GetServer() ExtensionObjectDefinition - // GetNoOfDiscoveryConfiguration returns NoOfDiscoveryConfiguration (property field) - GetNoOfDiscoveryConfiguration() int32 + GetServer() RegisteredServer // GetDiscoveryConfiguration returns DiscoveryConfiguration (property field) GetDiscoveryConfiguration() []ExtensionObject // IsRegisterServer2Request is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,28 +55,26 @@ type RegisterServer2Request interface { // _RegisterServer2Request is the data-structure of this message type _RegisterServer2Request struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - Server ExtensionObjectDefinition - NoOfDiscoveryConfiguration int32 - DiscoveryConfiguration []ExtensionObject + RequestHeader RequestHeader + Server RegisteredServer + DiscoveryConfiguration []ExtensionObject } var _ RegisterServer2Request = (*_RegisterServer2Request)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterServer2Request)(nil) // NewRegisterServer2Request factory function for _RegisterServer2Request -func NewRegisterServer2Request(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition, noOfDiscoveryConfiguration int32, discoveryConfiguration []ExtensionObject) *_RegisterServer2Request { +func NewRegisterServer2Request(requestHeader RequestHeader, server RegisteredServer, discoveryConfiguration []ExtensionObject) *_RegisterServer2Request { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for RegisterServer2Request must not be nil") + panic("requestHeader of type RequestHeader for RegisterServer2Request must not be nil") } if server == nil { - panic("server of type ExtensionObjectDefinition for RegisterServer2Request must not be nil") + panic("server of type RegisteredServer for RegisterServer2Request must not be nil") } _result := &_RegisterServer2Request{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, Server: server, - NoOfDiscoveryConfiguration: noOfDiscoveryConfiguration, DiscoveryConfiguration: discoveryConfiguration, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -94,17 +90,15 @@ func NewRegisterServer2Request(requestHeader ExtensionObjectDefinition, server E type RegisterServer2RequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition, noOfDiscoveryConfiguration int32, discoveryConfiguration []ExtensionObject) RegisterServer2RequestBuilder + WithMandatoryFields(requestHeader RequestHeader, server RegisteredServer, discoveryConfiguration []ExtensionObject) RegisterServer2RequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) RegisterServer2RequestBuilder + WithRequestHeader(RequestHeader) RegisterServer2RequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2RequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterServer2RequestBuilder // WithServer adds Server (property field) - WithServer(ExtensionObjectDefinition) RegisterServer2RequestBuilder + WithServer(RegisteredServer) RegisterServer2RequestBuilder // WithServerBuilder adds Server (property field) which is build by the builder - WithServerBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2RequestBuilder - // WithNoOfDiscoveryConfiguration adds NoOfDiscoveryConfiguration (property field) - WithNoOfDiscoveryConfiguration(int32) RegisterServer2RequestBuilder + WithServerBuilder(func(RegisteredServerBuilder) RegisteredServerBuilder) RegisterServer2RequestBuilder // WithDiscoveryConfiguration adds DiscoveryConfiguration (property field) WithDiscoveryConfiguration(...ExtensionObject) RegisterServer2RequestBuilder // Build builds the RegisterServer2Request or returns an error if something is wrong @@ -132,51 +126,46 @@ func (b *_RegisterServer2RequestBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterServer2RequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition, noOfDiscoveryConfiguration int32, discoveryConfiguration []ExtensionObject) RegisterServer2RequestBuilder { - return b.WithRequestHeader(requestHeader).WithServer(server).WithNoOfDiscoveryConfiguration(noOfDiscoveryConfiguration).WithDiscoveryConfiguration(discoveryConfiguration...) +func (b *_RegisterServer2RequestBuilder) WithMandatoryFields(requestHeader RequestHeader, server RegisteredServer, discoveryConfiguration []ExtensionObject) RegisterServer2RequestBuilder { + return b.WithRequestHeader(requestHeader).WithServer(server).WithDiscoveryConfiguration(discoveryConfiguration...) } -func (b *_RegisterServer2RequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) RegisterServer2RequestBuilder { +func (b *_RegisterServer2RequestBuilder) WithRequestHeader(requestHeader RequestHeader) RegisterServer2RequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_RegisterServer2RequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2RequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServer2RequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterServer2RequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_RegisterServer2RequestBuilder) WithServer(server ExtensionObjectDefinition) RegisterServer2RequestBuilder { +func (b *_RegisterServer2RequestBuilder) WithServer(server RegisteredServer) RegisterServer2RequestBuilder { b.Server = server return b } -func (b *_RegisterServer2RequestBuilder) WithServerBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2RequestBuilder { - builder := builderSupplier(b.Server.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServer2RequestBuilder) WithServerBuilder(builderSupplier func(RegisteredServerBuilder) RegisteredServerBuilder) RegisterServer2RequestBuilder { + builder := builderSupplier(b.Server.CreateRegisteredServerBuilder()) var err error b.Server, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RegisteredServerBuilder failed")) } return b } -func (b *_RegisterServer2RequestBuilder) WithNoOfDiscoveryConfiguration(noOfDiscoveryConfiguration int32) RegisterServer2RequestBuilder { - b.NoOfDiscoveryConfiguration = noOfDiscoveryConfiguration - return b -} - func (b *_RegisterServer2RequestBuilder) WithDiscoveryConfiguration(discoveryConfiguration ...ExtensionObject) RegisterServer2RequestBuilder { b.DiscoveryConfiguration = discoveryConfiguration return b @@ -244,8 +233,8 @@ func (b *_RegisterServer2Request) CreateRegisterServer2RequestBuilder() Register /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterServer2Request) GetIdentifier() string { - return "12195" +func (m *_RegisterServer2Request) GetExtensionId() int32 { + return int32(12195) } /////////////////////// @@ -262,18 +251,14 @@ func (m *_RegisterServer2Request) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterServer2Request) GetRequestHeader() ExtensionObjectDefinition { +func (m *_RegisterServer2Request) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_RegisterServer2Request) GetServer() ExtensionObjectDefinition { +func (m *_RegisterServer2Request) GetServer() RegisteredServer { return m.Server } -func (m *_RegisterServer2Request) GetNoOfDiscoveryConfiguration() int32 { - return m.NoOfDiscoveryConfiguration -} - func (m *_RegisterServer2Request) GetDiscoveryConfiguration() []ExtensionObject { return m.DiscoveryConfiguration } @@ -307,7 +292,7 @@ func (m *_RegisterServer2Request) GetLengthInBits(ctx context.Context) uint16 { // Simple field (server) lengthInBits += m.Server.GetLengthInBits(ctx) - // Simple field (noOfDiscoveryConfiguration) + // Implicit Field (noOfDiscoveryConfiguration) lengthInBits += 32 // Array field @@ -327,7 +312,7 @@ func (m *_RegisterServer2Request) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterServer2Request) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerServer2Request RegisterServer2Request, err error) { +func (m *_RegisterServer2Request) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerServer2Request RegisterServer2Request, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -338,25 +323,25 @@ func (m *_RegisterServer2Request) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - server, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "server", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("434")), readBuffer)) + server, err := ReadSimpleField[RegisteredServer](ctx, "server", ReadComplex[RegisteredServer](ExtensionObjectDefinitionParseWithBufferProducer[RegisteredServer]((int32)(int32(434))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'server' field")) } m.Server = server - noOfDiscoveryConfiguration, err := ReadSimpleField(ctx, "noOfDiscoveryConfiguration", ReadSignedInt(readBuffer, uint8(32))) + noOfDiscoveryConfiguration, err := ReadImplicitField[int32](ctx, "noOfDiscoveryConfiguration", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiscoveryConfiguration' field")) } - m.NoOfDiscoveryConfiguration = noOfDiscoveryConfiguration + _ = noOfDiscoveryConfiguration - discoveryConfiguration, err := ReadCountArrayField[ExtensionObject](ctx, "discoveryConfiguration", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer), uint64(noOfDiscoveryConfiguration)) + discoveryConfiguration, err := ReadCountArrayField[ExtensionObject](ctx, "discoveryConfiguration", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(noOfDiscoveryConfiguration)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'discoveryConfiguration' field")) } @@ -387,15 +372,15 @@ func (m *_RegisterServer2Request) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for RegisterServer2Request") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "server", m.GetServer(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RegisteredServer](ctx, "server", m.GetServer(), WriteComplex[RegisteredServer](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'server' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiscoveryConfiguration", m.GetNoOfDiscoveryConfiguration(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiscoveryConfiguration := int32(utils.InlineIf(bool((m.GetDiscoveryConfiguration()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiscoveryConfiguration()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiscoveryConfiguration", noOfDiscoveryConfiguration, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiscoveryConfiguration' field") } @@ -423,9 +408,8 @@ func (m *_RegisterServer2Request) deepCopy() *_RegisterServer2Request { } _RegisterServer2RequestCopy := &_RegisterServer2Request{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.Server.DeepCopy().(ExtensionObjectDefinition), - m.NoOfDiscoveryConfiguration, + m.RequestHeader.DeepCopy().(RequestHeader), + m.Server.DeepCopy().(RegisteredServer), utils.DeepCopySlice[ExtensionObject, ExtensionObject](m.DiscoveryConfiguration), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterServer2Response.go b/plc4go/protocols/opcua/readwrite/model/RegisterServer2Response.go index 9680aa978a4..76abc209e12 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterServer2Response.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterServer2Response.go @@ -41,13 +41,9 @@ type RegisterServer2Response interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfConfigurationResults returns NoOfConfigurationResults (property field) - GetNoOfConfigurationResults() int32 + GetResponseHeader() ResponseHeader // GetConfigurationResults returns ConfigurationResults (property field) GetConfigurationResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsRegisterServer2Response is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type RegisterServer2Response interface { // _RegisterServer2Response is the data-structure of this message type _RegisterServer2Response struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfConfigurationResults int32 - ConfigurationResults []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + ConfigurationResults []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ RegisterServer2Response = (*_RegisterServer2Response)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterServer2Response)(nil) // NewRegisterServer2Response factory function for _RegisterServer2Response -func NewRegisterServer2Response(responseHeader ExtensionObjectDefinition, noOfConfigurationResults int32, configurationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_RegisterServer2Response { +func NewRegisterServer2Response(responseHeader ResponseHeader, configurationResults []StatusCode, diagnosticInfos []DiagnosticInfo) *_RegisterServer2Response { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for RegisterServer2Response must not be nil") + panic("responseHeader of type ResponseHeader for RegisterServer2Response must not be nil") } _result := &_RegisterServer2Response{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfConfigurationResults: noOfConfigurationResults, ConfigurationResults: configurationResults, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewRegisterServer2Response(responseHeader ExtensionObjectDefinition, noOfCo type RegisterServer2ResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfConfigurationResults int32, configurationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) RegisterServer2ResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, configurationResults []StatusCode, diagnosticInfos []DiagnosticInfo) RegisterServer2ResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) RegisterServer2ResponseBuilder + WithResponseHeader(ResponseHeader) RegisterServer2ResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2ResponseBuilder - // WithNoOfConfigurationResults adds NoOfConfigurationResults (property field) - WithNoOfConfigurationResults(int32) RegisterServer2ResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterServer2ResponseBuilder // WithConfigurationResults adds ConfigurationResults (property field) WithConfigurationResults(...StatusCode) RegisterServer2ResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) RegisterServer2ResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) RegisterServer2ResponseBuilder // Build builds the RegisterServer2Response or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_RegisterServer2ResponseBuilder) setParent(contract ExtensionObjectDefi b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterServer2ResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfConfigurationResults int32, configurationResults []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) RegisterServer2ResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfConfigurationResults(noOfConfigurationResults).WithConfigurationResults(configurationResults...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_RegisterServer2ResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, configurationResults []StatusCode, diagnosticInfos []DiagnosticInfo) RegisterServer2ResponseBuilder { + return b.WithResponseHeader(responseHeader).WithConfigurationResults(configurationResults...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_RegisterServer2ResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) RegisterServer2ResponseBuilder { +func (b *_RegisterServer2ResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) RegisterServer2ResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_RegisterServer2ResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServer2ResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServer2ResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterServer2ResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_RegisterServer2ResponseBuilder) WithNoOfConfigurationResults(noOfConfigurationResults int32) RegisterServer2ResponseBuilder { - b.NoOfConfigurationResults = noOfConfigurationResults - return b -} - func (b *_RegisterServer2ResponseBuilder) WithConfigurationResults(configurationResults ...StatusCode) RegisterServer2ResponseBuilder { b.ConfigurationResults = configurationResults return b } -func (b *_RegisterServer2ResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) RegisterServer2ResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_RegisterServer2ResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) RegisterServer2ResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_RegisterServer2Response) CreateRegisterServer2ResponseBuilder() Regist /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterServer2Response) GetIdentifier() string { - return "12196" +func (m *_RegisterServer2Response) GetExtensionId() int32 { + return int32(12196) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_RegisterServer2Response) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterServer2Response) GetResponseHeader() ExtensionObjectDefinition { +func (m *_RegisterServer2Response) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_RegisterServer2Response) GetNoOfConfigurationResults() int32 { - return m.NoOfConfigurationResults -} - func (m *_RegisterServer2Response) GetConfigurationResults() []StatusCode { return m.ConfigurationResults } -func (m *_RegisterServer2Response) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_RegisterServer2Response) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_RegisterServer2Response) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfConfigurationResults) + // Implicit Field (noOfConfigurationResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_RegisterServer2Response) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_RegisterServer2Response) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterServer2Response) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerServer2Response RegisterServer2Response, err error) { +func (m *_RegisterServer2Response) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerServer2Response RegisterServer2Response, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_RegisterServer2Response) parse(ctx context.Context, readBuffer utils.R currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfConfigurationResults, err := ReadSimpleField(ctx, "noOfConfigurationResults", ReadSignedInt(readBuffer, uint8(32))) + noOfConfigurationResults, err := ReadImplicitField[int32](ctx, "noOfConfigurationResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfConfigurationResults' field")) } - m.NoOfConfigurationResults = noOfConfigurationResults + _ = noOfConfigurationResults configurationResults, err := ReadCountArrayField[StatusCode](ctx, "configurationResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfConfigurationResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_RegisterServer2Response) parse(ctx context.Context, readBuffer utils.R } m.ConfigurationResults = configurationResults - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_RegisterServer2Response) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for RegisterServer2Response") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfConfigurationResults", m.GetNoOfConfigurationResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfConfigurationResults := int32(utils.InlineIf(bool((m.GetConfigurationResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetConfigurationResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfConfigurationResults", noOfConfigurationResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfConfigurationResults' field") } if err := WriteComplexTypeArrayField(ctx, "configurationResults", m.GetConfigurationResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'configurationResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_RegisterServer2Response) deepCopy() *_RegisterServer2Response { } _RegisterServer2ResponseCopy := &_RegisterServer2Response{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfConfigurationResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.ConfigurationResults), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterServerRequest.go b/plc4go/protocols/opcua/readwrite/model/RegisterServerRequest.go index 0d12288adff..69c9ee57ba6 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterServerRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterServerRequest.go @@ -41,9 +41,9 @@ type RegisterServerRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetServer returns Server (property field) - GetServer() ExtensionObjectDefinition + GetServer() RegisteredServer // IsRegisterServerRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsRegisterServerRequest() // CreateBuilder creates a RegisterServerRequestBuilder @@ -53,20 +53,20 @@ type RegisterServerRequest interface { // _RegisterServerRequest is the data-structure of this message type _RegisterServerRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - Server ExtensionObjectDefinition + RequestHeader RequestHeader + Server RegisteredServer } var _ RegisterServerRequest = (*_RegisterServerRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterServerRequest)(nil) // NewRegisterServerRequest factory function for _RegisterServerRequest -func NewRegisterServerRequest(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition) *_RegisterServerRequest { +func NewRegisterServerRequest(requestHeader RequestHeader, server RegisteredServer) *_RegisterServerRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for RegisterServerRequest must not be nil") + panic("requestHeader of type RequestHeader for RegisterServerRequest must not be nil") } if server == nil { - panic("server of type ExtensionObjectDefinition for RegisterServerRequest must not be nil") + panic("server of type RegisteredServer for RegisterServerRequest must not be nil") } _result := &_RegisterServerRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -86,15 +86,15 @@ func NewRegisterServerRequest(requestHeader ExtensionObjectDefinition, server Ex type RegisterServerRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition) RegisterServerRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, server RegisteredServer) RegisterServerRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) RegisterServerRequestBuilder + WithRequestHeader(RequestHeader) RegisterServerRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterServerRequestBuilder // WithServer adds Server (property field) - WithServer(ExtensionObjectDefinition) RegisterServerRequestBuilder + WithServer(RegisteredServer) RegisterServerRequestBuilder // WithServerBuilder adds Server (property field) which is build by the builder - WithServerBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerRequestBuilder + WithServerBuilder(func(RegisteredServerBuilder) RegisteredServerBuilder) RegisterServerRequestBuilder // Build builds the RegisterServerRequest or returns an error if something is wrong Build() (RegisterServerRequest, error) // MustBuild does the same as Build but panics on error @@ -120,42 +120,42 @@ func (b *_RegisterServerRequestBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterServerRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, server ExtensionObjectDefinition) RegisterServerRequestBuilder { +func (b *_RegisterServerRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, server RegisteredServer) RegisterServerRequestBuilder { return b.WithRequestHeader(requestHeader).WithServer(server) } -func (b *_RegisterServerRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) RegisterServerRequestBuilder { +func (b *_RegisterServerRequestBuilder) WithRequestHeader(requestHeader RequestHeader) RegisterServerRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_RegisterServerRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServerRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) RegisterServerRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_RegisterServerRequestBuilder) WithServer(server ExtensionObjectDefinition) RegisterServerRequestBuilder { +func (b *_RegisterServerRequestBuilder) WithServer(server RegisteredServer) RegisterServerRequestBuilder { b.Server = server return b } -func (b *_RegisterServerRequestBuilder) WithServerBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerRequestBuilder { - builder := builderSupplier(b.Server.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServerRequestBuilder) WithServerBuilder(builderSupplier func(RegisteredServerBuilder) RegisteredServerBuilder) RegisterServerRequestBuilder { + builder := builderSupplier(b.Server.CreateRegisteredServerBuilder()) var err error b.Server, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RegisteredServerBuilder failed")) } return b } @@ -222,8 +222,8 @@ func (b *_RegisterServerRequest) CreateRegisterServerRequestBuilder() RegisterSe /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterServerRequest) GetIdentifier() string { - return "437" +func (m *_RegisterServerRequest) GetExtensionId() int32 { + return int32(437) } /////////////////////// @@ -240,11 +240,11 @@ func (m *_RegisterServerRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterServerRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_RegisterServerRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_RegisterServerRequest) GetServer() ExtensionObjectDefinition { +func (m *_RegisterServerRequest) GetServer() RegisteredServer { return m.Server } @@ -284,7 +284,7 @@ func (m *_RegisterServerRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterServerRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerServerRequest RegisterServerRequest, err error) { +func (m *_RegisterServerRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerServerRequest RegisterServerRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -295,13 +295,13 @@ func (m *_RegisterServerRequest) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - server, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "server", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("434")), readBuffer)) + server, err := ReadSimpleField[RegisteredServer](ctx, "server", ReadComplex[RegisteredServer](ExtensionObjectDefinitionParseWithBufferProducer[RegisteredServer]((int32)(int32(434))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'server' field")) } @@ -332,11 +332,11 @@ func (m *_RegisterServerRequest) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for RegisterServerRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "server", m.GetServer(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RegisteredServer](ctx, "server", m.GetServer(), WriteComplex[RegisteredServer](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'server' field") } @@ -360,8 +360,8 @@ func (m *_RegisterServerRequest) deepCopy() *_RegisterServerRequest { } _RegisterServerRequestCopy := &_RegisterServerRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.Server.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), + m.Server.DeepCopy().(RegisteredServer), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _RegisterServerRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/RegisterServerResponse.go b/plc4go/protocols/opcua/readwrite/model/RegisterServerResponse.go index f1db314959a..d08eb389cab 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisterServerResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisterServerResponse.go @@ -41,7 +41,7 @@ type RegisterServerResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // IsRegisterServerResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsRegisterServerResponse() // CreateBuilder creates a RegisterServerResponseBuilder @@ -51,16 +51,16 @@ type RegisterServerResponse interface { // _RegisterServerResponse is the data-structure of this message type _RegisterServerResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader } var _ RegisterServerResponse = (*_RegisterServerResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisterServerResponse)(nil) // NewRegisterServerResponse factory function for _RegisterServerResponse -func NewRegisterServerResponse(responseHeader ExtensionObjectDefinition) *_RegisterServerResponse { +func NewRegisterServerResponse(responseHeader ResponseHeader) *_RegisterServerResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for RegisterServerResponse must not be nil") + panic("responseHeader of type ResponseHeader for RegisterServerResponse must not be nil") } _result := &_RegisterServerResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewRegisterServerResponse(responseHeader ExtensionObjectDefinition) *_Regis type RegisterServerResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition) RegisterServerResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader) RegisterServerResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) RegisterServerResponseBuilder + WithResponseHeader(ResponseHeader) RegisterServerResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterServerResponseBuilder // Build builds the RegisterServerResponse or returns an error if something is wrong Build() (RegisterServerResponse, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_RegisterServerResponseBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisterServerResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition) RegisterServerResponseBuilder { +func (b *_RegisterServerResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader) RegisterServerResponseBuilder { return b.WithResponseHeader(responseHeader) } -func (b *_RegisterServerResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) RegisterServerResponseBuilder { +func (b *_RegisterServerResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) RegisterServerResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_RegisterServerResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RegisterServerResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RegisterServerResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) RegisterServerResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_RegisterServerResponse) CreateRegisterServerResponseBuilder() Register /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisterServerResponse) GetIdentifier() string { - return "440" +func (m *_RegisterServerResponse) GetExtensionId() int32 { + return int32(440) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_RegisterServerResponse) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RegisterServerResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_RegisterServerResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -242,7 +242,7 @@ func (m *_RegisterServerResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisterServerResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registerServerResponse RegisterServerResponse, err error) { +func (m *_RegisterServerResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registerServerResponse RegisterServerResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_RegisterServerResponse) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -284,7 +284,7 @@ func (m *_RegisterServerResponse) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for RegisterServerResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -308,7 +308,7 @@ func (m *_RegisterServerResponse) deepCopy() *_RegisterServerResponse { } _RegisterServerResponseCopy := &_RegisterServerResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _RegisterServerResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/RegisteredServer.go b/plc4go/protocols/opcua/readwrite/model/RegisteredServer.go index 054b0fe24eb..d288ca08e61 100644 --- a/plc4go/protocols/opcua/readwrite/model/RegisteredServer.go +++ b/plc4go/protocols/opcua/readwrite/model/RegisteredServer.go @@ -44,16 +44,12 @@ type RegisteredServer interface { GetServerUri() PascalString // GetProductUri returns ProductUri (property field) GetProductUri() PascalString - // GetNoOfServerNames returns NoOfServerNames (property field) - GetNoOfServerNames() int32 // GetServerNames returns ServerNames (property field) GetServerNames() []LocalizedText // GetServerType returns ServerType (property field) GetServerType() ApplicationType // GetGatewayServerUri returns GatewayServerUri (property field) GetGatewayServerUri() PascalString - // GetNoOfDiscoveryUrls returns NoOfDiscoveryUrls (property field) - GetNoOfDiscoveryUrls() int32 // GetDiscoveryUrls returns DiscoveryUrls (property field) GetDiscoveryUrls() []PascalString // GetSemaphoreFilePath returns SemaphoreFilePath (property field) @@ -71,11 +67,9 @@ type _RegisteredServer struct { ExtensionObjectDefinitionContract ServerUri PascalString ProductUri PascalString - NoOfServerNames int32 ServerNames []LocalizedText ServerType ApplicationType GatewayServerUri PascalString - NoOfDiscoveryUrls int32 DiscoveryUrls []PascalString SemaphoreFilePath PascalString IsOnline bool @@ -87,7 +81,7 @@ var _ RegisteredServer = (*_RegisteredServer)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RegisteredServer)(nil) // NewRegisteredServer factory function for _RegisteredServer -func NewRegisteredServer(serverUri PascalString, productUri PascalString, noOfServerNames int32, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) *_RegisteredServer { +func NewRegisteredServer(serverUri PascalString, productUri PascalString, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) *_RegisteredServer { if serverUri == nil { panic("serverUri of type PascalString for RegisteredServer must not be nil") } @@ -104,11 +98,9 @@ func NewRegisteredServer(serverUri PascalString, productUri PascalString, noOfSe ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ServerUri: serverUri, ProductUri: productUri, - NoOfServerNames: noOfServerNames, ServerNames: serverNames, ServerType: serverType, GatewayServerUri: gatewayServerUri, - NoOfDiscoveryUrls: noOfDiscoveryUrls, DiscoveryUrls: discoveryUrls, SemaphoreFilePath: semaphoreFilePath, IsOnline: isOnline, @@ -126,7 +118,7 @@ func NewRegisteredServer(serverUri PascalString, productUri PascalString, noOfSe type RegisteredServerBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(serverUri PascalString, productUri PascalString, noOfServerNames int32, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) RegisteredServerBuilder + WithMandatoryFields(serverUri PascalString, productUri PascalString, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) RegisteredServerBuilder // WithServerUri adds ServerUri (property field) WithServerUri(PascalString) RegisteredServerBuilder // WithServerUriBuilder adds ServerUri (property field) which is build by the builder @@ -135,8 +127,6 @@ type RegisteredServerBuilder interface { WithProductUri(PascalString) RegisteredServerBuilder // WithProductUriBuilder adds ProductUri (property field) which is build by the builder WithProductUriBuilder(func(PascalStringBuilder) PascalStringBuilder) RegisteredServerBuilder - // WithNoOfServerNames adds NoOfServerNames (property field) - WithNoOfServerNames(int32) RegisteredServerBuilder // WithServerNames adds ServerNames (property field) WithServerNames(...LocalizedText) RegisteredServerBuilder // WithServerType adds ServerType (property field) @@ -145,8 +135,6 @@ type RegisteredServerBuilder interface { WithGatewayServerUri(PascalString) RegisteredServerBuilder // WithGatewayServerUriBuilder adds GatewayServerUri (property field) which is build by the builder WithGatewayServerUriBuilder(func(PascalStringBuilder) PascalStringBuilder) RegisteredServerBuilder - // WithNoOfDiscoveryUrls adds NoOfDiscoveryUrls (property field) - WithNoOfDiscoveryUrls(int32) RegisteredServerBuilder // WithDiscoveryUrls adds DiscoveryUrls (property field) WithDiscoveryUrls(...PascalString) RegisteredServerBuilder // WithSemaphoreFilePath adds SemaphoreFilePath (property field) @@ -180,8 +168,8 @@ func (b *_RegisteredServerBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_RegisteredServerBuilder) WithMandatoryFields(serverUri PascalString, productUri PascalString, noOfServerNames int32, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, noOfDiscoveryUrls int32, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) RegisteredServerBuilder { - return b.WithServerUri(serverUri).WithProductUri(productUri).WithNoOfServerNames(noOfServerNames).WithServerNames(serverNames...).WithServerType(serverType).WithGatewayServerUri(gatewayServerUri).WithNoOfDiscoveryUrls(noOfDiscoveryUrls).WithDiscoveryUrls(discoveryUrls...).WithSemaphoreFilePath(semaphoreFilePath).WithIsOnline(isOnline) +func (b *_RegisteredServerBuilder) WithMandatoryFields(serverUri PascalString, productUri PascalString, serverNames []LocalizedText, serverType ApplicationType, gatewayServerUri PascalString, discoveryUrls []PascalString, semaphoreFilePath PascalString, isOnline bool) RegisteredServerBuilder { + return b.WithServerUri(serverUri).WithProductUri(productUri).WithServerNames(serverNames...).WithServerType(serverType).WithGatewayServerUri(gatewayServerUri).WithDiscoveryUrls(discoveryUrls...).WithSemaphoreFilePath(semaphoreFilePath).WithIsOnline(isOnline) } func (b *_RegisteredServerBuilder) WithServerUri(serverUri PascalString) RegisteredServerBuilder { @@ -220,11 +208,6 @@ func (b *_RegisteredServerBuilder) WithProductUriBuilder(builderSupplier func(Pa return b } -func (b *_RegisteredServerBuilder) WithNoOfServerNames(noOfServerNames int32) RegisteredServerBuilder { - b.NoOfServerNames = noOfServerNames - return b -} - func (b *_RegisteredServerBuilder) WithServerNames(serverNames ...LocalizedText) RegisteredServerBuilder { b.ServerNames = serverNames return b @@ -253,11 +236,6 @@ func (b *_RegisteredServerBuilder) WithGatewayServerUriBuilder(builderSupplier f return b } -func (b *_RegisteredServerBuilder) WithNoOfDiscoveryUrls(noOfDiscoveryUrls int32) RegisteredServerBuilder { - b.NoOfDiscoveryUrls = noOfDiscoveryUrls - return b -} - func (b *_RegisteredServerBuilder) WithDiscoveryUrls(discoveryUrls ...PascalString) RegisteredServerBuilder { b.DiscoveryUrls = discoveryUrls return b @@ -360,8 +338,8 @@ func (b *_RegisteredServer) CreateRegisteredServerBuilder() RegisteredServerBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RegisteredServer) GetIdentifier() string { - return "434" +func (m *_RegisteredServer) GetExtensionId() int32 { + return int32(434) } /////////////////////// @@ -386,10 +364,6 @@ func (m *_RegisteredServer) GetProductUri() PascalString { return m.ProductUri } -func (m *_RegisteredServer) GetNoOfServerNames() int32 { - return m.NoOfServerNames -} - func (m *_RegisteredServer) GetServerNames() []LocalizedText { return m.ServerNames } @@ -402,10 +376,6 @@ func (m *_RegisteredServer) GetGatewayServerUri() PascalString { return m.GatewayServerUri } -func (m *_RegisteredServer) GetNoOfDiscoveryUrls() int32 { - return m.NoOfDiscoveryUrls -} - func (m *_RegisteredServer) GetDiscoveryUrls() []PascalString { return m.DiscoveryUrls } @@ -447,7 +417,7 @@ func (m *_RegisteredServer) GetLengthInBits(ctx context.Context) uint16 { // Simple field (productUri) lengthInBits += m.ProductUri.GetLengthInBits(ctx) - // Simple field (noOfServerNames) + // Implicit Field (noOfServerNames) lengthInBits += 32 // Array field @@ -466,7 +436,7 @@ func (m *_RegisteredServer) GetLengthInBits(ctx context.Context) uint16 { // Simple field (gatewayServerUri) lengthInBits += m.GatewayServerUri.GetLengthInBits(ctx) - // Simple field (noOfDiscoveryUrls) + // Implicit Field (noOfDiscoveryUrls) lengthInBits += 32 // Array field @@ -495,7 +465,7 @@ func (m *_RegisteredServer) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RegisteredServer) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__registeredServer RegisteredServer, err error) { +func (m *_RegisteredServer) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__registeredServer RegisteredServer, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -518,11 +488,11 @@ func (m *_RegisteredServer) parse(ctx context.Context, readBuffer utils.ReadBuff } m.ProductUri = productUri - noOfServerNames, err := ReadSimpleField(ctx, "noOfServerNames", ReadSignedInt(readBuffer, uint8(32))) + noOfServerNames, err := ReadImplicitField[int32](ctx, "noOfServerNames", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerNames' field")) } - m.NoOfServerNames = noOfServerNames + _ = noOfServerNames serverNames, err := ReadCountArrayField[LocalizedText](ctx, "serverNames", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer), uint64(noOfServerNames)) if err != nil { @@ -542,11 +512,11 @@ func (m *_RegisteredServer) parse(ctx context.Context, readBuffer utils.ReadBuff } m.GatewayServerUri = gatewayServerUri - noOfDiscoveryUrls, err := ReadSimpleField(ctx, "noOfDiscoveryUrls", ReadSignedInt(readBuffer, uint8(32))) + noOfDiscoveryUrls, err := ReadImplicitField[int32](ctx, "noOfDiscoveryUrls", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiscoveryUrls' field")) } - m.NoOfDiscoveryUrls = noOfDiscoveryUrls + _ = noOfDiscoveryUrls discoveryUrls, err := ReadCountArrayField[PascalString](ctx, "discoveryUrls", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfDiscoveryUrls)) if err != nil { @@ -604,8 +574,8 @@ func (m *_RegisteredServer) SerializeWithWriteBuffer(ctx context.Context, writeB if err := WriteSimpleField[PascalString](ctx, "productUri", m.GetProductUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'productUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerNames", m.GetNoOfServerNames(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerNames := int32(utils.InlineIf(bool((m.GetServerNames()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerNames()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerNames", noOfServerNames, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerNames' field") } @@ -620,8 +590,8 @@ func (m *_RegisteredServer) SerializeWithWriteBuffer(ctx context.Context, writeB if err := WriteSimpleField[PascalString](ctx, "gatewayServerUri", m.GetGatewayServerUri(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'gatewayServerUri' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiscoveryUrls", m.GetNoOfDiscoveryUrls(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiscoveryUrls := int32(utils.InlineIf(bool((m.GetDiscoveryUrls()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiscoveryUrls()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiscoveryUrls", noOfDiscoveryUrls, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiscoveryUrls' field") } @@ -663,11 +633,9 @@ func (m *_RegisteredServer) deepCopy() *_RegisteredServer { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.ServerUri.DeepCopy().(PascalString), m.ProductUri.DeepCopy().(PascalString), - m.NoOfServerNames, utils.DeepCopySlice[LocalizedText, LocalizedText](m.ServerNames), m.ServerType, m.GatewayServerUri.DeepCopy().(PascalString), - m.NoOfDiscoveryUrls, utils.DeepCopySlice[PascalString, PascalString](m.DiscoveryUrls), m.SemaphoreFilePath.DeepCopy().(PascalString), m.IsOnline, diff --git a/plc4go/protocols/opcua/readwrite/model/RelativePath.go b/plc4go/protocols/opcua/readwrite/model/RelativePath.go index ab4f02a6e31..a83c74452e2 100644 --- a/plc4go/protocols/opcua/readwrite/model/RelativePath.go +++ b/plc4go/protocols/opcua/readwrite/model/RelativePath.go @@ -40,10 +40,8 @@ type RelativePath interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfElements returns NoOfElements (property field) - GetNoOfElements() int32 // GetElements returns Elements (property field) - GetElements() []ExtensionObjectDefinition + GetElements() []RelativePathElement // IsRelativePath is a marker method to prevent unintentional type checks (interfaces of same signature) IsRelativePath() // CreateBuilder creates a RelativePathBuilder @@ -53,18 +51,16 @@ type RelativePath interface { // _RelativePath is the data-structure of this message type _RelativePath struct { ExtensionObjectDefinitionContract - NoOfElements int32 - Elements []ExtensionObjectDefinition + Elements []RelativePathElement } var _ RelativePath = (*_RelativePath)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RelativePath)(nil) // NewRelativePath factory function for _RelativePath -func NewRelativePath(noOfElements int32, elements []ExtensionObjectDefinition) *_RelativePath { +func NewRelativePath(elements []RelativePathElement) *_RelativePath { _result := &_RelativePath{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfElements: noOfElements, Elements: elements, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -80,11 +76,9 @@ func NewRelativePath(noOfElements int32, elements []ExtensionObjectDefinition) * type RelativePathBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfElements int32, elements []ExtensionObjectDefinition) RelativePathBuilder - // WithNoOfElements adds NoOfElements (property field) - WithNoOfElements(int32) RelativePathBuilder + WithMandatoryFields(elements []RelativePathElement) RelativePathBuilder // WithElements adds Elements (property field) - WithElements(...ExtensionObjectDefinition) RelativePathBuilder + WithElements(...RelativePathElement) RelativePathBuilder // Build builds the RelativePath or returns an error if something is wrong Build() (RelativePath, error) // MustBuild does the same as Build but panics on error @@ -110,16 +104,11 @@ func (b *_RelativePathBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_RelativePathBuilder) WithMandatoryFields(noOfElements int32, elements []ExtensionObjectDefinition) RelativePathBuilder { - return b.WithNoOfElements(noOfElements).WithElements(elements...) +func (b *_RelativePathBuilder) WithMandatoryFields(elements []RelativePathElement) RelativePathBuilder { + return b.WithElements(elements...) } -func (b *_RelativePathBuilder) WithNoOfElements(noOfElements int32) RelativePathBuilder { - b.NoOfElements = noOfElements - return b -} - -func (b *_RelativePathBuilder) WithElements(elements ...ExtensionObjectDefinition) RelativePathBuilder { +func (b *_RelativePathBuilder) WithElements(elements ...RelativePathElement) RelativePathBuilder { b.Elements = elements return b } @@ -174,8 +163,8 @@ func (b *_RelativePath) CreateRelativePathBuilder() RelativePathBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RelativePath) GetIdentifier() string { - return "542" +func (m *_RelativePath) GetExtensionId() int32 { + return int32(542) } /////////////////////// @@ -192,11 +181,7 @@ func (m *_RelativePath) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RelativePath) GetNoOfElements() int32 { - return m.NoOfElements -} - -func (m *_RelativePath) GetElements() []ExtensionObjectDefinition { +func (m *_RelativePath) GetElements() []RelativePathElement { return m.Elements } @@ -223,7 +208,7 @@ func (m *_RelativePath) GetTypeName() string { func (m *_RelativePath) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfElements) + // Implicit Field (noOfElements) lengthInBits += 32 // Array field @@ -243,7 +228,7 @@ func (m *_RelativePath) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RelativePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__relativePath RelativePath, err error) { +func (m *_RelativePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__relativePath RelativePath, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -254,13 +239,13 @@ func (m *_RelativePath) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - noOfElements, err := ReadSimpleField(ctx, "noOfElements", ReadSignedInt(readBuffer, uint8(32))) + noOfElements, err := ReadImplicitField[int32](ctx, "noOfElements", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfElements' field")) } - m.NoOfElements = noOfElements + _ = noOfElements - elements, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "elements", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("539")), readBuffer), uint64(noOfElements)) + elements, err := ReadCountArrayField[RelativePathElement](ctx, "elements", ReadComplex[RelativePathElement](ExtensionObjectDefinitionParseWithBufferProducer[RelativePathElement]((int32)(int32(539))), readBuffer), uint64(noOfElements)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'elements' field")) } @@ -290,8 +275,8 @@ func (m *_RelativePath) SerializeWithWriteBuffer(ctx context.Context, writeBuffe if pushErr := writeBuffer.PushContext("RelativePath"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for RelativePath") } - - if err := WriteSimpleField[int32](ctx, "noOfElements", m.GetNoOfElements(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfElements := int32(utils.InlineIf(bool((m.GetElements()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetElements()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfElements", noOfElements, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfElements' field") } @@ -319,8 +304,7 @@ func (m *_RelativePath) deepCopy() *_RelativePath { } _RelativePathCopy := &_RelativePath{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfElements, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Elements), + utils.DeepCopySlice[RelativePathElement, RelativePathElement](m.Elements), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _RelativePathCopy diff --git a/plc4go/protocols/opcua/readwrite/model/RelativePathElement.go b/plc4go/protocols/opcua/readwrite/model/RelativePathElement.go index 5c8cbab55cc..ecab6fa8825 100644 --- a/plc4go/protocols/opcua/readwrite/model/RelativePathElement.go +++ b/plc4go/protocols/opcua/readwrite/model/RelativePathElement.go @@ -246,8 +246,8 @@ func (b *_RelativePathElement) CreateRelativePathElementBuilder() RelativePathEl /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RelativePathElement) GetIdentifier() string { - return "539" +func (m *_RelativePathElement) GetExtensionId() int32 { + return int32(539) } /////////////////////// @@ -325,7 +325,7 @@ func (m *_RelativePathElement) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RelativePathElement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__relativePathElement RelativePathElement, err error) { +func (m *_RelativePathElement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__relativePathElement RelativePathElement, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/RepublishRequest.go b/plc4go/protocols/opcua/readwrite/model/RepublishRequest.go index 4f9fa02ded1..46eee949830 100644 --- a/plc4go/protocols/opcua/readwrite/model/RepublishRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/RepublishRequest.go @@ -41,7 +41,7 @@ type RepublishRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetRetransmitSequenceNumber returns RetransmitSequenceNumber (property field) @@ -55,7 +55,7 @@ type RepublishRequest interface { // _RepublishRequest is the data-structure of this message type _RepublishRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition + RequestHeader RequestHeader SubscriptionId uint32 RetransmitSequenceNumber uint32 } @@ -64,9 +64,9 @@ var _ RepublishRequest = (*_RepublishRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RepublishRequest)(nil) // NewRepublishRequest factory function for _RepublishRequest -func NewRepublishRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, retransmitSequenceNumber uint32) *_RepublishRequest { +func NewRepublishRequest(requestHeader RequestHeader, subscriptionId uint32, retransmitSequenceNumber uint32) *_RepublishRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for RepublishRequest must not be nil") + panic("requestHeader of type RequestHeader for RepublishRequest must not be nil") } _result := &_RepublishRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -87,11 +87,11 @@ func NewRepublishRequest(requestHeader ExtensionObjectDefinition, subscriptionId type RepublishRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, retransmitSequenceNumber uint32) RepublishRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, retransmitSequenceNumber uint32) RepublishRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) RepublishRequestBuilder + WithRequestHeader(RequestHeader) RepublishRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) RepublishRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) RepublishRequestBuilder // WithRetransmitSequenceNumber adds RetransmitSequenceNumber (property field) @@ -121,24 +121,24 @@ func (b *_RepublishRequestBuilder) setParent(contract ExtensionObjectDefinitionC b.ExtensionObjectDefinitionContract = contract } -func (b *_RepublishRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, retransmitSequenceNumber uint32) RepublishRequestBuilder { +func (b *_RepublishRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, retransmitSequenceNumber uint32) RepublishRequestBuilder { return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithRetransmitSequenceNumber(retransmitSequenceNumber) } -func (b *_RepublishRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) RepublishRequestBuilder { +func (b *_RepublishRequestBuilder) WithRequestHeader(requestHeader RequestHeader) RepublishRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_RepublishRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RepublishRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) RepublishRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -209,8 +209,8 @@ func (b *_RepublishRequest) CreateRepublishRequestBuilder() RepublishRequestBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RepublishRequest) GetIdentifier() string { - return "832" +func (m *_RepublishRequest) GetExtensionId() int32 { + return int32(832) } /////////////////////// @@ -227,7 +227,7 @@ func (m *_RepublishRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RepublishRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_RepublishRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -278,7 +278,7 @@ func (m *_RepublishRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RepublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__republishRequest RepublishRequest, err error) { +func (m *_RepublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__republishRequest RepublishRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -289,7 +289,7 @@ func (m *_RepublishRequest) parse(ctx context.Context, readBuffer utils.ReadBuff currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -332,7 +332,7 @@ func (m *_RepublishRequest) SerializeWithWriteBuffer(ctx context.Context, writeB return errors.Wrap(pushErr, "Error pushing for RepublishRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -364,7 +364,7 @@ func (m *_RepublishRequest) deepCopy() *_RepublishRequest { } _RepublishRequestCopy := &_RepublishRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.RetransmitSequenceNumber, } diff --git a/plc4go/protocols/opcua/readwrite/model/RepublishResponse.go b/plc4go/protocols/opcua/readwrite/model/RepublishResponse.go index d9ea5e61631..e1235c7944c 100644 --- a/plc4go/protocols/opcua/readwrite/model/RepublishResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/RepublishResponse.go @@ -41,9 +41,9 @@ type RepublishResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // GetNotificationMessage returns NotificationMessage (property field) - GetNotificationMessage() ExtensionObjectDefinition + GetNotificationMessage() NotificationMessage // IsRepublishResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsRepublishResponse() // CreateBuilder creates a RepublishResponseBuilder @@ -53,20 +53,20 @@ type RepublishResponse interface { // _RepublishResponse is the data-structure of this message type _RepublishResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NotificationMessage ExtensionObjectDefinition + ResponseHeader ResponseHeader + NotificationMessage NotificationMessage } var _ RepublishResponse = (*_RepublishResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_RepublishResponse)(nil) // NewRepublishResponse factory function for _RepublishResponse -func NewRepublishResponse(responseHeader ExtensionObjectDefinition, notificationMessage ExtensionObjectDefinition) *_RepublishResponse { +func NewRepublishResponse(responseHeader ResponseHeader, notificationMessage NotificationMessage) *_RepublishResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for RepublishResponse must not be nil") + panic("responseHeader of type ResponseHeader for RepublishResponse must not be nil") } if notificationMessage == nil { - panic("notificationMessage of type ExtensionObjectDefinition for RepublishResponse must not be nil") + panic("notificationMessage of type NotificationMessage for RepublishResponse must not be nil") } _result := &_RepublishResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -86,15 +86,15 @@ func NewRepublishResponse(responseHeader ExtensionObjectDefinition, notification type RepublishResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, notificationMessage ExtensionObjectDefinition) RepublishResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, notificationMessage NotificationMessage) RepublishResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) RepublishResponseBuilder + WithResponseHeader(ResponseHeader) RepublishResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) RepublishResponseBuilder // WithNotificationMessage adds NotificationMessage (property field) - WithNotificationMessage(ExtensionObjectDefinition) RepublishResponseBuilder + WithNotificationMessage(NotificationMessage) RepublishResponseBuilder // WithNotificationMessageBuilder adds NotificationMessage (property field) which is build by the builder - WithNotificationMessageBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishResponseBuilder + WithNotificationMessageBuilder(func(NotificationMessageBuilder) NotificationMessageBuilder) RepublishResponseBuilder // Build builds the RepublishResponse or returns an error if something is wrong Build() (RepublishResponse, error) // MustBuild does the same as Build but panics on error @@ -120,42 +120,42 @@ func (b *_RepublishResponseBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_RepublishResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, notificationMessage ExtensionObjectDefinition) RepublishResponseBuilder { +func (b *_RepublishResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, notificationMessage NotificationMessage) RepublishResponseBuilder { return b.WithResponseHeader(responseHeader).WithNotificationMessage(notificationMessage) } -func (b *_RepublishResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) RepublishResponseBuilder { +func (b *_RepublishResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) RepublishResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_RepublishResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_RepublishResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) RepublishResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_RepublishResponseBuilder) WithNotificationMessage(notificationMessage ExtensionObjectDefinition) RepublishResponseBuilder { +func (b *_RepublishResponseBuilder) WithNotificationMessage(notificationMessage NotificationMessage) RepublishResponseBuilder { b.NotificationMessage = notificationMessage return b } -func (b *_RepublishResponseBuilder) WithNotificationMessageBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RepublishResponseBuilder { - builder := builderSupplier(b.NotificationMessage.CreateExtensionObjectDefinitionBuilder()) +func (b *_RepublishResponseBuilder) WithNotificationMessageBuilder(builderSupplier func(NotificationMessageBuilder) NotificationMessageBuilder) RepublishResponseBuilder { + builder := builderSupplier(b.NotificationMessage.CreateNotificationMessageBuilder()) var err error b.NotificationMessage, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "NotificationMessageBuilder failed")) } return b } @@ -222,8 +222,8 @@ func (b *_RepublishResponse) CreateRepublishResponseBuilder() RepublishResponseB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RepublishResponse) GetIdentifier() string { - return "835" +func (m *_RepublishResponse) GetExtensionId() int32 { + return int32(835) } /////////////////////// @@ -240,11 +240,11 @@ func (m *_RepublishResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_RepublishResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_RepublishResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_RepublishResponse) GetNotificationMessage() ExtensionObjectDefinition { +func (m *_RepublishResponse) GetNotificationMessage() NotificationMessage { return m.NotificationMessage } @@ -284,7 +284,7 @@ func (m *_RepublishResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RepublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__republishResponse RepublishResponse, err error) { +func (m *_RepublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__republishResponse RepublishResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -295,13 +295,13 @@ func (m *_RepublishResponse) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - notificationMessage, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "notificationMessage", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("805")), readBuffer)) + notificationMessage, err := ReadSimpleField[NotificationMessage](ctx, "notificationMessage", ReadComplex[NotificationMessage](ExtensionObjectDefinitionParseWithBufferProducer[NotificationMessage]((int32)(int32(805))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationMessage' field")) } @@ -332,11 +332,11 @@ func (m *_RepublishResponse) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for RepublishResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "notificationMessage", m.GetNotificationMessage(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[NotificationMessage](ctx, "notificationMessage", m.GetNotificationMessage(), WriteComplex[NotificationMessage](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'notificationMessage' field") } @@ -360,8 +360,8 @@ func (m *_RepublishResponse) deepCopy() *_RepublishResponse { } _RepublishResponseCopy := &_RepublishResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NotificationMessage.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), + m.NotificationMessage.DeepCopy().(NotificationMessage), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _RepublishResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/RequestHeader.go b/plc4go/protocols/opcua/readwrite/model/RequestHeader.go index f4a03636b21..11d2865e435 100644 --- a/plc4go/protocols/opcua/readwrite/model/RequestHeader.go +++ b/plc4go/protocols/opcua/readwrite/model/RequestHeader.go @@ -301,8 +301,8 @@ func (b *_RequestHeader) CreateRequestHeaderBuilder() RequestHeaderBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RequestHeader) GetIdentifier() string { - return "391" +func (m *_RequestHeader) GetExtensionId() int32 { + return int32(391) } /////////////////////// @@ -398,7 +398,7 @@ func (m *_RequestHeader) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RequestHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__requestHeader RequestHeader, err error) { +func (m *_RequestHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__requestHeader RequestHeader, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -445,7 +445,7 @@ func (m *_RequestHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.TimeoutHint = timeoutHint - additionalHeader, err := ReadSimpleField[ExtensionObject](ctx, "additionalHeader", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + additionalHeader, err := ReadSimpleField[ExtensionObject](ctx, "additionalHeader", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'additionalHeader' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/ResponseHeader.go b/plc4go/protocols/opcua/readwrite/model/ResponseHeader.go index 1289aa23ba3..d550cf03bac 100644 --- a/plc4go/protocols/opcua/readwrite/model/ResponseHeader.go +++ b/plc4go/protocols/opcua/readwrite/model/ResponseHeader.go @@ -48,8 +48,6 @@ type ResponseHeader interface { GetServiceResult() StatusCode // GetServiceDiagnostics returns ServiceDiagnostics (property field) GetServiceDiagnostics() DiagnosticInfo - // GetNoOfStringTable returns NoOfStringTable (property field) - GetNoOfStringTable() int32 // GetStringTable returns StringTable (property field) GetStringTable() []PascalString // GetAdditionalHeader returns AdditionalHeader (property field) @@ -67,7 +65,6 @@ type _ResponseHeader struct { RequestHandle uint32 ServiceResult StatusCode ServiceDiagnostics DiagnosticInfo - NoOfStringTable int32 StringTable []PascalString AdditionalHeader ExtensionObject } @@ -76,7 +73,7 @@ var _ ResponseHeader = (*_ResponseHeader)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ResponseHeader)(nil) // NewResponseHeader factory function for _ResponseHeader -func NewResponseHeader(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, noOfStringTable int32, stringTable []PascalString, additionalHeader ExtensionObject) *_ResponseHeader { +func NewResponseHeader(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, stringTable []PascalString, additionalHeader ExtensionObject) *_ResponseHeader { if serviceResult == nil { panic("serviceResult of type StatusCode for ResponseHeader must not be nil") } @@ -92,7 +89,6 @@ func NewResponseHeader(timestamp int64, requestHandle uint32, serviceResult Stat RequestHandle: requestHandle, ServiceResult: serviceResult, ServiceDiagnostics: serviceDiagnostics, - NoOfStringTable: noOfStringTable, StringTable: stringTable, AdditionalHeader: additionalHeader, } @@ -109,7 +105,7 @@ func NewResponseHeader(timestamp int64, requestHandle uint32, serviceResult Stat type ResponseHeaderBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, noOfStringTable int32, stringTable []PascalString, additionalHeader ExtensionObject) ResponseHeaderBuilder + WithMandatoryFields(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, stringTable []PascalString, additionalHeader ExtensionObject) ResponseHeaderBuilder // WithTimestamp adds Timestamp (property field) WithTimestamp(int64) ResponseHeaderBuilder // WithRequestHandle adds RequestHandle (property field) @@ -122,8 +118,6 @@ type ResponseHeaderBuilder interface { WithServiceDiagnostics(DiagnosticInfo) ResponseHeaderBuilder // WithServiceDiagnosticsBuilder adds ServiceDiagnostics (property field) which is build by the builder WithServiceDiagnosticsBuilder(func(DiagnosticInfoBuilder) DiagnosticInfoBuilder) ResponseHeaderBuilder - // WithNoOfStringTable adds NoOfStringTable (property field) - WithNoOfStringTable(int32) ResponseHeaderBuilder // WithStringTable adds StringTable (property field) WithStringTable(...PascalString) ResponseHeaderBuilder // WithAdditionalHeader adds AdditionalHeader (property field) @@ -155,8 +149,8 @@ func (b *_ResponseHeaderBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_ResponseHeaderBuilder) WithMandatoryFields(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, noOfStringTable int32, stringTable []PascalString, additionalHeader ExtensionObject) ResponseHeaderBuilder { - return b.WithTimestamp(timestamp).WithRequestHandle(requestHandle).WithServiceResult(serviceResult).WithServiceDiagnostics(serviceDiagnostics).WithNoOfStringTable(noOfStringTable).WithStringTable(stringTable...).WithAdditionalHeader(additionalHeader) +func (b *_ResponseHeaderBuilder) WithMandatoryFields(timestamp int64, requestHandle uint32, serviceResult StatusCode, serviceDiagnostics DiagnosticInfo, stringTable []PascalString, additionalHeader ExtensionObject) ResponseHeaderBuilder { + return b.WithTimestamp(timestamp).WithRequestHandle(requestHandle).WithServiceResult(serviceResult).WithServiceDiagnostics(serviceDiagnostics).WithStringTable(stringTable...).WithAdditionalHeader(additionalHeader) } func (b *_ResponseHeaderBuilder) WithTimestamp(timestamp int64) ResponseHeaderBuilder { @@ -205,11 +199,6 @@ func (b *_ResponseHeaderBuilder) WithServiceDiagnosticsBuilder(builderSupplier f return b } -func (b *_ResponseHeaderBuilder) WithNoOfStringTable(noOfStringTable int32) ResponseHeaderBuilder { - b.NoOfStringTable = noOfStringTable - return b -} - func (b *_ResponseHeaderBuilder) WithStringTable(stringTable ...PascalString) ResponseHeaderBuilder { b.StringTable = stringTable return b @@ -301,8 +290,8 @@ func (b *_ResponseHeader) CreateResponseHeaderBuilder() ResponseHeaderBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ResponseHeader) GetIdentifier() string { - return "394" +func (m *_ResponseHeader) GetExtensionId() int32 { + return int32(394) } /////////////////////// @@ -335,10 +324,6 @@ func (m *_ResponseHeader) GetServiceDiagnostics() DiagnosticInfo { return m.ServiceDiagnostics } -func (m *_ResponseHeader) GetNoOfStringTable() int32 { - return m.NoOfStringTable -} - func (m *_ResponseHeader) GetStringTable() []PascalString { return m.StringTable } @@ -382,7 +367,7 @@ func (m *_ResponseHeader) GetLengthInBits(ctx context.Context) uint16 { // Simple field (serviceDiagnostics) lengthInBits += m.ServiceDiagnostics.GetLengthInBits(ctx) - // Simple field (noOfStringTable) + // Implicit Field (noOfStringTable) lengthInBits += 32 // Array field @@ -405,7 +390,7 @@ func (m *_ResponseHeader) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ResponseHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__responseHeader ResponseHeader, err error) { +func (m *_ResponseHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__responseHeader ResponseHeader, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -440,11 +425,11 @@ func (m *_ResponseHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.ServiceDiagnostics = serviceDiagnostics - noOfStringTable, err := ReadSimpleField(ctx, "noOfStringTable", ReadSignedInt(readBuffer, uint8(32))) + noOfStringTable, err := ReadImplicitField[int32](ctx, "noOfStringTable", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfStringTable' field")) } - m.NoOfStringTable = noOfStringTable + _ = noOfStringTable stringTable, err := ReadCountArrayField[PascalString](ctx, "stringTable", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfStringTable)) if err != nil { @@ -452,7 +437,7 @@ func (m *_ResponseHeader) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.StringTable = stringTable - additionalHeader, err := ReadSimpleField[ExtensionObject](ctx, "additionalHeader", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer)) + additionalHeader, err := ReadSimpleField[ExtensionObject](ctx, "additionalHeader", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'additionalHeader' field")) } @@ -498,8 +483,8 @@ func (m *_ResponseHeader) SerializeWithWriteBuffer(ctx context.Context, writeBuf if err := WriteSimpleField[DiagnosticInfo](ctx, "serviceDiagnostics", m.GetServiceDiagnostics(), WriteComplex[DiagnosticInfo](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'serviceDiagnostics' field") } - - if err := WriteSimpleField[int32](ctx, "noOfStringTable", m.GetNoOfStringTable(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfStringTable := int32(utils.InlineIf(bool((m.GetStringTable()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetStringTable()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfStringTable", noOfStringTable, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfStringTable' field") } @@ -535,7 +520,6 @@ func (m *_ResponseHeader) deepCopy() *_ResponseHeader { m.RequestHandle, m.ServiceResult.DeepCopy().(StatusCode), m.ServiceDiagnostics.DeepCopy().(DiagnosticInfo), - m.NoOfStringTable, utils.DeepCopySlice[PascalString, PascalString](m.StringTable), m.AdditionalHeader.DeepCopy().(ExtensionObject), } diff --git a/plc4go/protocols/opcua/readwrite/model/RolePermissionType.go b/plc4go/protocols/opcua/readwrite/model/RolePermissionType.go index c51bc0453b2..276010510af 100644 --- a/plc4go/protocols/opcua/readwrite/model/RolePermissionType.go +++ b/plc4go/protocols/opcua/readwrite/model/RolePermissionType.go @@ -198,8 +198,8 @@ func (b *_RolePermissionType) CreateRolePermissionTypeBuilder() RolePermissionTy /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_RolePermissionType) GetIdentifier() string { - return "98" +func (m *_RolePermissionType) GetExtensionId() int32 { + return int32(98) } /////////////////////// @@ -260,7 +260,7 @@ func (m *_RolePermissionType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_RolePermissionType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__rolePermissionType RolePermissionType, err error) { +func (m *_RolePermissionType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__rolePermissionType RolePermissionType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/RootExtensionObject.go b/plc4go/protocols/opcua/readwrite/model/RootExtensionObject.go new file mode 100644 index 00000000000..168be685640 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/RootExtensionObject.go @@ -0,0 +1,344 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// RootExtensionObject is the corresponding interface of RootExtensionObject +type RootExtensionObject interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObject + // GetBody returns Body (property field) + GetBody() ExtensionObjectDefinition + // IsRootExtensionObject is a marker method to prevent unintentional type checks (interfaces of same signature) + IsRootExtensionObject() + // CreateBuilder creates a RootExtensionObjectBuilder + CreateRootExtensionObjectBuilder() RootExtensionObjectBuilder +} + +// _RootExtensionObject is the data-structure of this message +type _RootExtensionObject struct { + ExtensionObjectContract + Body ExtensionObjectDefinition + + // Arguments. + ExtensionId int32 +} + +var _ RootExtensionObject = (*_RootExtensionObject)(nil) +var _ ExtensionObjectRequirements = (*_RootExtensionObject)(nil) + +// NewRootExtensionObject factory function for _RootExtensionObject +func NewRootExtensionObject(typeId ExpandedNodeId, body ExtensionObjectDefinition, extensionId int32) *_RootExtensionObject { + if body == nil { + panic("body of type ExtensionObjectDefinition for RootExtensionObject must not be nil") + } + _result := &_RootExtensionObject{ + ExtensionObjectContract: NewExtensionObject(typeId), + Body: body, + } + _result.ExtensionObjectContract.(*_ExtensionObject)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// RootExtensionObjectBuilder is a builder for RootExtensionObject +type RootExtensionObjectBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(body ExtensionObjectDefinition) RootExtensionObjectBuilder + // WithBody adds Body (property field) + WithBody(ExtensionObjectDefinition) RootExtensionObjectBuilder + // WithBodyBuilder adds Body (property field) which is build by the builder + WithBodyBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RootExtensionObjectBuilder + // Build builds the RootExtensionObject or returns an error if something is wrong + Build() (RootExtensionObject, error) + // MustBuild does the same as Build but panics on error + MustBuild() RootExtensionObject +} + +// NewRootExtensionObjectBuilder() creates a RootExtensionObjectBuilder +func NewRootExtensionObjectBuilder() RootExtensionObjectBuilder { + return &_RootExtensionObjectBuilder{_RootExtensionObject: new(_RootExtensionObject)} +} + +type _RootExtensionObjectBuilder struct { + *_RootExtensionObject + + parentBuilder *_ExtensionObjectBuilder + + err *utils.MultiError +} + +var _ (RootExtensionObjectBuilder) = (*_RootExtensionObjectBuilder)(nil) + +func (b *_RootExtensionObjectBuilder) setParent(contract ExtensionObjectContract) { + b.ExtensionObjectContract = contract +} + +func (b *_RootExtensionObjectBuilder) WithMandatoryFields(body ExtensionObjectDefinition) RootExtensionObjectBuilder { + return b.WithBody(body) +} + +func (b *_RootExtensionObjectBuilder) WithBody(body ExtensionObjectDefinition) RootExtensionObjectBuilder { + b.Body = body + return b +} + +func (b *_RootExtensionObjectBuilder) WithBodyBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) RootExtensionObjectBuilder { + builder := builderSupplier(b.Body.CreateExtensionObjectDefinitionBuilder()) + var err error + b.Body, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + } + return b +} + +func (b *_RootExtensionObjectBuilder) Build() (RootExtensionObject, error) { + if b.Body == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'body' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._RootExtensionObject.deepCopy(), nil +} + +func (b *_RootExtensionObjectBuilder) MustBuild() RootExtensionObject { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_RootExtensionObjectBuilder) Done() ExtensionObjectBuilder { + return b.parentBuilder +} + +func (b *_RootExtensionObjectBuilder) buildForExtensionObject() (ExtensionObject, error) { + return b.Build() +} + +func (b *_RootExtensionObjectBuilder) DeepCopy() any { + _copy := b.CreateRootExtensionObjectBuilder().(*_RootExtensionObjectBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateRootExtensionObjectBuilder creates a RootExtensionObjectBuilder +func (b *_RootExtensionObject) CreateRootExtensionObjectBuilder() RootExtensionObjectBuilder { + if b == nil { + return NewRootExtensionObjectBuilder() + } + return &_RootExtensionObjectBuilder{_RootExtensionObject: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_RootExtensionObject) GetIncludeEncodingMask() bool { + return bool(false) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_RootExtensionObject) GetParent() ExtensionObjectContract { + return m.ExtensionObjectContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_RootExtensionObject) GetBody() ExtensionObjectDefinition { + return m.Body +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastRootExtensionObject(structType any) RootExtensionObject { + if casted, ok := structType.(RootExtensionObject); ok { + return casted + } + if casted, ok := structType.(*RootExtensionObject); ok { + return *casted + } + return nil +} + +func (m *_RootExtensionObject) GetTypeName() string { + return "RootExtensionObject" +} + +func (m *_RootExtensionObject) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectContract.(*_ExtensionObject).getLengthInBits(ctx)) + + // Simple field (body) + lengthInBits += m.Body.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_RootExtensionObject) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_RootExtensionObject) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObject, extensionId int32, includeEncodingMask bool) (__rootExtensionObject RootExtensionObject, err error) { + m.ExtensionObjectContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("RootExtensionObject"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for RootExtensionObject") + } + currentPos := positionAware.GetPos() + _ = currentPos + + body, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "body", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((int32)(extensionId)), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'body' field")) + } + m.Body = body + + if closeErr := readBuffer.CloseContext("RootExtensionObject"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for RootExtensionObject") + } + + return m, nil +} + +func (m *_RootExtensionObject) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_RootExtensionObject) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("RootExtensionObject"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for RootExtensionObject") + } + + if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "body", m.GetBody(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'body' field") + } + + if popErr := writeBuffer.PopContext("RootExtensionObject"); popErr != nil { + return errors.Wrap(popErr, "Error popping for RootExtensionObject") + } + return nil + } + return m.ExtensionObjectContract.(*_ExtensionObject).serializeParent(ctx, writeBuffer, m, ser) +} + +//// +// Arguments Getter + +func (m *_RootExtensionObject) GetExtensionId() int32 { + return m.ExtensionId +} + +// +//// + +func (m *_RootExtensionObject) IsRootExtensionObject() {} + +func (m *_RootExtensionObject) DeepCopy() any { + return m.deepCopy() +} + +func (m *_RootExtensionObject) deepCopy() *_RootExtensionObject { + if m == nil { + return nil + } + _RootExtensionObjectCopy := &_RootExtensionObject{ + m.ExtensionObjectContract.(*_ExtensionObject).deepCopy(), + m.Body.DeepCopy().(ExtensionObjectDefinition), + m.ExtensionId, + } + m.ExtensionObjectContract.(*_ExtensionObject)._SubType = m + return _RootExtensionObjectCopy +} + +func (m *_RootExtensionObject) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/SamplingIntervalDiagnosticsDataType.go b/plc4go/protocols/opcua/readwrite/model/SamplingIntervalDiagnosticsDataType.go index 2b08e7c2d29..5948179c75a 100644 --- a/plc4go/protocols/opcua/readwrite/model/SamplingIntervalDiagnosticsDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SamplingIntervalDiagnosticsDataType.go @@ -196,8 +196,8 @@ func (b *_SamplingIntervalDiagnosticsDataType) CreateSamplingIntervalDiagnostics /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SamplingIntervalDiagnosticsDataType) GetIdentifier() string { - return "858" +func (m *_SamplingIntervalDiagnosticsDataType) GetExtensionId() int32 { + return int32(858) } /////////////////////// @@ -272,7 +272,7 @@ func (m *_SamplingIntervalDiagnosticsDataType) GetLengthInBytes(ctx context.Cont return m.GetLengthInBits(ctx) / 8 } -func (m *_SamplingIntervalDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__samplingIntervalDiagnosticsDataType SamplingIntervalDiagnosticsDataType, err error) { +func (m *_SamplingIntervalDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__samplingIntervalDiagnosticsDataType SamplingIntervalDiagnosticsDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/SecurityGroupDataType.go b/plc4go/protocols/opcua/readwrite/model/SecurityGroupDataType.go index e8a16307d99..f92016fb2f9 100644 --- a/plc4go/protocols/opcua/readwrite/model/SecurityGroupDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SecurityGroupDataType.go @@ -42,8 +42,6 @@ type SecurityGroupDataType interface { ExtensionObjectDefinition // GetName returns Name (property field) GetName() PascalString - // GetNoOfSecurityGroupFolder returns NoOfSecurityGroupFolder (property field) - GetNoOfSecurityGroupFolder() int32 // GetSecurityGroupFolder returns SecurityGroupFolder (property field) GetSecurityGroupFolder() []PascalString // GetKeyLifetime returns KeyLifetime (property field) @@ -56,14 +54,10 @@ type SecurityGroupDataType interface { GetMaxPastKeyCount() uint32 // GetSecurityGroupId returns SecurityGroupId (property field) GetSecurityGroupId() PascalString - // GetNoOfRolePermissions returns NoOfRolePermissions (property field) - GetNoOfRolePermissions() int32 // GetRolePermissions returns RolePermissions (property field) - GetRolePermissions() []ExtensionObjectDefinition - // GetNoOfGroupProperties returns NoOfGroupProperties (property field) - GetNoOfGroupProperties() int32 + GetRolePermissions() []RolePermissionType // GetGroupProperties returns GroupProperties (property field) - GetGroupProperties() []ExtensionObjectDefinition + GetGroupProperties() []KeyValuePair // IsSecurityGroupDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsSecurityGroupDataType() // CreateBuilder creates a SecurityGroupDataTypeBuilder @@ -73,25 +67,22 @@ type SecurityGroupDataType interface { // _SecurityGroupDataType is the data-structure of this message type _SecurityGroupDataType struct { ExtensionObjectDefinitionContract - Name PascalString - NoOfSecurityGroupFolder int32 - SecurityGroupFolder []PascalString - KeyLifetime float64 - SecurityPolicyUri PascalString - MaxFutureKeyCount uint32 - MaxPastKeyCount uint32 - SecurityGroupId PascalString - NoOfRolePermissions int32 - RolePermissions []ExtensionObjectDefinition - NoOfGroupProperties int32 - GroupProperties []ExtensionObjectDefinition + Name PascalString + SecurityGroupFolder []PascalString + KeyLifetime float64 + SecurityPolicyUri PascalString + MaxFutureKeyCount uint32 + MaxPastKeyCount uint32 + SecurityGroupId PascalString + RolePermissions []RolePermissionType + GroupProperties []KeyValuePair } var _ SecurityGroupDataType = (*_SecurityGroupDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SecurityGroupDataType)(nil) // NewSecurityGroupDataType factory function for _SecurityGroupDataType -func NewSecurityGroupDataType(name PascalString, noOfSecurityGroupFolder int32, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, noOfRolePermissions int32, rolePermissions []ExtensionObjectDefinition, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) *_SecurityGroupDataType { +func NewSecurityGroupDataType(name PascalString, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, rolePermissions []RolePermissionType, groupProperties []KeyValuePair) *_SecurityGroupDataType { if name == nil { panic("name of type PascalString for SecurityGroupDataType must not be nil") } @@ -104,16 +95,13 @@ func NewSecurityGroupDataType(name PascalString, noOfSecurityGroupFolder int32, _result := &_SecurityGroupDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), Name: name, - NoOfSecurityGroupFolder: noOfSecurityGroupFolder, SecurityGroupFolder: securityGroupFolder, KeyLifetime: keyLifetime, SecurityPolicyUri: securityPolicyUri, MaxFutureKeyCount: maxFutureKeyCount, MaxPastKeyCount: maxPastKeyCount, SecurityGroupId: securityGroupId, - NoOfRolePermissions: noOfRolePermissions, RolePermissions: rolePermissions, - NoOfGroupProperties: noOfGroupProperties, GroupProperties: groupProperties, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -129,13 +117,11 @@ func NewSecurityGroupDataType(name PascalString, noOfSecurityGroupFolder int32, type SecurityGroupDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, noOfSecurityGroupFolder int32, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, noOfRolePermissions int32, rolePermissions []ExtensionObjectDefinition, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) SecurityGroupDataTypeBuilder + WithMandatoryFields(name PascalString, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, rolePermissions []RolePermissionType, groupProperties []KeyValuePair) SecurityGroupDataTypeBuilder // WithName adds Name (property field) WithName(PascalString) SecurityGroupDataTypeBuilder // WithNameBuilder adds Name (property field) which is build by the builder WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) SecurityGroupDataTypeBuilder - // WithNoOfSecurityGroupFolder adds NoOfSecurityGroupFolder (property field) - WithNoOfSecurityGroupFolder(int32) SecurityGroupDataTypeBuilder // WithSecurityGroupFolder adds SecurityGroupFolder (property field) WithSecurityGroupFolder(...PascalString) SecurityGroupDataTypeBuilder // WithKeyLifetime adds KeyLifetime (property field) @@ -152,14 +138,10 @@ type SecurityGroupDataTypeBuilder interface { WithSecurityGroupId(PascalString) SecurityGroupDataTypeBuilder // WithSecurityGroupIdBuilder adds SecurityGroupId (property field) which is build by the builder WithSecurityGroupIdBuilder(func(PascalStringBuilder) PascalStringBuilder) SecurityGroupDataTypeBuilder - // WithNoOfRolePermissions adds NoOfRolePermissions (property field) - WithNoOfRolePermissions(int32) SecurityGroupDataTypeBuilder // WithRolePermissions adds RolePermissions (property field) - WithRolePermissions(...ExtensionObjectDefinition) SecurityGroupDataTypeBuilder - // WithNoOfGroupProperties adds NoOfGroupProperties (property field) - WithNoOfGroupProperties(int32) SecurityGroupDataTypeBuilder + WithRolePermissions(...RolePermissionType) SecurityGroupDataTypeBuilder // WithGroupProperties adds GroupProperties (property field) - WithGroupProperties(...ExtensionObjectDefinition) SecurityGroupDataTypeBuilder + WithGroupProperties(...KeyValuePair) SecurityGroupDataTypeBuilder // Build builds the SecurityGroupDataType or returns an error if something is wrong Build() (SecurityGroupDataType, error) // MustBuild does the same as Build but panics on error @@ -185,8 +167,8 @@ func (b *_SecurityGroupDataTypeBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_SecurityGroupDataTypeBuilder) WithMandatoryFields(name PascalString, noOfSecurityGroupFolder int32, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, noOfRolePermissions int32, rolePermissions []ExtensionObjectDefinition, noOfGroupProperties int32, groupProperties []ExtensionObjectDefinition) SecurityGroupDataTypeBuilder { - return b.WithName(name).WithNoOfSecurityGroupFolder(noOfSecurityGroupFolder).WithSecurityGroupFolder(securityGroupFolder...).WithKeyLifetime(keyLifetime).WithSecurityPolicyUri(securityPolicyUri).WithMaxFutureKeyCount(maxFutureKeyCount).WithMaxPastKeyCount(maxPastKeyCount).WithSecurityGroupId(securityGroupId).WithNoOfRolePermissions(noOfRolePermissions).WithRolePermissions(rolePermissions...).WithNoOfGroupProperties(noOfGroupProperties).WithGroupProperties(groupProperties...) +func (b *_SecurityGroupDataTypeBuilder) WithMandatoryFields(name PascalString, securityGroupFolder []PascalString, keyLifetime float64, securityPolicyUri PascalString, maxFutureKeyCount uint32, maxPastKeyCount uint32, securityGroupId PascalString, rolePermissions []RolePermissionType, groupProperties []KeyValuePair) SecurityGroupDataTypeBuilder { + return b.WithName(name).WithSecurityGroupFolder(securityGroupFolder...).WithKeyLifetime(keyLifetime).WithSecurityPolicyUri(securityPolicyUri).WithMaxFutureKeyCount(maxFutureKeyCount).WithMaxPastKeyCount(maxPastKeyCount).WithSecurityGroupId(securityGroupId).WithRolePermissions(rolePermissions...).WithGroupProperties(groupProperties...) } func (b *_SecurityGroupDataTypeBuilder) WithName(name PascalString) SecurityGroupDataTypeBuilder { @@ -207,11 +189,6 @@ func (b *_SecurityGroupDataTypeBuilder) WithNameBuilder(builderSupplier func(Pas return b } -func (b *_SecurityGroupDataTypeBuilder) WithNoOfSecurityGroupFolder(noOfSecurityGroupFolder int32) SecurityGroupDataTypeBuilder { - b.NoOfSecurityGroupFolder = noOfSecurityGroupFolder - return b -} - func (b *_SecurityGroupDataTypeBuilder) WithSecurityGroupFolder(securityGroupFolder ...PascalString) SecurityGroupDataTypeBuilder { b.SecurityGroupFolder = securityGroupFolder return b @@ -268,22 +245,12 @@ func (b *_SecurityGroupDataTypeBuilder) WithSecurityGroupIdBuilder(builderSuppli return b } -func (b *_SecurityGroupDataTypeBuilder) WithNoOfRolePermissions(noOfRolePermissions int32) SecurityGroupDataTypeBuilder { - b.NoOfRolePermissions = noOfRolePermissions - return b -} - -func (b *_SecurityGroupDataTypeBuilder) WithRolePermissions(rolePermissions ...ExtensionObjectDefinition) SecurityGroupDataTypeBuilder { +func (b *_SecurityGroupDataTypeBuilder) WithRolePermissions(rolePermissions ...RolePermissionType) SecurityGroupDataTypeBuilder { b.RolePermissions = rolePermissions return b } -func (b *_SecurityGroupDataTypeBuilder) WithNoOfGroupProperties(noOfGroupProperties int32) SecurityGroupDataTypeBuilder { - b.NoOfGroupProperties = noOfGroupProperties - return b -} - -func (b *_SecurityGroupDataTypeBuilder) WithGroupProperties(groupProperties ...ExtensionObjectDefinition) SecurityGroupDataTypeBuilder { +func (b *_SecurityGroupDataTypeBuilder) WithGroupProperties(groupProperties ...KeyValuePair) SecurityGroupDataTypeBuilder { b.GroupProperties = groupProperties return b } @@ -356,8 +323,8 @@ func (b *_SecurityGroupDataType) CreateSecurityGroupDataTypeBuilder() SecurityGr /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SecurityGroupDataType) GetIdentifier() string { - return "23603" +func (m *_SecurityGroupDataType) GetExtensionId() int32 { + return int32(23603) } /////////////////////// @@ -378,10 +345,6 @@ func (m *_SecurityGroupDataType) GetName() PascalString { return m.Name } -func (m *_SecurityGroupDataType) GetNoOfSecurityGroupFolder() int32 { - return m.NoOfSecurityGroupFolder -} - func (m *_SecurityGroupDataType) GetSecurityGroupFolder() []PascalString { return m.SecurityGroupFolder } @@ -406,19 +369,11 @@ func (m *_SecurityGroupDataType) GetSecurityGroupId() PascalString { return m.SecurityGroupId } -func (m *_SecurityGroupDataType) GetNoOfRolePermissions() int32 { - return m.NoOfRolePermissions -} - -func (m *_SecurityGroupDataType) GetRolePermissions() []ExtensionObjectDefinition { +func (m *_SecurityGroupDataType) GetRolePermissions() []RolePermissionType { return m.RolePermissions } -func (m *_SecurityGroupDataType) GetNoOfGroupProperties() int32 { - return m.NoOfGroupProperties -} - -func (m *_SecurityGroupDataType) GetGroupProperties() []ExtensionObjectDefinition { +func (m *_SecurityGroupDataType) GetGroupProperties() []KeyValuePair { return m.GroupProperties } @@ -448,7 +403,7 @@ func (m *_SecurityGroupDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (name) lengthInBits += m.Name.GetLengthInBits(ctx) - // Simple field (noOfSecurityGroupFolder) + // Implicit Field (noOfSecurityGroupFolder) lengthInBits += 32 // Array field @@ -476,7 +431,7 @@ func (m *_SecurityGroupDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (securityGroupId) lengthInBits += m.SecurityGroupId.GetLengthInBits(ctx) - // Simple field (noOfRolePermissions) + // Implicit Field (noOfRolePermissions) lengthInBits += 32 // Array field @@ -489,7 +444,7 @@ func (m *_SecurityGroupDataType) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfGroupProperties) + // Implicit Field (noOfGroupProperties) lengthInBits += 32 // Array field @@ -509,7 +464,7 @@ func (m *_SecurityGroupDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_SecurityGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__securityGroupDataType SecurityGroupDataType, err error) { +func (m *_SecurityGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__securityGroupDataType SecurityGroupDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -526,11 +481,11 @@ func (m *_SecurityGroupDataType) parse(ctx context.Context, readBuffer utils.Rea } m.Name = name - noOfSecurityGroupFolder, err := ReadSimpleField(ctx, "noOfSecurityGroupFolder", ReadSignedInt(readBuffer, uint8(32))) + noOfSecurityGroupFolder, err := ReadImplicitField[int32](ctx, "noOfSecurityGroupFolder", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityGroupFolder' field")) } - m.NoOfSecurityGroupFolder = noOfSecurityGroupFolder + _ = noOfSecurityGroupFolder securityGroupFolder, err := ReadCountArrayField[PascalString](ctx, "securityGroupFolder", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfSecurityGroupFolder)) if err != nil { @@ -568,25 +523,25 @@ func (m *_SecurityGroupDataType) parse(ctx context.Context, readBuffer utils.Rea } m.SecurityGroupId = securityGroupId - noOfRolePermissions, err := ReadSimpleField(ctx, "noOfRolePermissions", ReadSignedInt(readBuffer, uint8(32))) + noOfRolePermissions, err := ReadImplicitField[int32](ctx, "noOfRolePermissions", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfRolePermissions' field")) } - m.NoOfRolePermissions = noOfRolePermissions + _ = noOfRolePermissions - rolePermissions, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "rolePermissions", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("98")), readBuffer), uint64(noOfRolePermissions)) + rolePermissions, err := ReadCountArrayField[RolePermissionType](ctx, "rolePermissions", ReadComplex[RolePermissionType](ExtensionObjectDefinitionParseWithBufferProducer[RolePermissionType]((int32)(int32(98))), readBuffer), uint64(noOfRolePermissions)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'rolePermissions' field")) } m.RolePermissions = rolePermissions - noOfGroupProperties, err := ReadSimpleField(ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) + noOfGroupProperties, err := ReadImplicitField[int32](ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfGroupProperties' field")) } - m.NoOfGroupProperties = noOfGroupProperties + _ = noOfGroupProperties - groupProperties, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "groupProperties", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("14535")), readBuffer), uint64(noOfGroupProperties)) + groupProperties, err := ReadCountArrayField[KeyValuePair](ctx, "groupProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfGroupProperties)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupProperties' field")) } @@ -620,8 +575,8 @@ func (m *_SecurityGroupDataType) SerializeWithWriteBuffer(ctx context.Context, w if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'name' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSecurityGroupFolder", m.GetNoOfSecurityGroupFolder(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSecurityGroupFolder := int32(utils.InlineIf(bool((m.GetSecurityGroupFolder()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityGroupFolder()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityGroupFolder", noOfSecurityGroupFolder, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSecurityGroupFolder' field") } @@ -648,16 +603,16 @@ func (m *_SecurityGroupDataType) SerializeWithWriteBuffer(ctx context.Context, w if err := WriteSimpleField[PascalString](ctx, "securityGroupId", m.GetSecurityGroupId(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'securityGroupId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfRolePermissions", m.GetNoOfRolePermissions(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfRolePermissions := int32(utils.InlineIf(bool((m.GetRolePermissions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetRolePermissions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfRolePermissions", noOfRolePermissions, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfRolePermissions' field") } if err := WriteComplexTypeArrayField(ctx, "rolePermissions", m.GetRolePermissions(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'rolePermissions' field") } - - if err := WriteSimpleField[int32](ctx, "noOfGroupProperties", m.GetNoOfGroupProperties(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfGroupProperties := int32(utils.InlineIf(bool((m.GetGroupProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetGroupProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfGroupProperties", noOfGroupProperties, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfGroupProperties' field") } @@ -686,17 +641,14 @@ func (m *_SecurityGroupDataType) deepCopy() *_SecurityGroupDataType { _SecurityGroupDataTypeCopy := &_SecurityGroupDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.Name.DeepCopy().(PascalString), - m.NoOfSecurityGroupFolder, utils.DeepCopySlice[PascalString, PascalString](m.SecurityGroupFolder), m.KeyLifetime, m.SecurityPolicyUri.DeepCopy().(PascalString), m.MaxFutureKeyCount, m.MaxPastKeyCount, m.SecurityGroupId.DeepCopy().(PascalString), - m.NoOfRolePermissions, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.RolePermissions), - m.NoOfGroupProperties, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.GroupProperties), + utils.DeepCopySlice[RolePermissionType, RolePermissionType](m.RolePermissions), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.GroupProperties), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _SecurityGroupDataTypeCopy diff --git a/plc4go/protocols/opcua/readwrite/model/SemanticChangeStructureDataType.go b/plc4go/protocols/opcua/readwrite/model/SemanticChangeStructureDataType.go index 59808aa1f88..b2a0aedd98f 100644 --- a/plc4go/protocols/opcua/readwrite/model/SemanticChangeStructureDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SemanticChangeStructureDataType.go @@ -222,8 +222,8 @@ func (b *_SemanticChangeStructureDataType) CreateSemanticChangeStructureDataType /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SemanticChangeStructureDataType) GetIdentifier() string { - return "899" +func (m *_SemanticChangeStructureDataType) GetExtensionId() int32 { + return int32(899) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_SemanticChangeStructureDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_SemanticChangeStructureDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__semanticChangeStructureDataType SemanticChangeStructureDataType, err error) { +func (m *_SemanticChangeStructureDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__semanticChangeStructureDataType SemanticChangeStructureDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ServerDiagnosticsSummaryDataType.go b/plc4go/protocols/opcua/readwrite/model/ServerDiagnosticsSummaryDataType.go index e63500ffe74..7604d9303ca 100644 --- a/plc4go/protocols/opcua/readwrite/model/ServerDiagnosticsSummaryDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ServerDiagnosticsSummaryDataType.go @@ -284,8 +284,8 @@ func (b *_ServerDiagnosticsSummaryDataType) CreateServerDiagnosticsSummaryDataTy /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ServerDiagnosticsSummaryDataType) GetIdentifier() string { - return "861" +func (m *_ServerDiagnosticsSummaryDataType) GetExtensionId() int32 { + return int32(861) } /////////////////////// @@ -416,7 +416,7 @@ func (m *_ServerDiagnosticsSummaryDataType) GetLengthInBytes(ctx context.Context return m.GetLengthInBits(ctx) / 8 } -func (m *_ServerDiagnosticsSummaryDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__serverDiagnosticsSummaryDataType ServerDiagnosticsSummaryDataType, err error) { +func (m *_ServerDiagnosticsSummaryDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__serverDiagnosticsSummaryDataType ServerDiagnosticsSummaryDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ServerOnNetwork.go b/plc4go/protocols/opcua/readwrite/model/ServerOnNetwork.go index bfaf00116d3..b99c69cd8e5 100644 --- a/plc4go/protocols/opcua/readwrite/model/ServerOnNetwork.go +++ b/plc4go/protocols/opcua/readwrite/model/ServerOnNetwork.go @@ -46,8 +46,6 @@ type ServerOnNetwork interface { GetServerName() PascalString // GetDiscoveryUrl returns DiscoveryUrl (property field) GetDiscoveryUrl() PascalString - // GetNoOfServerCapabilities returns NoOfServerCapabilities (property field) - GetNoOfServerCapabilities() int32 // GetServerCapabilities returns ServerCapabilities (property field) GetServerCapabilities() []PascalString // IsServerOnNetwork is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,18 +57,17 @@ type ServerOnNetwork interface { // _ServerOnNetwork is the data-structure of this message type _ServerOnNetwork struct { ExtensionObjectDefinitionContract - RecordId uint32 - ServerName PascalString - DiscoveryUrl PascalString - NoOfServerCapabilities int32 - ServerCapabilities []PascalString + RecordId uint32 + ServerName PascalString + DiscoveryUrl PascalString + ServerCapabilities []PascalString } var _ ServerOnNetwork = (*_ServerOnNetwork)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ServerOnNetwork)(nil) // NewServerOnNetwork factory function for _ServerOnNetwork -func NewServerOnNetwork(recordId uint32, serverName PascalString, discoveryUrl PascalString, noOfServerCapabilities int32, serverCapabilities []PascalString) *_ServerOnNetwork { +func NewServerOnNetwork(recordId uint32, serverName PascalString, discoveryUrl PascalString, serverCapabilities []PascalString) *_ServerOnNetwork { if serverName == nil { panic("serverName of type PascalString for ServerOnNetwork must not be nil") } @@ -82,7 +79,6 @@ func NewServerOnNetwork(recordId uint32, serverName PascalString, discoveryUrl P RecordId: recordId, ServerName: serverName, DiscoveryUrl: discoveryUrl, - NoOfServerCapabilities: noOfServerCapabilities, ServerCapabilities: serverCapabilities, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -98,7 +94,7 @@ func NewServerOnNetwork(recordId uint32, serverName PascalString, discoveryUrl P type ServerOnNetworkBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(recordId uint32, serverName PascalString, discoveryUrl PascalString, noOfServerCapabilities int32, serverCapabilities []PascalString) ServerOnNetworkBuilder + WithMandatoryFields(recordId uint32, serverName PascalString, discoveryUrl PascalString, serverCapabilities []PascalString) ServerOnNetworkBuilder // WithRecordId adds RecordId (property field) WithRecordId(uint32) ServerOnNetworkBuilder // WithServerName adds ServerName (property field) @@ -109,8 +105,6 @@ type ServerOnNetworkBuilder interface { WithDiscoveryUrl(PascalString) ServerOnNetworkBuilder // WithDiscoveryUrlBuilder adds DiscoveryUrl (property field) which is build by the builder WithDiscoveryUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) ServerOnNetworkBuilder - // WithNoOfServerCapabilities adds NoOfServerCapabilities (property field) - WithNoOfServerCapabilities(int32) ServerOnNetworkBuilder // WithServerCapabilities adds ServerCapabilities (property field) WithServerCapabilities(...PascalString) ServerOnNetworkBuilder // Build builds the ServerOnNetwork or returns an error if something is wrong @@ -138,8 +132,8 @@ func (b *_ServerOnNetworkBuilder) setParent(contract ExtensionObjectDefinitionCo b.ExtensionObjectDefinitionContract = contract } -func (b *_ServerOnNetworkBuilder) WithMandatoryFields(recordId uint32, serverName PascalString, discoveryUrl PascalString, noOfServerCapabilities int32, serverCapabilities []PascalString) ServerOnNetworkBuilder { - return b.WithRecordId(recordId).WithServerName(serverName).WithDiscoveryUrl(discoveryUrl).WithNoOfServerCapabilities(noOfServerCapabilities).WithServerCapabilities(serverCapabilities...) +func (b *_ServerOnNetworkBuilder) WithMandatoryFields(recordId uint32, serverName PascalString, discoveryUrl PascalString, serverCapabilities []PascalString) ServerOnNetworkBuilder { + return b.WithRecordId(recordId).WithServerName(serverName).WithDiscoveryUrl(discoveryUrl).WithServerCapabilities(serverCapabilities...) } func (b *_ServerOnNetworkBuilder) WithRecordId(recordId uint32) ServerOnNetworkBuilder { @@ -183,11 +177,6 @@ func (b *_ServerOnNetworkBuilder) WithDiscoveryUrlBuilder(builderSupplier func(P return b } -func (b *_ServerOnNetworkBuilder) WithNoOfServerCapabilities(noOfServerCapabilities int32) ServerOnNetworkBuilder { - b.NoOfServerCapabilities = noOfServerCapabilities - return b -} - func (b *_ServerOnNetworkBuilder) WithServerCapabilities(serverCapabilities ...PascalString) ServerOnNetworkBuilder { b.ServerCapabilities = serverCapabilities return b @@ -255,8 +244,8 @@ func (b *_ServerOnNetwork) CreateServerOnNetworkBuilder() ServerOnNetworkBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ServerOnNetwork) GetIdentifier() string { - return "12191" +func (m *_ServerOnNetwork) GetExtensionId() int32 { + return int32(12191) } /////////////////////// @@ -285,10 +274,6 @@ func (m *_ServerOnNetwork) GetDiscoveryUrl() PascalString { return m.DiscoveryUrl } -func (m *_ServerOnNetwork) GetNoOfServerCapabilities() int32 { - return m.NoOfServerCapabilities -} - func (m *_ServerOnNetwork) GetServerCapabilities() []PascalString { return m.ServerCapabilities } @@ -325,7 +310,7 @@ func (m *_ServerOnNetwork) GetLengthInBits(ctx context.Context) uint16 { // Simple field (discoveryUrl) lengthInBits += m.DiscoveryUrl.GetLengthInBits(ctx) - // Simple field (noOfServerCapabilities) + // Implicit Field (noOfServerCapabilities) lengthInBits += 32 // Array field @@ -345,7 +330,7 @@ func (m *_ServerOnNetwork) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ServerOnNetwork) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__serverOnNetwork ServerOnNetwork, err error) { +func (m *_ServerOnNetwork) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__serverOnNetwork ServerOnNetwork, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -374,11 +359,11 @@ func (m *_ServerOnNetwork) parse(ctx context.Context, readBuffer utils.ReadBuffe } m.DiscoveryUrl = discoveryUrl - noOfServerCapabilities, err := ReadSimpleField(ctx, "noOfServerCapabilities", ReadSignedInt(readBuffer, uint8(32))) + noOfServerCapabilities, err := ReadImplicitField[int32](ctx, "noOfServerCapabilities", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerCapabilities' field")) } - m.NoOfServerCapabilities = noOfServerCapabilities + _ = noOfServerCapabilities serverCapabilities, err := ReadCountArrayField[PascalString](ctx, "serverCapabilities", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerCapabilities)) if err != nil { @@ -422,8 +407,8 @@ func (m *_ServerOnNetwork) SerializeWithWriteBuffer(ctx context.Context, writeBu if err := WriteSimpleField[PascalString](ctx, "discoveryUrl", m.GetDiscoveryUrl(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'discoveryUrl' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerCapabilities", m.GetNoOfServerCapabilities(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerCapabilities := int32(utils.InlineIf(bool((m.GetServerCapabilities()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerCapabilities()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerCapabilities", noOfServerCapabilities, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerCapabilities' field") } @@ -454,7 +439,6 @@ func (m *_ServerOnNetwork) deepCopy() *_ServerOnNetwork { m.RecordId, m.ServerName.DeepCopy().(PascalString), m.DiscoveryUrl.DeepCopy().(PascalString), - m.NoOfServerCapabilities, utils.DeepCopySlice[PascalString, PascalString](m.ServerCapabilities), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/ServerStatusDataType.go b/plc4go/protocols/opcua/readwrite/model/ServerStatusDataType.go index 0e258410305..8745d608ccd 100644 --- a/plc4go/protocols/opcua/readwrite/model/ServerStatusDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ServerStatusDataType.go @@ -47,7 +47,7 @@ type ServerStatusDataType interface { // GetState returns State (property field) GetState() ServerState // GetBuildInfo returns BuildInfo (property field) - GetBuildInfo() ExtensionObjectDefinition + GetBuildInfo() BuildInfo // GetSecondsTillShutdown returns SecondsTillShutdown (property field) GetSecondsTillShutdown() uint32 // GetShutdownReason returns ShutdownReason (property field) @@ -64,7 +64,7 @@ type _ServerStatusDataType struct { StartTime int64 CurrentTime int64 State ServerState - BuildInfo ExtensionObjectDefinition + BuildInfo BuildInfo SecondsTillShutdown uint32 ShutdownReason LocalizedText } @@ -73,9 +73,9 @@ var _ ServerStatusDataType = (*_ServerStatusDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ServerStatusDataType)(nil) // NewServerStatusDataType factory function for _ServerStatusDataType -func NewServerStatusDataType(startTime int64, currentTime int64, state ServerState, buildInfo ExtensionObjectDefinition, secondsTillShutdown uint32, shutdownReason LocalizedText) *_ServerStatusDataType { +func NewServerStatusDataType(startTime int64, currentTime int64, state ServerState, buildInfo BuildInfo, secondsTillShutdown uint32, shutdownReason LocalizedText) *_ServerStatusDataType { if buildInfo == nil { - panic("buildInfo of type ExtensionObjectDefinition for ServerStatusDataType must not be nil") + panic("buildInfo of type BuildInfo for ServerStatusDataType must not be nil") } if shutdownReason == nil { panic("shutdownReason of type LocalizedText for ServerStatusDataType must not be nil") @@ -102,7 +102,7 @@ func NewServerStatusDataType(startTime int64, currentTime int64, state ServerSta type ServerStatusDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(startTime int64, currentTime int64, state ServerState, buildInfo ExtensionObjectDefinition, secondsTillShutdown uint32, shutdownReason LocalizedText) ServerStatusDataTypeBuilder + WithMandatoryFields(startTime int64, currentTime int64, state ServerState, buildInfo BuildInfo, secondsTillShutdown uint32, shutdownReason LocalizedText) ServerStatusDataTypeBuilder // WithStartTime adds StartTime (property field) WithStartTime(int64) ServerStatusDataTypeBuilder // WithCurrentTime adds CurrentTime (property field) @@ -110,9 +110,9 @@ type ServerStatusDataTypeBuilder interface { // WithState adds State (property field) WithState(ServerState) ServerStatusDataTypeBuilder // WithBuildInfo adds BuildInfo (property field) - WithBuildInfo(ExtensionObjectDefinition) ServerStatusDataTypeBuilder + WithBuildInfo(BuildInfo) ServerStatusDataTypeBuilder // WithBuildInfoBuilder adds BuildInfo (property field) which is build by the builder - WithBuildInfoBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ServerStatusDataTypeBuilder + WithBuildInfoBuilder(func(BuildInfoBuilder) BuildInfoBuilder) ServerStatusDataTypeBuilder // WithSecondsTillShutdown adds SecondsTillShutdown (property field) WithSecondsTillShutdown(uint32) ServerStatusDataTypeBuilder // WithShutdownReason adds ShutdownReason (property field) @@ -144,7 +144,7 @@ func (b *_ServerStatusDataTypeBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_ServerStatusDataTypeBuilder) WithMandatoryFields(startTime int64, currentTime int64, state ServerState, buildInfo ExtensionObjectDefinition, secondsTillShutdown uint32, shutdownReason LocalizedText) ServerStatusDataTypeBuilder { +func (b *_ServerStatusDataTypeBuilder) WithMandatoryFields(startTime int64, currentTime int64, state ServerState, buildInfo BuildInfo, secondsTillShutdown uint32, shutdownReason LocalizedText) ServerStatusDataTypeBuilder { return b.WithStartTime(startTime).WithCurrentTime(currentTime).WithState(state).WithBuildInfo(buildInfo).WithSecondsTillShutdown(secondsTillShutdown).WithShutdownReason(shutdownReason) } @@ -163,20 +163,20 @@ func (b *_ServerStatusDataTypeBuilder) WithState(state ServerState) ServerStatus return b } -func (b *_ServerStatusDataTypeBuilder) WithBuildInfo(buildInfo ExtensionObjectDefinition) ServerStatusDataTypeBuilder { +func (b *_ServerStatusDataTypeBuilder) WithBuildInfo(buildInfo BuildInfo) ServerStatusDataTypeBuilder { b.BuildInfo = buildInfo return b } -func (b *_ServerStatusDataTypeBuilder) WithBuildInfoBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ServerStatusDataTypeBuilder { - builder := builderSupplier(b.BuildInfo.CreateExtensionObjectDefinitionBuilder()) +func (b *_ServerStatusDataTypeBuilder) WithBuildInfoBuilder(builderSupplier func(BuildInfoBuilder) BuildInfoBuilder) ServerStatusDataTypeBuilder { + builder := builderSupplier(b.BuildInfo.CreateBuildInfoBuilder()) var err error b.BuildInfo, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "BuildInfoBuilder failed")) } return b } @@ -266,8 +266,8 @@ func (b *_ServerStatusDataType) CreateServerStatusDataTypeBuilder() ServerStatus /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ServerStatusDataType) GetIdentifier() string { - return "864" +func (m *_ServerStatusDataType) GetExtensionId() int32 { + return int32(864) } /////////////////////// @@ -296,7 +296,7 @@ func (m *_ServerStatusDataType) GetState() ServerState { return m.State } -func (m *_ServerStatusDataType) GetBuildInfo() ExtensionObjectDefinition { +func (m *_ServerStatusDataType) GetBuildInfo() BuildInfo { return m.BuildInfo } @@ -356,7 +356,7 @@ func (m *_ServerStatusDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ServerStatusDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__serverStatusDataType ServerStatusDataType, err error) { +func (m *_ServerStatusDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__serverStatusDataType ServerStatusDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -385,7 +385,7 @@ func (m *_ServerStatusDataType) parse(ctx context.Context, readBuffer utils.Read } m.State = state - buildInfo, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "buildInfo", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("340")), readBuffer)) + buildInfo, err := ReadSimpleField[BuildInfo](ctx, "buildInfo", ReadComplex[BuildInfo](ExtensionObjectDefinitionParseWithBufferProducer[BuildInfo]((int32)(int32(340))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'buildInfo' field")) } @@ -440,7 +440,7 @@ func (m *_ServerStatusDataType) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(err, "Error serializing 'state' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "buildInfo", m.GetBuildInfo(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[BuildInfo](ctx, "buildInfo", m.GetBuildInfo(), WriteComplex[BuildInfo](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'buildInfo' field") } @@ -475,7 +475,7 @@ func (m *_ServerStatusDataType) deepCopy() *_ServerStatusDataType { m.StartTime, m.CurrentTime, m.State, - m.BuildInfo.DeepCopy().(ExtensionObjectDefinition), + m.BuildInfo.DeepCopy().(BuildInfo), m.SecondsTillShutdown, m.ShutdownReason.DeepCopy().(LocalizedText), } diff --git a/plc4go/protocols/opcua/readwrite/model/ServiceCounterDataType.go b/plc4go/protocols/opcua/readwrite/model/ServiceCounterDataType.go index 45569bcde03..6897fa32f9a 100644 --- a/plc4go/protocols/opcua/readwrite/model/ServiceCounterDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/ServiceCounterDataType.go @@ -174,8 +174,8 @@ func (b *_ServiceCounterDataType) CreateServiceCounterDataTypeBuilder() ServiceC /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ServiceCounterDataType) GetIdentifier() string { - return "873" +func (m *_ServiceCounterDataType) GetExtensionId() int32 { + return int32(873) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_ServiceCounterDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ServiceCounterDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__serviceCounterDataType ServiceCounterDataType, err error) { +func (m *_ServiceCounterDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__serviceCounterDataType ServiceCounterDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/ServiceFault.go b/plc4go/protocols/opcua/readwrite/model/ServiceFault.go index b384758d30f..dbc4a8820df 100644 --- a/plc4go/protocols/opcua/readwrite/model/ServiceFault.go +++ b/plc4go/protocols/opcua/readwrite/model/ServiceFault.go @@ -41,7 +41,7 @@ type ServiceFault interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // IsServiceFault is a marker method to prevent unintentional type checks (interfaces of same signature) IsServiceFault() // CreateBuilder creates a ServiceFaultBuilder @@ -51,16 +51,16 @@ type ServiceFault interface { // _ServiceFault is the data-structure of this message type _ServiceFault struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader } var _ ServiceFault = (*_ServiceFault)(nil) var _ ExtensionObjectDefinitionRequirements = (*_ServiceFault)(nil) // NewServiceFault factory function for _ServiceFault -func NewServiceFault(responseHeader ExtensionObjectDefinition) *_ServiceFault { +func NewServiceFault(responseHeader ResponseHeader) *_ServiceFault { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for ServiceFault must not be nil") + panic("responseHeader of type ResponseHeader for ServiceFault must not be nil") } _result := &_ServiceFault{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewServiceFault(responseHeader ExtensionObjectDefinition) *_ServiceFault { type ServiceFaultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition) ServiceFaultBuilder + WithMandatoryFields(responseHeader ResponseHeader) ServiceFaultBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) ServiceFaultBuilder + WithResponseHeader(ResponseHeader) ServiceFaultBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ServiceFaultBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) ServiceFaultBuilder // Build builds the ServiceFault or returns an error if something is wrong Build() (ServiceFault, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_ServiceFaultBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_ServiceFaultBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition) ServiceFaultBuilder { +func (b *_ServiceFaultBuilder) WithMandatoryFields(responseHeader ResponseHeader) ServiceFaultBuilder { return b.WithResponseHeader(responseHeader) } -func (b *_ServiceFaultBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) ServiceFaultBuilder { +func (b *_ServiceFaultBuilder) WithResponseHeader(responseHeader ResponseHeader) ServiceFaultBuilder { b.ResponseHeader = responseHeader return b } -func (b *_ServiceFaultBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) ServiceFaultBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_ServiceFaultBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) ServiceFaultBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_ServiceFault) CreateServiceFaultBuilder() ServiceFaultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ServiceFault) GetIdentifier() string { - return "397" +func (m *_ServiceFault) GetExtensionId() int32 { + return int32(397) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_ServiceFault) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_ServiceFault) GetResponseHeader() ExtensionObjectDefinition { +func (m *_ServiceFault) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -242,7 +242,7 @@ func (m *_ServiceFault) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ServiceFault) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__serviceFault ServiceFault, err error) { +func (m *_ServiceFault) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__serviceFault ServiceFault, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_ServiceFault) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -284,7 +284,7 @@ func (m *_ServiceFault) SerializeWithWriteBuffer(ctx context.Context, writeBuffe return errors.Wrap(pushErr, "Error pushing for ServiceFault") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -308,7 +308,7 @@ func (m *_ServiceFault) deepCopy() *_ServiceFault { } _ServiceFaultCopy := &_ServiceFault{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _ServiceFaultCopy diff --git a/plc4go/protocols/opcua/readwrite/model/SessionDiagnosticsDataType.go b/plc4go/protocols/opcua/readwrite/model/SessionDiagnosticsDataType.go index 687fb8fdc10..9edabeefb3b 100644 --- a/plc4go/protocols/opcua/readwrite/model/SessionDiagnosticsDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SessionDiagnosticsDataType.go @@ -45,13 +45,11 @@ type SessionDiagnosticsDataType interface { // GetSessionName returns SessionName (property field) GetSessionName() PascalString // GetClientDescription returns ClientDescription (property field) - GetClientDescription() ExtensionObjectDefinition + GetClientDescription() ApplicationDescription // GetServerUri returns ServerUri (property field) GetServerUri() PascalString // GetEndpointUrl returns EndpointUrl (property field) GetEndpointUrl() PascalString - // GetNoOfLocaleIds returns NoOfLocaleIds (property field) - GetNoOfLocaleIds() int32 // GetLocaleIds returns LocaleIds (property field) GetLocaleIds() []PascalString // GetActualSessionTimeout returns ActualSessionTimeout (property field) @@ -69,65 +67,65 @@ type SessionDiagnosticsDataType interface { // GetCurrentPublishRequestsInQueue returns CurrentPublishRequestsInQueue (property field) GetCurrentPublishRequestsInQueue() uint32 // GetTotalRequestCount returns TotalRequestCount (property field) - GetTotalRequestCount() ExtensionObjectDefinition + GetTotalRequestCount() ServiceCounterDataType // GetUnauthorizedRequestCount returns UnauthorizedRequestCount (property field) GetUnauthorizedRequestCount() uint32 // GetReadCount returns ReadCount (property field) - GetReadCount() ExtensionObjectDefinition + GetReadCount() ServiceCounterDataType // GetHistoryReadCount returns HistoryReadCount (property field) - GetHistoryReadCount() ExtensionObjectDefinition + GetHistoryReadCount() ServiceCounterDataType // GetWriteCount returns WriteCount (property field) - GetWriteCount() ExtensionObjectDefinition + GetWriteCount() ServiceCounterDataType // GetHistoryUpdateCount returns HistoryUpdateCount (property field) - GetHistoryUpdateCount() ExtensionObjectDefinition + GetHistoryUpdateCount() ServiceCounterDataType // GetCallCount returns CallCount (property field) - GetCallCount() ExtensionObjectDefinition + GetCallCount() ServiceCounterDataType // GetCreateMonitoredItemsCount returns CreateMonitoredItemsCount (property field) - GetCreateMonitoredItemsCount() ExtensionObjectDefinition + GetCreateMonitoredItemsCount() ServiceCounterDataType // GetModifyMonitoredItemsCount returns ModifyMonitoredItemsCount (property field) - GetModifyMonitoredItemsCount() ExtensionObjectDefinition + GetModifyMonitoredItemsCount() ServiceCounterDataType // GetSetMonitoringModeCount returns SetMonitoringModeCount (property field) - GetSetMonitoringModeCount() ExtensionObjectDefinition + GetSetMonitoringModeCount() ServiceCounterDataType // GetSetTriggeringCount returns SetTriggeringCount (property field) - GetSetTriggeringCount() ExtensionObjectDefinition + GetSetTriggeringCount() ServiceCounterDataType // GetDeleteMonitoredItemsCount returns DeleteMonitoredItemsCount (property field) - GetDeleteMonitoredItemsCount() ExtensionObjectDefinition + GetDeleteMonitoredItemsCount() ServiceCounterDataType // GetCreateSubscriptionCount returns CreateSubscriptionCount (property field) - GetCreateSubscriptionCount() ExtensionObjectDefinition + GetCreateSubscriptionCount() ServiceCounterDataType // GetModifySubscriptionCount returns ModifySubscriptionCount (property field) - GetModifySubscriptionCount() ExtensionObjectDefinition + GetModifySubscriptionCount() ServiceCounterDataType // GetSetPublishingModeCount returns SetPublishingModeCount (property field) - GetSetPublishingModeCount() ExtensionObjectDefinition + GetSetPublishingModeCount() ServiceCounterDataType // GetPublishCount returns PublishCount (property field) - GetPublishCount() ExtensionObjectDefinition + GetPublishCount() ServiceCounterDataType // GetRepublishCount returns RepublishCount (property field) - GetRepublishCount() ExtensionObjectDefinition + GetRepublishCount() ServiceCounterDataType // GetTransferSubscriptionsCount returns TransferSubscriptionsCount (property field) - GetTransferSubscriptionsCount() ExtensionObjectDefinition + GetTransferSubscriptionsCount() ServiceCounterDataType // GetDeleteSubscriptionsCount returns DeleteSubscriptionsCount (property field) - GetDeleteSubscriptionsCount() ExtensionObjectDefinition + GetDeleteSubscriptionsCount() ServiceCounterDataType // GetAddNodesCount returns AddNodesCount (property field) - GetAddNodesCount() ExtensionObjectDefinition + GetAddNodesCount() ServiceCounterDataType // GetAddReferencesCount returns AddReferencesCount (property field) - GetAddReferencesCount() ExtensionObjectDefinition + GetAddReferencesCount() ServiceCounterDataType // GetDeleteNodesCount returns DeleteNodesCount (property field) - GetDeleteNodesCount() ExtensionObjectDefinition + GetDeleteNodesCount() ServiceCounterDataType // GetDeleteReferencesCount returns DeleteReferencesCount (property field) - GetDeleteReferencesCount() ExtensionObjectDefinition + GetDeleteReferencesCount() ServiceCounterDataType // GetBrowseCount returns BrowseCount (property field) - GetBrowseCount() ExtensionObjectDefinition + GetBrowseCount() ServiceCounterDataType // GetBrowseNextCount returns BrowseNextCount (property field) - GetBrowseNextCount() ExtensionObjectDefinition + GetBrowseNextCount() ServiceCounterDataType // GetTranslateBrowsePathsToNodeIdsCount returns TranslateBrowsePathsToNodeIdsCount (property field) - GetTranslateBrowsePathsToNodeIdsCount() ExtensionObjectDefinition + GetTranslateBrowsePathsToNodeIdsCount() ServiceCounterDataType // GetQueryFirstCount returns QueryFirstCount (property field) - GetQueryFirstCount() ExtensionObjectDefinition + GetQueryFirstCount() ServiceCounterDataType // GetQueryNextCount returns QueryNextCount (property field) - GetQueryNextCount() ExtensionObjectDefinition + GetQueryNextCount() ServiceCounterDataType // GetRegisterNodesCount returns RegisterNodesCount (property field) - GetRegisterNodesCount() ExtensionObjectDefinition + GetRegisterNodesCount() ServiceCounterDataType // GetUnregisterNodesCount returns UnregisterNodesCount (property field) - GetUnregisterNodesCount() ExtensionObjectDefinition + GetUnregisterNodesCount() ServiceCounterDataType // IsSessionDiagnosticsDataType is a marker method to prevent unintentional type checks (interfaces of same signature) IsSessionDiagnosticsDataType() // CreateBuilder creates a SessionDiagnosticsDataTypeBuilder @@ -139,10 +137,9 @@ type _SessionDiagnosticsDataType struct { ExtensionObjectDefinitionContract SessionId NodeId SessionName PascalString - ClientDescription ExtensionObjectDefinition + ClientDescription ApplicationDescription ServerUri PascalString EndpointUrl PascalString - NoOfLocaleIds int32 LocaleIds []PascalString ActualSessionTimeout float64 MaxResponseMessageSize uint32 @@ -151,43 +148,43 @@ type _SessionDiagnosticsDataType struct { CurrentSubscriptionsCount uint32 CurrentMonitoredItemsCount uint32 CurrentPublishRequestsInQueue uint32 - TotalRequestCount ExtensionObjectDefinition + TotalRequestCount ServiceCounterDataType UnauthorizedRequestCount uint32 - ReadCount ExtensionObjectDefinition - HistoryReadCount ExtensionObjectDefinition - WriteCount ExtensionObjectDefinition - HistoryUpdateCount ExtensionObjectDefinition - CallCount ExtensionObjectDefinition - CreateMonitoredItemsCount ExtensionObjectDefinition - ModifyMonitoredItemsCount ExtensionObjectDefinition - SetMonitoringModeCount ExtensionObjectDefinition - SetTriggeringCount ExtensionObjectDefinition - DeleteMonitoredItemsCount ExtensionObjectDefinition - CreateSubscriptionCount ExtensionObjectDefinition - ModifySubscriptionCount ExtensionObjectDefinition - SetPublishingModeCount ExtensionObjectDefinition - PublishCount ExtensionObjectDefinition - RepublishCount ExtensionObjectDefinition - TransferSubscriptionsCount ExtensionObjectDefinition - DeleteSubscriptionsCount ExtensionObjectDefinition - AddNodesCount ExtensionObjectDefinition - AddReferencesCount ExtensionObjectDefinition - DeleteNodesCount ExtensionObjectDefinition - DeleteReferencesCount ExtensionObjectDefinition - BrowseCount ExtensionObjectDefinition - BrowseNextCount ExtensionObjectDefinition - TranslateBrowsePathsToNodeIdsCount ExtensionObjectDefinition - QueryFirstCount ExtensionObjectDefinition - QueryNextCount ExtensionObjectDefinition - RegisterNodesCount ExtensionObjectDefinition - UnregisterNodesCount ExtensionObjectDefinition + ReadCount ServiceCounterDataType + HistoryReadCount ServiceCounterDataType + WriteCount ServiceCounterDataType + HistoryUpdateCount ServiceCounterDataType + CallCount ServiceCounterDataType + CreateMonitoredItemsCount ServiceCounterDataType + ModifyMonitoredItemsCount ServiceCounterDataType + SetMonitoringModeCount ServiceCounterDataType + SetTriggeringCount ServiceCounterDataType + DeleteMonitoredItemsCount ServiceCounterDataType + CreateSubscriptionCount ServiceCounterDataType + ModifySubscriptionCount ServiceCounterDataType + SetPublishingModeCount ServiceCounterDataType + PublishCount ServiceCounterDataType + RepublishCount ServiceCounterDataType + TransferSubscriptionsCount ServiceCounterDataType + DeleteSubscriptionsCount ServiceCounterDataType + AddNodesCount ServiceCounterDataType + AddReferencesCount ServiceCounterDataType + DeleteNodesCount ServiceCounterDataType + DeleteReferencesCount ServiceCounterDataType + BrowseCount ServiceCounterDataType + BrowseNextCount ServiceCounterDataType + TranslateBrowsePathsToNodeIdsCount ServiceCounterDataType + QueryFirstCount ServiceCounterDataType + QueryNextCount ServiceCounterDataType + RegisterNodesCount ServiceCounterDataType + UnregisterNodesCount ServiceCounterDataType } var _ SessionDiagnosticsDataType = (*_SessionDiagnosticsDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SessionDiagnosticsDataType)(nil) // NewSessionDiagnosticsDataType factory function for _SessionDiagnosticsDataType -func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ExtensionObjectDefinition, unauthorizedRequestCount uint32, readCount ExtensionObjectDefinition, historyReadCount ExtensionObjectDefinition, writeCount ExtensionObjectDefinition, historyUpdateCount ExtensionObjectDefinition, callCount ExtensionObjectDefinition, createMonitoredItemsCount ExtensionObjectDefinition, modifyMonitoredItemsCount ExtensionObjectDefinition, setMonitoringModeCount ExtensionObjectDefinition, setTriggeringCount ExtensionObjectDefinition, deleteMonitoredItemsCount ExtensionObjectDefinition, createSubscriptionCount ExtensionObjectDefinition, modifySubscriptionCount ExtensionObjectDefinition, setPublishingModeCount ExtensionObjectDefinition, publishCount ExtensionObjectDefinition, republishCount ExtensionObjectDefinition, transferSubscriptionsCount ExtensionObjectDefinition, deleteSubscriptionsCount ExtensionObjectDefinition, addNodesCount ExtensionObjectDefinition, addReferencesCount ExtensionObjectDefinition, deleteNodesCount ExtensionObjectDefinition, deleteReferencesCount ExtensionObjectDefinition, browseCount ExtensionObjectDefinition, browseNextCount ExtensionObjectDefinition, translateBrowsePathsToNodeIdsCount ExtensionObjectDefinition, queryFirstCount ExtensionObjectDefinition, queryNextCount ExtensionObjectDefinition, registerNodesCount ExtensionObjectDefinition, unregisterNodesCount ExtensionObjectDefinition) *_SessionDiagnosticsDataType { +func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ServiceCounterDataType, unauthorizedRequestCount uint32, readCount ServiceCounterDataType, historyReadCount ServiceCounterDataType, writeCount ServiceCounterDataType, historyUpdateCount ServiceCounterDataType, callCount ServiceCounterDataType, createMonitoredItemsCount ServiceCounterDataType, modifyMonitoredItemsCount ServiceCounterDataType, setMonitoringModeCount ServiceCounterDataType, setTriggeringCount ServiceCounterDataType, deleteMonitoredItemsCount ServiceCounterDataType, createSubscriptionCount ServiceCounterDataType, modifySubscriptionCount ServiceCounterDataType, setPublishingModeCount ServiceCounterDataType, publishCount ServiceCounterDataType, republishCount ServiceCounterDataType, transferSubscriptionsCount ServiceCounterDataType, deleteSubscriptionsCount ServiceCounterDataType, addNodesCount ServiceCounterDataType, addReferencesCount ServiceCounterDataType, deleteNodesCount ServiceCounterDataType, deleteReferencesCount ServiceCounterDataType, browseCount ServiceCounterDataType, browseNextCount ServiceCounterDataType, translateBrowsePathsToNodeIdsCount ServiceCounterDataType, queryFirstCount ServiceCounterDataType, queryNextCount ServiceCounterDataType, registerNodesCount ServiceCounterDataType, unregisterNodesCount ServiceCounterDataType) *_SessionDiagnosticsDataType { if sessionId == nil { panic("sessionId of type NodeId for SessionDiagnosticsDataType must not be nil") } @@ -195,7 +192,7 @@ func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, c panic("sessionName of type PascalString for SessionDiagnosticsDataType must not be nil") } if clientDescription == nil { - panic("clientDescription of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("clientDescription of type ApplicationDescription for SessionDiagnosticsDataType must not be nil") } if serverUri == nil { panic("serverUri of type PascalString for SessionDiagnosticsDataType must not be nil") @@ -204,91 +201,91 @@ func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, c panic("endpointUrl of type PascalString for SessionDiagnosticsDataType must not be nil") } if totalRequestCount == nil { - panic("totalRequestCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("totalRequestCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if readCount == nil { - panic("readCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("readCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if historyReadCount == nil { - panic("historyReadCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("historyReadCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if writeCount == nil { - panic("writeCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("writeCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if historyUpdateCount == nil { - panic("historyUpdateCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("historyUpdateCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if callCount == nil { - panic("callCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("callCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if createMonitoredItemsCount == nil { - panic("createMonitoredItemsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("createMonitoredItemsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if modifyMonitoredItemsCount == nil { - panic("modifyMonitoredItemsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("modifyMonitoredItemsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if setMonitoringModeCount == nil { - panic("setMonitoringModeCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("setMonitoringModeCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if setTriggeringCount == nil { - panic("setTriggeringCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("setTriggeringCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if deleteMonitoredItemsCount == nil { - panic("deleteMonitoredItemsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("deleteMonitoredItemsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if createSubscriptionCount == nil { - panic("createSubscriptionCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("createSubscriptionCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if modifySubscriptionCount == nil { - panic("modifySubscriptionCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("modifySubscriptionCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if setPublishingModeCount == nil { - panic("setPublishingModeCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("setPublishingModeCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if publishCount == nil { - panic("publishCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("publishCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if republishCount == nil { - panic("republishCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("republishCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if transferSubscriptionsCount == nil { - panic("transferSubscriptionsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("transferSubscriptionsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if deleteSubscriptionsCount == nil { - panic("deleteSubscriptionsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("deleteSubscriptionsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if addNodesCount == nil { - panic("addNodesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("addNodesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if addReferencesCount == nil { - panic("addReferencesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("addReferencesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if deleteNodesCount == nil { - panic("deleteNodesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("deleteNodesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if deleteReferencesCount == nil { - panic("deleteReferencesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("deleteReferencesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if browseCount == nil { - panic("browseCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("browseCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if browseNextCount == nil { - panic("browseNextCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("browseNextCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if translateBrowsePathsToNodeIdsCount == nil { - panic("translateBrowsePathsToNodeIdsCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("translateBrowsePathsToNodeIdsCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if queryFirstCount == nil { - panic("queryFirstCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("queryFirstCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if queryNextCount == nil { - panic("queryNextCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("queryNextCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if registerNodesCount == nil { - panic("registerNodesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("registerNodesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } if unregisterNodesCount == nil { - panic("unregisterNodesCount of type ExtensionObjectDefinition for SessionDiagnosticsDataType must not be nil") + panic("unregisterNodesCount of type ServiceCounterDataType for SessionDiagnosticsDataType must not be nil") } _result := &_SessionDiagnosticsDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -297,7 +294,6 @@ func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, c ClientDescription: clientDescription, ServerUri: serverUri, EndpointUrl: endpointUrl, - NoOfLocaleIds: noOfLocaleIds, LocaleIds: localeIds, ActualSessionTimeout: actualSessionTimeout, MaxResponseMessageSize: maxResponseMessageSize, @@ -350,7 +346,7 @@ func NewSessionDiagnosticsDataType(sessionId NodeId, sessionName PascalString, c type SessionDiagnosticsDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(sessionId NodeId, sessionName PascalString, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ExtensionObjectDefinition, unauthorizedRequestCount uint32, readCount ExtensionObjectDefinition, historyReadCount ExtensionObjectDefinition, writeCount ExtensionObjectDefinition, historyUpdateCount ExtensionObjectDefinition, callCount ExtensionObjectDefinition, createMonitoredItemsCount ExtensionObjectDefinition, modifyMonitoredItemsCount ExtensionObjectDefinition, setMonitoringModeCount ExtensionObjectDefinition, setTriggeringCount ExtensionObjectDefinition, deleteMonitoredItemsCount ExtensionObjectDefinition, createSubscriptionCount ExtensionObjectDefinition, modifySubscriptionCount ExtensionObjectDefinition, setPublishingModeCount ExtensionObjectDefinition, publishCount ExtensionObjectDefinition, republishCount ExtensionObjectDefinition, transferSubscriptionsCount ExtensionObjectDefinition, deleteSubscriptionsCount ExtensionObjectDefinition, addNodesCount ExtensionObjectDefinition, addReferencesCount ExtensionObjectDefinition, deleteNodesCount ExtensionObjectDefinition, deleteReferencesCount ExtensionObjectDefinition, browseCount ExtensionObjectDefinition, browseNextCount ExtensionObjectDefinition, translateBrowsePathsToNodeIdsCount ExtensionObjectDefinition, queryFirstCount ExtensionObjectDefinition, queryNextCount ExtensionObjectDefinition, registerNodesCount ExtensionObjectDefinition, unregisterNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithMandatoryFields(sessionId NodeId, sessionName PascalString, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ServiceCounterDataType, unauthorizedRequestCount uint32, readCount ServiceCounterDataType, historyReadCount ServiceCounterDataType, writeCount ServiceCounterDataType, historyUpdateCount ServiceCounterDataType, callCount ServiceCounterDataType, createMonitoredItemsCount ServiceCounterDataType, modifyMonitoredItemsCount ServiceCounterDataType, setMonitoringModeCount ServiceCounterDataType, setTriggeringCount ServiceCounterDataType, deleteMonitoredItemsCount ServiceCounterDataType, createSubscriptionCount ServiceCounterDataType, modifySubscriptionCount ServiceCounterDataType, setPublishingModeCount ServiceCounterDataType, publishCount ServiceCounterDataType, republishCount ServiceCounterDataType, transferSubscriptionsCount ServiceCounterDataType, deleteSubscriptionsCount ServiceCounterDataType, addNodesCount ServiceCounterDataType, addReferencesCount ServiceCounterDataType, deleteNodesCount ServiceCounterDataType, deleteReferencesCount ServiceCounterDataType, browseCount ServiceCounterDataType, browseNextCount ServiceCounterDataType, translateBrowsePathsToNodeIdsCount ServiceCounterDataType, queryFirstCount ServiceCounterDataType, queryNextCount ServiceCounterDataType, registerNodesCount ServiceCounterDataType, unregisterNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithSessionId adds SessionId (property field) WithSessionId(NodeId) SessionDiagnosticsDataTypeBuilder // WithSessionIdBuilder adds SessionId (property field) which is build by the builder @@ -360,9 +356,9 @@ type SessionDiagnosticsDataTypeBuilder interface { // WithSessionNameBuilder adds SessionName (property field) which is build by the builder WithSessionNameBuilder(func(PascalStringBuilder) PascalStringBuilder) SessionDiagnosticsDataTypeBuilder // WithClientDescription adds ClientDescription (property field) - WithClientDescription(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithClientDescription(ApplicationDescription) SessionDiagnosticsDataTypeBuilder // WithClientDescriptionBuilder adds ClientDescription (property field) which is build by the builder - WithClientDescriptionBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithClientDescriptionBuilder(func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) SessionDiagnosticsDataTypeBuilder // WithServerUri adds ServerUri (property field) WithServerUri(PascalString) SessionDiagnosticsDataTypeBuilder // WithServerUriBuilder adds ServerUri (property field) which is build by the builder @@ -371,8 +367,6 @@ type SessionDiagnosticsDataTypeBuilder interface { WithEndpointUrl(PascalString) SessionDiagnosticsDataTypeBuilder // WithEndpointUrlBuilder adds EndpointUrl (property field) which is build by the builder WithEndpointUrlBuilder(func(PascalStringBuilder) PascalStringBuilder) SessionDiagnosticsDataTypeBuilder - // WithNoOfLocaleIds adds NoOfLocaleIds (property field) - WithNoOfLocaleIds(int32) SessionDiagnosticsDataTypeBuilder // WithLocaleIds adds LocaleIds (property field) WithLocaleIds(...PascalString) SessionDiagnosticsDataTypeBuilder // WithActualSessionTimeout adds ActualSessionTimeout (property field) @@ -390,123 +384,123 @@ type SessionDiagnosticsDataTypeBuilder interface { // WithCurrentPublishRequestsInQueue adds CurrentPublishRequestsInQueue (property field) WithCurrentPublishRequestsInQueue(uint32) SessionDiagnosticsDataTypeBuilder // WithTotalRequestCount adds TotalRequestCount (property field) - WithTotalRequestCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithTotalRequestCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithTotalRequestCountBuilder adds TotalRequestCount (property field) which is build by the builder - WithTotalRequestCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithTotalRequestCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithUnauthorizedRequestCount adds UnauthorizedRequestCount (property field) WithUnauthorizedRequestCount(uint32) SessionDiagnosticsDataTypeBuilder // WithReadCount adds ReadCount (property field) - WithReadCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithReadCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithReadCountBuilder adds ReadCount (property field) which is build by the builder - WithReadCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithReadCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithHistoryReadCount adds HistoryReadCount (property field) - WithHistoryReadCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithHistoryReadCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithHistoryReadCountBuilder adds HistoryReadCount (property field) which is build by the builder - WithHistoryReadCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithHistoryReadCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithWriteCount adds WriteCount (property field) - WithWriteCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithWriteCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithWriteCountBuilder adds WriteCount (property field) which is build by the builder - WithWriteCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithWriteCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithHistoryUpdateCount adds HistoryUpdateCount (property field) - WithHistoryUpdateCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithHistoryUpdateCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithHistoryUpdateCountBuilder adds HistoryUpdateCount (property field) which is build by the builder - WithHistoryUpdateCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithHistoryUpdateCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithCallCount adds CallCount (property field) - WithCallCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithCallCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithCallCountBuilder adds CallCount (property field) which is build by the builder - WithCallCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithCallCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithCreateMonitoredItemsCount adds CreateMonitoredItemsCount (property field) - WithCreateMonitoredItemsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithCreateMonitoredItemsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithCreateMonitoredItemsCountBuilder adds CreateMonitoredItemsCount (property field) which is build by the builder - WithCreateMonitoredItemsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithCreateMonitoredItemsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithModifyMonitoredItemsCount adds ModifyMonitoredItemsCount (property field) - WithModifyMonitoredItemsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithModifyMonitoredItemsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithModifyMonitoredItemsCountBuilder adds ModifyMonitoredItemsCount (property field) which is build by the builder - WithModifyMonitoredItemsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithModifyMonitoredItemsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithSetMonitoringModeCount adds SetMonitoringModeCount (property field) - WithSetMonitoringModeCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithSetMonitoringModeCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithSetMonitoringModeCountBuilder adds SetMonitoringModeCount (property field) which is build by the builder - WithSetMonitoringModeCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithSetMonitoringModeCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithSetTriggeringCount adds SetTriggeringCount (property field) - WithSetTriggeringCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithSetTriggeringCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithSetTriggeringCountBuilder adds SetTriggeringCount (property field) which is build by the builder - WithSetTriggeringCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithSetTriggeringCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithDeleteMonitoredItemsCount adds DeleteMonitoredItemsCount (property field) - WithDeleteMonitoredItemsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithDeleteMonitoredItemsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithDeleteMonitoredItemsCountBuilder adds DeleteMonitoredItemsCount (property field) which is build by the builder - WithDeleteMonitoredItemsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithDeleteMonitoredItemsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithCreateSubscriptionCount adds CreateSubscriptionCount (property field) - WithCreateSubscriptionCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithCreateSubscriptionCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithCreateSubscriptionCountBuilder adds CreateSubscriptionCount (property field) which is build by the builder - WithCreateSubscriptionCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithCreateSubscriptionCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithModifySubscriptionCount adds ModifySubscriptionCount (property field) - WithModifySubscriptionCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithModifySubscriptionCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithModifySubscriptionCountBuilder adds ModifySubscriptionCount (property field) which is build by the builder - WithModifySubscriptionCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithModifySubscriptionCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithSetPublishingModeCount adds SetPublishingModeCount (property field) - WithSetPublishingModeCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithSetPublishingModeCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithSetPublishingModeCountBuilder adds SetPublishingModeCount (property field) which is build by the builder - WithSetPublishingModeCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithSetPublishingModeCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithPublishCount adds PublishCount (property field) - WithPublishCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithPublishCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithPublishCountBuilder adds PublishCount (property field) which is build by the builder - WithPublishCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithPublishCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithRepublishCount adds RepublishCount (property field) - WithRepublishCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithRepublishCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithRepublishCountBuilder adds RepublishCount (property field) which is build by the builder - WithRepublishCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithRepublishCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithTransferSubscriptionsCount adds TransferSubscriptionsCount (property field) - WithTransferSubscriptionsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithTransferSubscriptionsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithTransferSubscriptionsCountBuilder adds TransferSubscriptionsCount (property field) which is build by the builder - WithTransferSubscriptionsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithTransferSubscriptionsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithDeleteSubscriptionsCount adds DeleteSubscriptionsCount (property field) - WithDeleteSubscriptionsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithDeleteSubscriptionsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithDeleteSubscriptionsCountBuilder adds DeleteSubscriptionsCount (property field) which is build by the builder - WithDeleteSubscriptionsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithDeleteSubscriptionsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithAddNodesCount adds AddNodesCount (property field) - WithAddNodesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithAddNodesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithAddNodesCountBuilder adds AddNodesCount (property field) which is build by the builder - WithAddNodesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithAddNodesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithAddReferencesCount adds AddReferencesCount (property field) - WithAddReferencesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithAddReferencesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithAddReferencesCountBuilder adds AddReferencesCount (property field) which is build by the builder - WithAddReferencesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithAddReferencesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithDeleteNodesCount adds DeleteNodesCount (property field) - WithDeleteNodesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithDeleteNodesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithDeleteNodesCountBuilder adds DeleteNodesCount (property field) which is build by the builder - WithDeleteNodesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithDeleteNodesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithDeleteReferencesCount adds DeleteReferencesCount (property field) - WithDeleteReferencesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithDeleteReferencesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithDeleteReferencesCountBuilder adds DeleteReferencesCount (property field) which is build by the builder - WithDeleteReferencesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithDeleteReferencesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithBrowseCount adds BrowseCount (property field) - WithBrowseCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithBrowseCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithBrowseCountBuilder adds BrowseCount (property field) which is build by the builder - WithBrowseCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithBrowseCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithBrowseNextCount adds BrowseNextCount (property field) - WithBrowseNextCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithBrowseNextCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithBrowseNextCountBuilder adds BrowseNextCount (property field) which is build by the builder - WithBrowseNextCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithBrowseNextCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithTranslateBrowsePathsToNodeIdsCount adds TranslateBrowsePathsToNodeIdsCount (property field) - WithTranslateBrowsePathsToNodeIdsCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithTranslateBrowsePathsToNodeIdsCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithTranslateBrowsePathsToNodeIdsCountBuilder adds TranslateBrowsePathsToNodeIdsCount (property field) which is build by the builder - WithTranslateBrowsePathsToNodeIdsCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithTranslateBrowsePathsToNodeIdsCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithQueryFirstCount adds QueryFirstCount (property field) - WithQueryFirstCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithQueryFirstCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithQueryFirstCountBuilder adds QueryFirstCount (property field) which is build by the builder - WithQueryFirstCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithQueryFirstCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithQueryNextCount adds QueryNextCount (property field) - WithQueryNextCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithQueryNextCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithQueryNextCountBuilder adds QueryNextCount (property field) which is build by the builder - WithQueryNextCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithQueryNextCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithRegisterNodesCount adds RegisterNodesCount (property field) - WithRegisterNodesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithRegisterNodesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithRegisterNodesCountBuilder adds RegisterNodesCount (property field) which is build by the builder - WithRegisterNodesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithRegisterNodesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // WithUnregisterNodesCount adds UnregisterNodesCount (property field) - WithUnregisterNodesCount(ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder + WithUnregisterNodesCount(ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder // WithUnregisterNodesCountBuilder adds UnregisterNodesCount (property field) which is build by the builder - WithUnregisterNodesCountBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder + WithUnregisterNodesCountBuilder(func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder // Build builds the SessionDiagnosticsDataType or returns an error if something is wrong Build() (SessionDiagnosticsDataType, error) // MustBuild does the same as Build but panics on error @@ -532,8 +526,8 @@ func (b *_SessionDiagnosticsDataTypeBuilder) setParent(contract ExtensionObjectD b.ExtensionObjectDefinitionContract = contract } -func (b *_SessionDiagnosticsDataTypeBuilder) WithMandatoryFields(sessionId NodeId, sessionName PascalString, clientDescription ExtensionObjectDefinition, serverUri PascalString, endpointUrl PascalString, noOfLocaleIds int32, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ExtensionObjectDefinition, unauthorizedRequestCount uint32, readCount ExtensionObjectDefinition, historyReadCount ExtensionObjectDefinition, writeCount ExtensionObjectDefinition, historyUpdateCount ExtensionObjectDefinition, callCount ExtensionObjectDefinition, createMonitoredItemsCount ExtensionObjectDefinition, modifyMonitoredItemsCount ExtensionObjectDefinition, setMonitoringModeCount ExtensionObjectDefinition, setTriggeringCount ExtensionObjectDefinition, deleteMonitoredItemsCount ExtensionObjectDefinition, createSubscriptionCount ExtensionObjectDefinition, modifySubscriptionCount ExtensionObjectDefinition, setPublishingModeCount ExtensionObjectDefinition, publishCount ExtensionObjectDefinition, republishCount ExtensionObjectDefinition, transferSubscriptionsCount ExtensionObjectDefinition, deleteSubscriptionsCount ExtensionObjectDefinition, addNodesCount ExtensionObjectDefinition, addReferencesCount ExtensionObjectDefinition, deleteNodesCount ExtensionObjectDefinition, deleteReferencesCount ExtensionObjectDefinition, browseCount ExtensionObjectDefinition, browseNextCount ExtensionObjectDefinition, translateBrowsePathsToNodeIdsCount ExtensionObjectDefinition, queryFirstCount ExtensionObjectDefinition, queryNextCount ExtensionObjectDefinition, registerNodesCount ExtensionObjectDefinition, unregisterNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { - return b.WithSessionId(sessionId).WithSessionName(sessionName).WithClientDescription(clientDescription).WithServerUri(serverUri).WithEndpointUrl(endpointUrl).WithNoOfLocaleIds(noOfLocaleIds).WithLocaleIds(localeIds...).WithActualSessionTimeout(actualSessionTimeout).WithMaxResponseMessageSize(maxResponseMessageSize).WithClientConnectionTime(clientConnectionTime).WithClientLastContactTime(clientLastContactTime).WithCurrentSubscriptionsCount(currentSubscriptionsCount).WithCurrentMonitoredItemsCount(currentMonitoredItemsCount).WithCurrentPublishRequestsInQueue(currentPublishRequestsInQueue).WithTotalRequestCount(totalRequestCount).WithUnauthorizedRequestCount(unauthorizedRequestCount).WithReadCount(readCount).WithHistoryReadCount(historyReadCount).WithWriteCount(writeCount).WithHistoryUpdateCount(historyUpdateCount).WithCallCount(callCount).WithCreateMonitoredItemsCount(createMonitoredItemsCount).WithModifyMonitoredItemsCount(modifyMonitoredItemsCount).WithSetMonitoringModeCount(setMonitoringModeCount).WithSetTriggeringCount(setTriggeringCount).WithDeleteMonitoredItemsCount(deleteMonitoredItemsCount).WithCreateSubscriptionCount(createSubscriptionCount).WithModifySubscriptionCount(modifySubscriptionCount).WithSetPublishingModeCount(setPublishingModeCount).WithPublishCount(publishCount).WithRepublishCount(republishCount).WithTransferSubscriptionsCount(transferSubscriptionsCount).WithDeleteSubscriptionsCount(deleteSubscriptionsCount).WithAddNodesCount(addNodesCount).WithAddReferencesCount(addReferencesCount).WithDeleteNodesCount(deleteNodesCount).WithDeleteReferencesCount(deleteReferencesCount).WithBrowseCount(browseCount).WithBrowseNextCount(browseNextCount).WithTranslateBrowsePathsToNodeIdsCount(translateBrowsePathsToNodeIdsCount).WithQueryFirstCount(queryFirstCount).WithQueryNextCount(queryNextCount).WithRegisterNodesCount(registerNodesCount).WithUnregisterNodesCount(unregisterNodesCount) +func (b *_SessionDiagnosticsDataTypeBuilder) WithMandatoryFields(sessionId NodeId, sessionName PascalString, clientDescription ApplicationDescription, serverUri PascalString, endpointUrl PascalString, localeIds []PascalString, actualSessionTimeout float64, maxResponseMessageSize uint32, clientConnectionTime int64, clientLastContactTime int64, currentSubscriptionsCount uint32, currentMonitoredItemsCount uint32, currentPublishRequestsInQueue uint32, totalRequestCount ServiceCounterDataType, unauthorizedRequestCount uint32, readCount ServiceCounterDataType, historyReadCount ServiceCounterDataType, writeCount ServiceCounterDataType, historyUpdateCount ServiceCounterDataType, callCount ServiceCounterDataType, createMonitoredItemsCount ServiceCounterDataType, modifyMonitoredItemsCount ServiceCounterDataType, setMonitoringModeCount ServiceCounterDataType, setTriggeringCount ServiceCounterDataType, deleteMonitoredItemsCount ServiceCounterDataType, createSubscriptionCount ServiceCounterDataType, modifySubscriptionCount ServiceCounterDataType, setPublishingModeCount ServiceCounterDataType, publishCount ServiceCounterDataType, republishCount ServiceCounterDataType, transferSubscriptionsCount ServiceCounterDataType, deleteSubscriptionsCount ServiceCounterDataType, addNodesCount ServiceCounterDataType, addReferencesCount ServiceCounterDataType, deleteNodesCount ServiceCounterDataType, deleteReferencesCount ServiceCounterDataType, browseCount ServiceCounterDataType, browseNextCount ServiceCounterDataType, translateBrowsePathsToNodeIdsCount ServiceCounterDataType, queryFirstCount ServiceCounterDataType, queryNextCount ServiceCounterDataType, registerNodesCount ServiceCounterDataType, unregisterNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { + return b.WithSessionId(sessionId).WithSessionName(sessionName).WithClientDescription(clientDescription).WithServerUri(serverUri).WithEndpointUrl(endpointUrl).WithLocaleIds(localeIds...).WithActualSessionTimeout(actualSessionTimeout).WithMaxResponseMessageSize(maxResponseMessageSize).WithClientConnectionTime(clientConnectionTime).WithClientLastContactTime(clientLastContactTime).WithCurrentSubscriptionsCount(currentSubscriptionsCount).WithCurrentMonitoredItemsCount(currentMonitoredItemsCount).WithCurrentPublishRequestsInQueue(currentPublishRequestsInQueue).WithTotalRequestCount(totalRequestCount).WithUnauthorizedRequestCount(unauthorizedRequestCount).WithReadCount(readCount).WithHistoryReadCount(historyReadCount).WithWriteCount(writeCount).WithHistoryUpdateCount(historyUpdateCount).WithCallCount(callCount).WithCreateMonitoredItemsCount(createMonitoredItemsCount).WithModifyMonitoredItemsCount(modifyMonitoredItemsCount).WithSetMonitoringModeCount(setMonitoringModeCount).WithSetTriggeringCount(setTriggeringCount).WithDeleteMonitoredItemsCount(deleteMonitoredItemsCount).WithCreateSubscriptionCount(createSubscriptionCount).WithModifySubscriptionCount(modifySubscriptionCount).WithSetPublishingModeCount(setPublishingModeCount).WithPublishCount(publishCount).WithRepublishCount(republishCount).WithTransferSubscriptionsCount(transferSubscriptionsCount).WithDeleteSubscriptionsCount(deleteSubscriptionsCount).WithAddNodesCount(addNodesCount).WithAddReferencesCount(addReferencesCount).WithDeleteNodesCount(deleteNodesCount).WithDeleteReferencesCount(deleteReferencesCount).WithBrowseCount(browseCount).WithBrowseNextCount(browseNextCount).WithTranslateBrowsePathsToNodeIdsCount(translateBrowsePathsToNodeIdsCount).WithQueryFirstCount(queryFirstCount).WithQueryNextCount(queryNextCount).WithRegisterNodesCount(registerNodesCount).WithUnregisterNodesCount(unregisterNodesCount) } func (b *_SessionDiagnosticsDataTypeBuilder) WithSessionId(sessionId NodeId) SessionDiagnosticsDataTypeBuilder { @@ -572,20 +566,20 @@ func (b *_SessionDiagnosticsDataTypeBuilder) WithSessionNameBuilder(builderSuppl return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithClientDescription(clientDescription ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithClientDescription(clientDescription ApplicationDescription) SessionDiagnosticsDataTypeBuilder { b.ClientDescription = clientDescription return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithClientDescriptionBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.ClientDescription.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithClientDescriptionBuilder(builderSupplier func(ApplicationDescriptionBuilder) ApplicationDescriptionBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.ClientDescription.CreateApplicationDescriptionBuilder()) var err error b.ClientDescription, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ApplicationDescriptionBuilder failed")) } return b } @@ -626,11 +620,6 @@ func (b *_SessionDiagnosticsDataTypeBuilder) WithEndpointUrlBuilder(builderSuppl return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithNoOfLocaleIds(noOfLocaleIds int32) SessionDiagnosticsDataTypeBuilder { - b.NoOfLocaleIds = noOfLocaleIds - return b -} - func (b *_SessionDiagnosticsDataTypeBuilder) WithLocaleIds(localeIds ...PascalString) SessionDiagnosticsDataTypeBuilder { b.LocaleIds = localeIds return b @@ -671,20 +660,20 @@ func (b *_SessionDiagnosticsDataTypeBuilder) WithCurrentPublishRequestsInQueue(c return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTotalRequestCount(totalRequestCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithTotalRequestCount(totalRequestCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.TotalRequestCount = totalRequestCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTotalRequestCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.TotalRequestCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithTotalRequestCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.TotalRequestCount.CreateServiceCounterDataTypeBuilder()) var err error b.TotalRequestCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } @@ -694,506 +683,506 @@ func (b *_SessionDiagnosticsDataTypeBuilder) WithUnauthorizedRequestCount(unauth return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithReadCount(readCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithReadCount(readCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.ReadCount = readCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithReadCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.ReadCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithReadCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.ReadCount.CreateServiceCounterDataTypeBuilder()) var err error b.ReadCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryReadCount(historyReadCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryReadCount(historyReadCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.HistoryReadCount = historyReadCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryReadCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.HistoryReadCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryReadCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.HistoryReadCount.CreateServiceCounterDataTypeBuilder()) var err error b.HistoryReadCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithWriteCount(writeCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithWriteCount(writeCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.WriteCount = writeCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithWriteCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.WriteCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithWriteCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.WriteCount.CreateServiceCounterDataTypeBuilder()) var err error b.WriteCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryUpdateCount(historyUpdateCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryUpdateCount(historyUpdateCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.HistoryUpdateCount = historyUpdateCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryUpdateCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.HistoryUpdateCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithHistoryUpdateCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.HistoryUpdateCount.CreateServiceCounterDataTypeBuilder()) var err error b.HistoryUpdateCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCallCount(callCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithCallCount(callCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.CallCount = callCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCallCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.CallCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithCallCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.CallCount.CreateServiceCounterDataTypeBuilder()) var err error b.CallCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateMonitoredItemsCount(createMonitoredItemsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateMonitoredItemsCount(createMonitoredItemsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.CreateMonitoredItemsCount = createMonitoredItemsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateMonitoredItemsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.CreateMonitoredItemsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateMonitoredItemsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.CreateMonitoredItemsCount.CreateServiceCounterDataTypeBuilder()) var err error b.CreateMonitoredItemsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithModifyMonitoredItemsCount(modifyMonitoredItemsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithModifyMonitoredItemsCount(modifyMonitoredItemsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.ModifyMonitoredItemsCount = modifyMonitoredItemsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithModifyMonitoredItemsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.ModifyMonitoredItemsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithModifyMonitoredItemsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.ModifyMonitoredItemsCount.CreateServiceCounterDataTypeBuilder()) var err error b.ModifyMonitoredItemsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetMonitoringModeCount(setMonitoringModeCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetMonitoringModeCount(setMonitoringModeCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.SetMonitoringModeCount = setMonitoringModeCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetMonitoringModeCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.SetMonitoringModeCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetMonitoringModeCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.SetMonitoringModeCount.CreateServiceCounterDataTypeBuilder()) var err error b.SetMonitoringModeCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetTriggeringCount(setTriggeringCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetTriggeringCount(setTriggeringCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.SetTriggeringCount = setTriggeringCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetTriggeringCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.SetTriggeringCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetTriggeringCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.SetTriggeringCount.CreateServiceCounterDataTypeBuilder()) var err error b.SetTriggeringCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteMonitoredItemsCount(deleteMonitoredItemsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteMonitoredItemsCount(deleteMonitoredItemsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.DeleteMonitoredItemsCount = deleteMonitoredItemsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteMonitoredItemsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.DeleteMonitoredItemsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteMonitoredItemsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.DeleteMonitoredItemsCount.CreateServiceCounterDataTypeBuilder()) var err error b.DeleteMonitoredItemsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateSubscriptionCount(createSubscriptionCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateSubscriptionCount(createSubscriptionCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.CreateSubscriptionCount = createSubscriptionCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateSubscriptionCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.CreateSubscriptionCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithCreateSubscriptionCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.CreateSubscriptionCount.CreateServiceCounterDataTypeBuilder()) var err error b.CreateSubscriptionCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithModifySubscriptionCount(modifySubscriptionCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithModifySubscriptionCount(modifySubscriptionCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.ModifySubscriptionCount = modifySubscriptionCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithModifySubscriptionCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.ModifySubscriptionCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithModifySubscriptionCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.ModifySubscriptionCount.CreateServiceCounterDataTypeBuilder()) var err error b.ModifySubscriptionCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetPublishingModeCount(setPublishingModeCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetPublishingModeCount(setPublishingModeCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.SetPublishingModeCount = setPublishingModeCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithSetPublishingModeCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.SetPublishingModeCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithSetPublishingModeCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.SetPublishingModeCount.CreateServiceCounterDataTypeBuilder()) var err error b.SetPublishingModeCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithPublishCount(publishCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithPublishCount(publishCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.PublishCount = publishCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithPublishCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.PublishCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithPublishCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.PublishCount.CreateServiceCounterDataTypeBuilder()) var err error b.PublishCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithRepublishCount(republishCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithRepublishCount(republishCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.RepublishCount = republishCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithRepublishCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.RepublishCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithRepublishCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.RepublishCount.CreateServiceCounterDataTypeBuilder()) var err error b.RepublishCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTransferSubscriptionsCount(transferSubscriptionsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithTransferSubscriptionsCount(transferSubscriptionsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.TransferSubscriptionsCount = transferSubscriptionsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTransferSubscriptionsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.TransferSubscriptionsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithTransferSubscriptionsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.TransferSubscriptionsCount.CreateServiceCounterDataTypeBuilder()) var err error b.TransferSubscriptionsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteSubscriptionsCount(deleteSubscriptionsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteSubscriptionsCount(deleteSubscriptionsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.DeleteSubscriptionsCount = deleteSubscriptionsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteSubscriptionsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.DeleteSubscriptionsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteSubscriptionsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.DeleteSubscriptionsCount.CreateServiceCounterDataTypeBuilder()) var err error b.DeleteSubscriptionsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithAddNodesCount(addNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithAddNodesCount(addNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.AddNodesCount = addNodesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithAddNodesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.AddNodesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithAddNodesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.AddNodesCount.CreateServiceCounterDataTypeBuilder()) var err error b.AddNodesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithAddReferencesCount(addReferencesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithAddReferencesCount(addReferencesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.AddReferencesCount = addReferencesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithAddReferencesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.AddReferencesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithAddReferencesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.AddReferencesCount.CreateServiceCounterDataTypeBuilder()) var err error b.AddReferencesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteNodesCount(deleteNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteNodesCount(deleteNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.DeleteNodesCount = deleteNodesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteNodesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.DeleteNodesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteNodesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.DeleteNodesCount.CreateServiceCounterDataTypeBuilder()) var err error b.DeleteNodesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteReferencesCount(deleteReferencesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteReferencesCount(deleteReferencesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.DeleteReferencesCount = deleteReferencesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteReferencesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.DeleteReferencesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithDeleteReferencesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.DeleteReferencesCount.CreateServiceCounterDataTypeBuilder()) var err error b.DeleteReferencesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseCount(browseCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseCount(browseCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.BrowseCount = browseCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.BrowseCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.BrowseCount.CreateServiceCounterDataTypeBuilder()) var err error b.BrowseCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseNextCount(browseNextCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseNextCount(browseNextCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.BrowseNextCount = browseNextCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseNextCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.BrowseNextCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithBrowseNextCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.BrowseNextCount.CreateServiceCounterDataTypeBuilder()) var err error b.BrowseNextCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTranslateBrowsePathsToNodeIdsCount(translateBrowsePathsToNodeIdsCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithTranslateBrowsePathsToNodeIdsCount(translateBrowsePathsToNodeIdsCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.TranslateBrowsePathsToNodeIdsCount = translateBrowsePathsToNodeIdsCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithTranslateBrowsePathsToNodeIdsCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.TranslateBrowsePathsToNodeIdsCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithTranslateBrowsePathsToNodeIdsCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.TranslateBrowsePathsToNodeIdsCount.CreateServiceCounterDataTypeBuilder()) var err error b.TranslateBrowsePathsToNodeIdsCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryFirstCount(queryFirstCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryFirstCount(queryFirstCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.QueryFirstCount = queryFirstCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryFirstCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.QueryFirstCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryFirstCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.QueryFirstCount.CreateServiceCounterDataTypeBuilder()) var err error b.QueryFirstCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryNextCount(queryNextCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryNextCount(queryNextCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.QueryNextCount = queryNextCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryNextCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.QueryNextCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithQueryNextCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.QueryNextCount.CreateServiceCounterDataTypeBuilder()) var err error b.QueryNextCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithRegisterNodesCount(registerNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithRegisterNodesCount(registerNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.RegisterNodesCount = registerNodesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithRegisterNodesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.RegisterNodesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithRegisterNodesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.RegisterNodesCount.CreateServiceCounterDataTypeBuilder()) var err error b.RegisterNodesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithUnregisterNodesCount(unregisterNodesCount ExtensionObjectDefinition) SessionDiagnosticsDataTypeBuilder { +func (b *_SessionDiagnosticsDataTypeBuilder) WithUnregisterNodesCount(unregisterNodesCount ServiceCounterDataType) SessionDiagnosticsDataTypeBuilder { b.UnregisterNodesCount = unregisterNodesCount return b } -func (b *_SessionDiagnosticsDataTypeBuilder) WithUnregisterNodesCountBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SessionDiagnosticsDataTypeBuilder { - builder := builderSupplier(b.UnregisterNodesCount.CreateExtensionObjectDefinitionBuilder()) +func (b *_SessionDiagnosticsDataTypeBuilder) WithUnregisterNodesCountBuilder(builderSupplier func(ServiceCounterDataTypeBuilder) ServiceCounterDataTypeBuilder) SessionDiagnosticsDataTypeBuilder { + builder := builderSupplier(b.UnregisterNodesCount.CreateServiceCounterDataTypeBuilder()) var err error b.UnregisterNodesCount, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ServiceCounterDataTypeBuilder failed")) } return b } @@ -1452,8 +1441,8 @@ func (b *_SessionDiagnosticsDataType) CreateSessionDiagnosticsDataTypeBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SessionDiagnosticsDataType) GetIdentifier() string { - return "867" +func (m *_SessionDiagnosticsDataType) GetExtensionId() int32 { + return int32(867) } /////////////////////// @@ -1478,7 +1467,7 @@ func (m *_SessionDiagnosticsDataType) GetSessionName() PascalString { return m.SessionName } -func (m *_SessionDiagnosticsDataType) GetClientDescription() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetClientDescription() ApplicationDescription { return m.ClientDescription } @@ -1490,10 +1479,6 @@ func (m *_SessionDiagnosticsDataType) GetEndpointUrl() PascalString { return m.EndpointUrl } -func (m *_SessionDiagnosticsDataType) GetNoOfLocaleIds() int32 { - return m.NoOfLocaleIds -} - func (m *_SessionDiagnosticsDataType) GetLocaleIds() []PascalString { return m.LocaleIds } @@ -1526,7 +1511,7 @@ func (m *_SessionDiagnosticsDataType) GetCurrentPublishRequestsInQueue() uint32 return m.CurrentPublishRequestsInQueue } -func (m *_SessionDiagnosticsDataType) GetTotalRequestCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetTotalRequestCount() ServiceCounterDataType { return m.TotalRequestCount } @@ -1534,115 +1519,115 @@ func (m *_SessionDiagnosticsDataType) GetUnauthorizedRequestCount() uint32 { return m.UnauthorizedRequestCount } -func (m *_SessionDiagnosticsDataType) GetReadCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetReadCount() ServiceCounterDataType { return m.ReadCount } -func (m *_SessionDiagnosticsDataType) GetHistoryReadCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetHistoryReadCount() ServiceCounterDataType { return m.HistoryReadCount } -func (m *_SessionDiagnosticsDataType) GetWriteCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetWriteCount() ServiceCounterDataType { return m.WriteCount } -func (m *_SessionDiagnosticsDataType) GetHistoryUpdateCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetHistoryUpdateCount() ServiceCounterDataType { return m.HistoryUpdateCount } -func (m *_SessionDiagnosticsDataType) GetCallCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetCallCount() ServiceCounterDataType { return m.CallCount } -func (m *_SessionDiagnosticsDataType) GetCreateMonitoredItemsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetCreateMonitoredItemsCount() ServiceCounterDataType { return m.CreateMonitoredItemsCount } -func (m *_SessionDiagnosticsDataType) GetModifyMonitoredItemsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetModifyMonitoredItemsCount() ServiceCounterDataType { return m.ModifyMonitoredItemsCount } -func (m *_SessionDiagnosticsDataType) GetSetMonitoringModeCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetSetMonitoringModeCount() ServiceCounterDataType { return m.SetMonitoringModeCount } -func (m *_SessionDiagnosticsDataType) GetSetTriggeringCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetSetTriggeringCount() ServiceCounterDataType { return m.SetTriggeringCount } -func (m *_SessionDiagnosticsDataType) GetDeleteMonitoredItemsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetDeleteMonitoredItemsCount() ServiceCounterDataType { return m.DeleteMonitoredItemsCount } -func (m *_SessionDiagnosticsDataType) GetCreateSubscriptionCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetCreateSubscriptionCount() ServiceCounterDataType { return m.CreateSubscriptionCount } -func (m *_SessionDiagnosticsDataType) GetModifySubscriptionCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetModifySubscriptionCount() ServiceCounterDataType { return m.ModifySubscriptionCount } -func (m *_SessionDiagnosticsDataType) GetSetPublishingModeCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetSetPublishingModeCount() ServiceCounterDataType { return m.SetPublishingModeCount } -func (m *_SessionDiagnosticsDataType) GetPublishCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetPublishCount() ServiceCounterDataType { return m.PublishCount } -func (m *_SessionDiagnosticsDataType) GetRepublishCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetRepublishCount() ServiceCounterDataType { return m.RepublishCount } -func (m *_SessionDiagnosticsDataType) GetTransferSubscriptionsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetTransferSubscriptionsCount() ServiceCounterDataType { return m.TransferSubscriptionsCount } -func (m *_SessionDiagnosticsDataType) GetDeleteSubscriptionsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetDeleteSubscriptionsCount() ServiceCounterDataType { return m.DeleteSubscriptionsCount } -func (m *_SessionDiagnosticsDataType) GetAddNodesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetAddNodesCount() ServiceCounterDataType { return m.AddNodesCount } -func (m *_SessionDiagnosticsDataType) GetAddReferencesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetAddReferencesCount() ServiceCounterDataType { return m.AddReferencesCount } -func (m *_SessionDiagnosticsDataType) GetDeleteNodesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetDeleteNodesCount() ServiceCounterDataType { return m.DeleteNodesCount } -func (m *_SessionDiagnosticsDataType) GetDeleteReferencesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetDeleteReferencesCount() ServiceCounterDataType { return m.DeleteReferencesCount } -func (m *_SessionDiagnosticsDataType) GetBrowseCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetBrowseCount() ServiceCounterDataType { return m.BrowseCount } -func (m *_SessionDiagnosticsDataType) GetBrowseNextCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetBrowseNextCount() ServiceCounterDataType { return m.BrowseNextCount } -func (m *_SessionDiagnosticsDataType) GetTranslateBrowsePathsToNodeIdsCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetTranslateBrowsePathsToNodeIdsCount() ServiceCounterDataType { return m.TranslateBrowsePathsToNodeIdsCount } -func (m *_SessionDiagnosticsDataType) GetQueryFirstCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetQueryFirstCount() ServiceCounterDataType { return m.QueryFirstCount } -func (m *_SessionDiagnosticsDataType) GetQueryNextCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetQueryNextCount() ServiceCounterDataType { return m.QueryNextCount } -func (m *_SessionDiagnosticsDataType) GetRegisterNodesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetRegisterNodesCount() ServiceCounterDataType { return m.RegisterNodesCount } -func (m *_SessionDiagnosticsDataType) GetUnregisterNodesCount() ExtensionObjectDefinition { +func (m *_SessionDiagnosticsDataType) GetUnregisterNodesCount() ServiceCounterDataType { return m.UnregisterNodesCount } @@ -1684,7 +1669,7 @@ func (m *_SessionDiagnosticsDataType) GetLengthInBits(ctx context.Context) uint1 // Simple field (endpointUrl) lengthInBits += m.EndpointUrl.GetLengthInBits(ctx) - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32 // Array field @@ -1815,7 +1800,7 @@ func (m *_SessionDiagnosticsDataType) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__sessionDiagnosticsDataType SessionDiagnosticsDataType, err error) { +func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__sessionDiagnosticsDataType SessionDiagnosticsDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -1838,7 +1823,7 @@ func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer util } m.SessionName = sessionName - clientDescription, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "clientDescription", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("310")), readBuffer)) + clientDescription, err := ReadSimpleField[ApplicationDescription](ctx, "clientDescription", ReadComplex[ApplicationDescription](ExtensionObjectDefinitionParseWithBufferProducer[ApplicationDescription]((int32)(int32(310))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'clientDescription' field")) } @@ -1856,11 +1841,11 @@ func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer util } m.EndpointUrl = endpointUrl - noOfLocaleIds, err := ReadSimpleField(ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) } - m.NoOfLocaleIds = noOfLocaleIds + _ = noOfLocaleIds localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) if err != nil { @@ -1910,7 +1895,7 @@ func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer util } m.CurrentPublishRequestsInQueue = currentPublishRequestsInQueue - totalRequestCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "totalRequestCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + totalRequestCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "totalRequestCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'totalRequestCount' field")) } @@ -1922,169 +1907,169 @@ func (m *_SessionDiagnosticsDataType) parse(ctx context.Context, readBuffer util } m.UnauthorizedRequestCount = unauthorizedRequestCount - readCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "readCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + readCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "readCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'readCount' field")) } m.ReadCount = readCount - historyReadCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "historyReadCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + historyReadCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "historyReadCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historyReadCount' field")) } m.HistoryReadCount = historyReadCount - writeCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "writeCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + writeCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "writeCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeCount' field")) } m.WriteCount = writeCount - historyUpdateCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "historyUpdateCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + historyUpdateCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "historyUpdateCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historyUpdateCount' field")) } m.HistoryUpdateCount = historyUpdateCount - callCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "callCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + callCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "callCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'callCount' field")) } m.CallCount = callCount - createMonitoredItemsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "createMonitoredItemsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + createMonitoredItemsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "createMonitoredItemsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'createMonitoredItemsCount' field")) } m.CreateMonitoredItemsCount = createMonitoredItemsCount - modifyMonitoredItemsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "modifyMonitoredItemsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + modifyMonitoredItemsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "modifyMonitoredItemsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'modifyMonitoredItemsCount' field")) } m.ModifyMonitoredItemsCount = modifyMonitoredItemsCount - setMonitoringModeCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "setMonitoringModeCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + setMonitoringModeCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "setMonitoringModeCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'setMonitoringModeCount' field")) } m.SetMonitoringModeCount = setMonitoringModeCount - setTriggeringCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "setTriggeringCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + setTriggeringCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "setTriggeringCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'setTriggeringCount' field")) } m.SetTriggeringCount = setTriggeringCount - deleteMonitoredItemsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "deleteMonitoredItemsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + deleteMonitoredItemsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "deleteMonitoredItemsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deleteMonitoredItemsCount' field")) } m.DeleteMonitoredItemsCount = deleteMonitoredItemsCount - createSubscriptionCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "createSubscriptionCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + createSubscriptionCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "createSubscriptionCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'createSubscriptionCount' field")) } m.CreateSubscriptionCount = createSubscriptionCount - modifySubscriptionCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "modifySubscriptionCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + modifySubscriptionCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "modifySubscriptionCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'modifySubscriptionCount' field")) } m.ModifySubscriptionCount = modifySubscriptionCount - setPublishingModeCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "setPublishingModeCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + setPublishingModeCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "setPublishingModeCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'setPublishingModeCount' field")) } m.SetPublishingModeCount = setPublishingModeCount - publishCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "publishCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + publishCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "publishCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishCount' field")) } m.PublishCount = publishCount - republishCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "republishCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + republishCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "republishCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'republishCount' field")) } m.RepublishCount = republishCount - transferSubscriptionsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "transferSubscriptionsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + transferSubscriptionsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "transferSubscriptionsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transferSubscriptionsCount' field")) } m.TransferSubscriptionsCount = transferSubscriptionsCount - deleteSubscriptionsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "deleteSubscriptionsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + deleteSubscriptionsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "deleteSubscriptionsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deleteSubscriptionsCount' field")) } m.DeleteSubscriptionsCount = deleteSubscriptionsCount - addNodesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "addNodesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + addNodesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "addNodesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'addNodesCount' field")) } m.AddNodesCount = addNodesCount - addReferencesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "addReferencesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + addReferencesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "addReferencesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'addReferencesCount' field")) } m.AddReferencesCount = addReferencesCount - deleteNodesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "deleteNodesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + deleteNodesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "deleteNodesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deleteNodesCount' field")) } m.DeleteNodesCount = deleteNodesCount - deleteReferencesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "deleteReferencesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + deleteReferencesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "deleteReferencesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'deleteReferencesCount' field")) } m.DeleteReferencesCount = deleteReferencesCount - browseCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "browseCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + browseCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "browseCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'browseCount' field")) } m.BrowseCount = browseCount - browseNextCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "browseNextCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + browseNextCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "browseNextCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'browseNextCount' field")) } m.BrowseNextCount = browseNextCount - translateBrowsePathsToNodeIdsCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "translateBrowsePathsToNodeIdsCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + translateBrowsePathsToNodeIdsCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "translateBrowsePathsToNodeIdsCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'translateBrowsePathsToNodeIdsCount' field")) } m.TranslateBrowsePathsToNodeIdsCount = translateBrowsePathsToNodeIdsCount - queryFirstCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "queryFirstCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + queryFirstCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "queryFirstCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queryFirstCount' field")) } m.QueryFirstCount = queryFirstCount - queryNextCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "queryNextCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + queryNextCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "queryNextCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'queryNextCount' field")) } m.QueryNextCount = queryNextCount - registerNodesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "registerNodesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + registerNodesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "registerNodesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'registerNodesCount' field")) } m.RegisterNodesCount = registerNodesCount - unregisterNodesCount, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "unregisterNodesCount", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("873")), readBuffer)) + unregisterNodesCount, err := ReadSimpleField[ServiceCounterDataType](ctx, "unregisterNodesCount", ReadComplex[ServiceCounterDataType](ExtensionObjectDefinitionParseWithBufferProducer[ServiceCounterDataType]((int32)(int32(873))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'unregisterNodesCount' field")) } @@ -2123,7 +2108,7 @@ func (m *_SessionDiagnosticsDataType) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(err, "Error serializing 'sessionName' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "clientDescription", m.GetClientDescription(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ApplicationDescription](ctx, "clientDescription", m.GetClientDescription(), WriteComplex[ApplicationDescription](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'clientDescription' field") } @@ -2134,8 +2119,8 @@ func (m *_SessionDiagnosticsDataType) SerializeWithWriteBuffer(ctx context.Conte if err := WriteSimpleField[PascalString](ctx, "endpointUrl", m.GetEndpointUrl(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'endpointUrl' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLocaleIds", m.GetNoOfLocaleIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") } @@ -2171,7 +2156,7 @@ func (m *_SessionDiagnosticsDataType) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(err, "Error serializing 'currentPublishRequestsInQueue' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "totalRequestCount", m.GetTotalRequestCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "totalRequestCount", m.GetTotalRequestCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'totalRequestCount' field") } @@ -2179,115 +2164,115 @@ func (m *_SessionDiagnosticsDataType) SerializeWithWriteBuffer(ctx context.Conte return errors.Wrap(err, "Error serializing 'unauthorizedRequestCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "readCount", m.GetReadCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "readCount", m.GetReadCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'readCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "historyReadCount", m.GetHistoryReadCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "historyReadCount", m.GetHistoryReadCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'historyReadCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "writeCount", m.GetWriteCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "writeCount", m.GetWriteCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'writeCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "historyUpdateCount", m.GetHistoryUpdateCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "historyUpdateCount", m.GetHistoryUpdateCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'historyUpdateCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "callCount", m.GetCallCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "callCount", m.GetCallCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'callCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "createMonitoredItemsCount", m.GetCreateMonitoredItemsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "createMonitoredItemsCount", m.GetCreateMonitoredItemsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'createMonitoredItemsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "modifyMonitoredItemsCount", m.GetModifyMonitoredItemsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "modifyMonitoredItemsCount", m.GetModifyMonitoredItemsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'modifyMonitoredItemsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "setMonitoringModeCount", m.GetSetMonitoringModeCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "setMonitoringModeCount", m.GetSetMonitoringModeCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'setMonitoringModeCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "setTriggeringCount", m.GetSetTriggeringCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "setTriggeringCount", m.GetSetTriggeringCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'setTriggeringCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "deleteMonitoredItemsCount", m.GetDeleteMonitoredItemsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "deleteMonitoredItemsCount", m.GetDeleteMonitoredItemsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'deleteMonitoredItemsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "createSubscriptionCount", m.GetCreateSubscriptionCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "createSubscriptionCount", m.GetCreateSubscriptionCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'createSubscriptionCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "modifySubscriptionCount", m.GetModifySubscriptionCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "modifySubscriptionCount", m.GetModifySubscriptionCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'modifySubscriptionCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "setPublishingModeCount", m.GetSetPublishingModeCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "setPublishingModeCount", m.GetSetPublishingModeCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'setPublishingModeCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "publishCount", m.GetPublishCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "publishCount", m.GetPublishCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'publishCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "republishCount", m.GetRepublishCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "republishCount", m.GetRepublishCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'republishCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "transferSubscriptionsCount", m.GetTransferSubscriptionsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "transferSubscriptionsCount", m.GetTransferSubscriptionsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'transferSubscriptionsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "deleteSubscriptionsCount", m.GetDeleteSubscriptionsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "deleteSubscriptionsCount", m.GetDeleteSubscriptionsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'deleteSubscriptionsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "addNodesCount", m.GetAddNodesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "addNodesCount", m.GetAddNodesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'addNodesCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "addReferencesCount", m.GetAddReferencesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "addReferencesCount", m.GetAddReferencesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'addReferencesCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "deleteNodesCount", m.GetDeleteNodesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "deleteNodesCount", m.GetDeleteNodesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'deleteNodesCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "deleteReferencesCount", m.GetDeleteReferencesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "deleteReferencesCount", m.GetDeleteReferencesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'deleteReferencesCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "browseCount", m.GetBrowseCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "browseCount", m.GetBrowseCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'browseCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "browseNextCount", m.GetBrowseNextCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "browseNextCount", m.GetBrowseNextCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'browseNextCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "translateBrowsePathsToNodeIdsCount", m.GetTranslateBrowsePathsToNodeIdsCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "translateBrowsePathsToNodeIdsCount", m.GetTranslateBrowsePathsToNodeIdsCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'translateBrowsePathsToNodeIdsCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "queryFirstCount", m.GetQueryFirstCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "queryFirstCount", m.GetQueryFirstCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'queryFirstCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "queryNextCount", m.GetQueryNextCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "queryNextCount", m.GetQueryNextCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'queryNextCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "registerNodesCount", m.GetRegisterNodesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "registerNodesCount", m.GetRegisterNodesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'registerNodesCount' field") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "unregisterNodesCount", m.GetUnregisterNodesCount(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ServiceCounterDataType](ctx, "unregisterNodesCount", m.GetUnregisterNodesCount(), WriteComplex[ServiceCounterDataType](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'unregisterNodesCount' field") } @@ -2313,10 +2298,9 @@ func (m *_SessionDiagnosticsDataType) deepCopy() *_SessionDiagnosticsDataType { m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.SessionId.DeepCopy().(NodeId), m.SessionName.DeepCopy().(PascalString), - m.ClientDescription.DeepCopy().(ExtensionObjectDefinition), + m.ClientDescription.DeepCopy().(ApplicationDescription), m.ServerUri.DeepCopy().(PascalString), m.EndpointUrl.DeepCopy().(PascalString), - m.NoOfLocaleIds, utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), m.ActualSessionTimeout, m.MaxResponseMessageSize, @@ -2325,36 +2309,36 @@ func (m *_SessionDiagnosticsDataType) deepCopy() *_SessionDiagnosticsDataType { m.CurrentSubscriptionsCount, m.CurrentMonitoredItemsCount, m.CurrentPublishRequestsInQueue, - m.TotalRequestCount.DeepCopy().(ExtensionObjectDefinition), + m.TotalRequestCount.DeepCopy().(ServiceCounterDataType), m.UnauthorizedRequestCount, - m.ReadCount.DeepCopy().(ExtensionObjectDefinition), - m.HistoryReadCount.DeepCopy().(ExtensionObjectDefinition), - m.WriteCount.DeepCopy().(ExtensionObjectDefinition), - m.HistoryUpdateCount.DeepCopy().(ExtensionObjectDefinition), - m.CallCount.DeepCopy().(ExtensionObjectDefinition), - m.CreateMonitoredItemsCount.DeepCopy().(ExtensionObjectDefinition), - m.ModifyMonitoredItemsCount.DeepCopy().(ExtensionObjectDefinition), - m.SetMonitoringModeCount.DeepCopy().(ExtensionObjectDefinition), - m.SetTriggeringCount.DeepCopy().(ExtensionObjectDefinition), - m.DeleteMonitoredItemsCount.DeepCopy().(ExtensionObjectDefinition), - m.CreateSubscriptionCount.DeepCopy().(ExtensionObjectDefinition), - m.ModifySubscriptionCount.DeepCopy().(ExtensionObjectDefinition), - m.SetPublishingModeCount.DeepCopy().(ExtensionObjectDefinition), - m.PublishCount.DeepCopy().(ExtensionObjectDefinition), - m.RepublishCount.DeepCopy().(ExtensionObjectDefinition), - m.TransferSubscriptionsCount.DeepCopy().(ExtensionObjectDefinition), - m.DeleteSubscriptionsCount.DeepCopy().(ExtensionObjectDefinition), - m.AddNodesCount.DeepCopy().(ExtensionObjectDefinition), - m.AddReferencesCount.DeepCopy().(ExtensionObjectDefinition), - m.DeleteNodesCount.DeepCopy().(ExtensionObjectDefinition), - m.DeleteReferencesCount.DeepCopy().(ExtensionObjectDefinition), - m.BrowseCount.DeepCopy().(ExtensionObjectDefinition), - m.BrowseNextCount.DeepCopy().(ExtensionObjectDefinition), - m.TranslateBrowsePathsToNodeIdsCount.DeepCopy().(ExtensionObjectDefinition), - m.QueryFirstCount.DeepCopy().(ExtensionObjectDefinition), - m.QueryNextCount.DeepCopy().(ExtensionObjectDefinition), - m.RegisterNodesCount.DeepCopy().(ExtensionObjectDefinition), - m.UnregisterNodesCount.DeepCopy().(ExtensionObjectDefinition), + m.ReadCount.DeepCopy().(ServiceCounterDataType), + m.HistoryReadCount.DeepCopy().(ServiceCounterDataType), + m.WriteCount.DeepCopy().(ServiceCounterDataType), + m.HistoryUpdateCount.DeepCopy().(ServiceCounterDataType), + m.CallCount.DeepCopy().(ServiceCounterDataType), + m.CreateMonitoredItemsCount.DeepCopy().(ServiceCounterDataType), + m.ModifyMonitoredItemsCount.DeepCopy().(ServiceCounterDataType), + m.SetMonitoringModeCount.DeepCopy().(ServiceCounterDataType), + m.SetTriggeringCount.DeepCopy().(ServiceCounterDataType), + m.DeleteMonitoredItemsCount.DeepCopy().(ServiceCounterDataType), + m.CreateSubscriptionCount.DeepCopy().(ServiceCounterDataType), + m.ModifySubscriptionCount.DeepCopy().(ServiceCounterDataType), + m.SetPublishingModeCount.DeepCopy().(ServiceCounterDataType), + m.PublishCount.DeepCopy().(ServiceCounterDataType), + m.RepublishCount.DeepCopy().(ServiceCounterDataType), + m.TransferSubscriptionsCount.DeepCopy().(ServiceCounterDataType), + m.DeleteSubscriptionsCount.DeepCopy().(ServiceCounterDataType), + m.AddNodesCount.DeepCopy().(ServiceCounterDataType), + m.AddReferencesCount.DeepCopy().(ServiceCounterDataType), + m.DeleteNodesCount.DeepCopy().(ServiceCounterDataType), + m.DeleteReferencesCount.DeepCopy().(ServiceCounterDataType), + m.BrowseCount.DeepCopy().(ServiceCounterDataType), + m.BrowseNextCount.DeepCopy().(ServiceCounterDataType), + m.TranslateBrowsePathsToNodeIdsCount.DeepCopy().(ServiceCounterDataType), + m.QueryFirstCount.DeepCopy().(ServiceCounterDataType), + m.QueryNextCount.DeepCopy().(ServiceCounterDataType), + m.RegisterNodesCount.DeepCopy().(ServiceCounterDataType), + m.UnregisterNodesCount.DeepCopy().(ServiceCounterDataType), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _SessionDiagnosticsDataTypeCopy diff --git a/plc4go/protocols/opcua/readwrite/model/SessionSecurityDiagnosticsDataType.go b/plc4go/protocols/opcua/readwrite/model/SessionSecurityDiagnosticsDataType.go index 1dc5be64034..c40ceceaec0 100644 --- a/plc4go/protocols/opcua/readwrite/model/SessionSecurityDiagnosticsDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SessionSecurityDiagnosticsDataType.go @@ -44,8 +44,6 @@ type SessionSecurityDiagnosticsDataType interface { GetSessionId() NodeId // GetClientUserIdOfSession returns ClientUserIdOfSession (property field) GetClientUserIdOfSession() PascalString - // GetNoOfClientUserIdHistory returns NoOfClientUserIdHistory (property field) - GetNoOfClientUserIdHistory() int32 // GetClientUserIdHistory returns ClientUserIdHistory (property field) GetClientUserIdHistory() []PascalString // GetAuthenticationMechanism returns AuthenticationMechanism (property field) @@ -71,7 +69,6 @@ type _SessionSecurityDiagnosticsDataType struct { ExtensionObjectDefinitionContract SessionId NodeId ClientUserIdOfSession PascalString - NoOfClientUserIdHistory int32 ClientUserIdHistory []PascalString AuthenticationMechanism PascalString Encoding PascalString @@ -85,7 +82,7 @@ var _ SessionSecurityDiagnosticsDataType = (*_SessionSecurityDiagnosticsDataType var _ ExtensionObjectDefinitionRequirements = (*_SessionSecurityDiagnosticsDataType)(nil) // NewSessionSecurityDiagnosticsDataType factory function for _SessionSecurityDiagnosticsDataType -func NewSessionSecurityDiagnosticsDataType(sessionId NodeId, clientUserIdOfSession PascalString, noOfClientUserIdHistory int32, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) *_SessionSecurityDiagnosticsDataType { +func NewSessionSecurityDiagnosticsDataType(sessionId NodeId, clientUserIdOfSession PascalString, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) *_SessionSecurityDiagnosticsDataType { if sessionId == nil { panic("sessionId of type NodeId for SessionSecurityDiagnosticsDataType must not be nil") } @@ -111,7 +108,6 @@ func NewSessionSecurityDiagnosticsDataType(sessionId NodeId, clientUserIdOfSessi ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), SessionId: sessionId, ClientUserIdOfSession: clientUserIdOfSession, - NoOfClientUserIdHistory: noOfClientUserIdHistory, ClientUserIdHistory: clientUserIdHistory, AuthenticationMechanism: authenticationMechanism, Encoding: encoding, @@ -133,7 +129,7 @@ func NewSessionSecurityDiagnosticsDataType(sessionId NodeId, clientUserIdOfSessi type SessionSecurityDiagnosticsDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(sessionId NodeId, clientUserIdOfSession PascalString, noOfClientUserIdHistory int32, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) SessionSecurityDiagnosticsDataTypeBuilder + WithMandatoryFields(sessionId NodeId, clientUserIdOfSession PascalString, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) SessionSecurityDiagnosticsDataTypeBuilder // WithSessionId adds SessionId (property field) WithSessionId(NodeId) SessionSecurityDiagnosticsDataTypeBuilder // WithSessionIdBuilder adds SessionId (property field) which is build by the builder @@ -142,8 +138,6 @@ type SessionSecurityDiagnosticsDataTypeBuilder interface { WithClientUserIdOfSession(PascalString) SessionSecurityDiagnosticsDataTypeBuilder // WithClientUserIdOfSessionBuilder adds ClientUserIdOfSession (property field) which is build by the builder WithClientUserIdOfSessionBuilder(func(PascalStringBuilder) PascalStringBuilder) SessionSecurityDiagnosticsDataTypeBuilder - // WithNoOfClientUserIdHistory adds NoOfClientUserIdHistory (property field) - WithNoOfClientUserIdHistory(int32) SessionSecurityDiagnosticsDataTypeBuilder // WithClientUserIdHistory adds ClientUserIdHistory (property field) WithClientUserIdHistory(...PascalString) SessionSecurityDiagnosticsDataTypeBuilder // WithAuthenticationMechanism adds AuthenticationMechanism (property field) @@ -193,8 +187,8 @@ func (b *_SessionSecurityDiagnosticsDataTypeBuilder) setParent(contract Extensio b.ExtensionObjectDefinitionContract = contract } -func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithMandatoryFields(sessionId NodeId, clientUserIdOfSession PascalString, noOfClientUserIdHistory int32, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) SessionSecurityDiagnosticsDataTypeBuilder { - return b.WithSessionId(sessionId).WithClientUserIdOfSession(clientUserIdOfSession).WithNoOfClientUserIdHistory(noOfClientUserIdHistory).WithClientUserIdHistory(clientUserIdHistory...).WithAuthenticationMechanism(authenticationMechanism).WithEncoding(encoding).WithTransportProtocol(transportProtocol).WithSecurityMode(securityMode).WithSecurityPolicyUri(securityPolicyUri).WithClientCertificate(clientCertificate) +func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithMandatoryFields(sessionId NodeId, clientUserIdOfSession PascalString, clientUserIdHistory []PascalString, authenticationMechanism PascalString, encoding PascalString, transportProtocol PascalString, securityMode MessageSecurityMode, securityPolicyUri PascalString, clientCertificate PascalByteString) SessionSecurityDiagnosticsDataTypeBuilder { + return b.WithSessionId(sessionId).WithClientUserIdOfSession(clientUserIdOfSession).WithClientUserIdHistory(clientUserIdHistory...).WithAuthenticationMechanism(authenticationMechanism).WithEncoding(encoding).WithTransportProtocol(transportProtocol).WithSecurityMode(securityMode).WithSecurityPolicyUri(securityPolicyUri).WithClientCertificate(clientCertificate) } func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithSessionId(sessionId NodeId) SessionSecurityDiagnosticsDataTypeBuilder { @@ -233,11 +227,6 @@ func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithClientUserIdOfSessionBu return b } -func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithNoOfClientUserIdHistory(noOfClientUserIdHistory int32) SessionSecurityDiagnosticsDataTypeBuilder { - b.NoOfClientUserIdHistory = noOfClientUserIdHistory - return b -} - func (b *_SessionSecurityDiagnosticsDataTypeBuilder) WithClientUserIdHistory(clientUserIdHistory ...PascalString) SessionSecurityDiagnosticsDataTypeBuilder { b.ClientUserIdHistory = clientUserIdHistory return b @@ -430,8 +419,8 @@ func (b *_SessionSecurityDiagnosticsDataType) CreateSessionSecurityDiagnosticsDa /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SessionSecurityDiagnosticsDataType) GetIdentifier() string { - return "870" +func (m *_SessionSecurityDiagnosticsDataType) GetExtensionId() int32 { + return int32(870) } /////////////////////// @@ -456,10 +445,6 @@ func (m *_SessionSecurityDiagnosticsDataType) GetClientUserIdOfSession() PascalS return m.ClientUserIdOfSession } -func (m *_SessionSecurityDiagnosticsDataType) GetNoOfClientUserIdHistory() int32 { - return m.NoOfClientUserIdHistory -} - func (m *_SessionSecurityDiagnosticsDataType) GetClientUserIdHistory() []PascalString { return m.ClientUserIdHistory } @@ -517,7 +502,7 @@ func (m *_SessionSecurityDiagnosticsDataType) GetLengthInBits(ctx context.Contex // Simple field (clientUserIdOfSession) lengthInBits += m.ClientUserIdOfSession.GetLengthInBits(ctx) - // Simple field (noOfClientUserIdHistory) + // Implicit Field (noOfClientUserIdHistory) lengthInBits += 32 // Array field @@ -555,7 +540,7 @@ func (m *_SessionSecurityDiagnosticsDataType) GetLengthInBytes(ctx context.Conte return m.GetLengthInBits(ctx) / 8 } -func (m *_SessionSecurityDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__sessionSecurityDiagnosticsDataType SessionSecurityDiagnosticsDataType, err error) { +func (m *_SessionSecurityDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__sessionSecurityDiagnosticsDataType SessionSecurityDiagnosticsDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -578,11 +563,11 @@ func (m *_SessionSecurityDiagnosticsDataType) parse(ctx context.Context, readBuf } m.ClientUserIdOfSession = clientUserIdOfSession - noOfClientUserIdHistory, err := ReadSimpleField(ctx, "noOfClientUserIdHistory", ReadSignedInt(readBuffer, uint8(32))) + noOfClientUserIdHistory, err := ReadImplicitField[int32](ctx, "noOfClientUserIdHistory", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfClientUserIdHistory' field")) } - m.NoOfClientUserIdHistory = noOfClientUserIdHistory + _ = noOfClientUserIdHistory clientUserIdHistory, err := ReadCountArrayField[PascalString](ctx, "clientUserIdHistory", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfClientUserIdHistory)) if err != nil { @@ -658,8 +643,8 @@ func (m *_SessionSecurityDiagnosticsDataType) SerializeWithWriteBuffer(ctx conte if err := WriteSimpleField[PascalString](ctx, "clientUserIdOfSession", m.GetClientUserIdOfSession(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'clientUserIdOfSession' field") } - - if err := WriteSimpleField[int32](ctx, "noOfClientUserIdHistory", m.GetNoOfClientUserIdHistory(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfClientUserIdHistory := int32(utils.InlineIf(bool((m.GetClientUserIdHistory()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetClientUserIdHistory()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfClientUserIdHistory", noOfClientUserIdHistory, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfClientUserIdHistory' field") } @@ -713,7 +698,6 @@ func (m *_SessionSecurityDiagnosticsDataType) deepCopy() *_SessionSecurityDiagno m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.SessionId.DeepCopy().(NodeId), m.ClientUserIdOfSession.DeepCopy().(PascalString), - m.NoOfClientUserIdHistory, utils.DeepCopySlice[PascalString, PascalString](m.ClientUserIdHistory), m.AuthenticationMechanism.DeepCopy().(PascalString), m.Encoding.DeepCopy().(PascalString), diff --git a/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeRequestType.go b/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeRequestType.go index a2f6edd9b75..0cef090be56 100644 --- a/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeRequestType.go +++ b/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeRequestType.go @@ -42,16 +42,10 @@ type SessionlessInvokeRequestType interface { ExtensionObjectDefinition // GetUrisVersion returns UrisVersion (property field) GetUrisVersion() uint32 - // GetNoOfNamespaceUris returns NoOfNamespaceUris (property field) - GetNoOfNamespaceUris() int32 // GetNamespaceUris returns NamespaceUris (property field) GetNamespaceUris() []PascalString - // GetNoOfServerUris returns NoOfServerUris (property field) - GetNoOfServerUris() int32 // GetServerUris returns ServerUris (property field) GetServerUris() []PascalString - // GetNoOfLocaleIds returns NoOfLocaleIds (property field) - GetNoOfLocaleIds() int32 // GetLocaleIds returns LocaleIds (property field) GetLocaleIds() []PascalString // GetServiceId returns ServiceId (property field) @@ -65,29 +59,23 @@ type SessionlessInvokeRequestType interface { // _SessionlessInvokeRequestType is the data-structure of this message type _SessionlessInvokeRequestType struct { ExtensionObjectDefinitionContract - UrisVersion uint32 - NoOfNamespaceUris int32 - NamespaceUris []PascalString - NoOfServerUris int32 - ServerUris []PascalString - NoOfLocaleIds int32 - LocaleIds []PascalString - ServiceId uint32 + UrisVersion uint32 + NamespaceUris []PascalString + ServerUris []PascalString + LocaleIds []PascalString + ServiceId uint32 } var _ SessionlessInvokeRequestType = (*_SessionlessInvokeRequestType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SessionlessInvokeRequestType)(nil) // NewSessionlessInvokeRequestType factory function for _SessionlessInvokeRequestType -func NewSessionlessInvokeRequestType(urisVersion uint32, noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, noOfLocaleIds int32, localeIds []PascalString, serviceId uint32) *_SessionlessInvokeRequestType { +func NewSessionlessInvokeRequestType(urisVersion uint32, namespaceUris []PascalString, serverUris []PascalString, localeIds []PascalString, serviceId uint32) *_SessionlessInvokeRequestType { _result := &_SessionlessInvokeRequestType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), UrisVersion: urisVersion, - NoOfNamespaceUris: noOfNamespaceUris, NamespaceUris: namespaceUris, - NoOfServerUris: noOfServerUris, ServerUris: serverUris, - NoOfLocaleIds: noOfLocaleIds, LocaleIds: localeIds, ServiceId: serviceId, } @@ -104,19 +92,13 @@ func NewSessionlessInvokeRequestType(urisVersion uint32, noOfNamespaceUris int32 type SessionlessInvokeRequestTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(urisVersion uint32, noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, noOfLocaleIds int32, localeIds []PascalString, serviceId uint32) SessionlessInvokeRequestTypeBuilder + WithMandatoryFields(urisVersion uint32, namespaceUris []PascalString, serverUris []PascalString, localeIds []PascalString, serviceId uint32) SessionlessInvokeRequestTypeBuilder // WithUrisVersion adds UrisVersion (property field) WithUrisVersion(uint32) SessionlessInvokeRequestTypeBuilder - // WithNoOfNamespaceUris adds NoOfNamespaceUris (property field) - WithNoOfNamespaceUris(int32) SessionlessInvokeRequestTypeBuilder // WithNamespaceUris adds NamespaceUris (property field) WithNamespaceUris(...PascalString) SessionlessInvokeRequestTypeBuilder - // WithNoOfServerUris adds NoOfServerUris (property field) - WithNoOfServerUris(int32) SessionlessInvokeRequestTypeBuilder // WithServerUris adds ServerUris (property field) WithServerUris(...PascalString) SessionlessInvokeRequestTypeBuilder - // WithNoOfLocaleIds adds NoOfLocaleIds (property field) - WithNoOfLocaleIds(int32) SessionlessInvokeRequestTypeBuilder // WithLocaleIds adds LocaleIds (property field) WithLocaleIds(...PascalString) SessionlessInvokeRequestTypeBuilder // WithServiceId adds ServiceId (property field) @@ -146,8 +128,8 @@ func (b *_SessionlessInvokeRequestTypeBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_SessionlessInvokeRequestTypeBuilder) WithMandatoryFields(urisVersion uint32, noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, noOfLocaleIds int32, localeIds []PascalString, serviceId uint32) SessionlessInvokeRequestTypeBuilder { - return b.WithUrisVersion(urisVersion).WithNoOfNamespaceUris(noOfNamespaceUris).WithNamespaceUris(namespaceUris...).WithNoOfServerUris(noOfServerUris).WithServerUris(serverUris...).WithNoOfLocaleIds(noOfLocaleIds).WithLocaleIds(localeIds...).WithServiceId(serviceId) +func (b *_SessionlessInvokeRequestTypeBuilder) WithMandatoryFields(urisVersion uint32, namespaceUris []PascalString, serverUris []PascalString, localeIds []PascalString, serviceId uint32) SessionlessInvokeRequestTypeBuilder { + return b.WithUrisVersion(urisVersion).WithNamespaceUris(namespaceUris...).WithServerUris(serverUris...).WithLocaleIds(localeIds...).WithServiceId(serviceId) } func (b *_SessionlessInvokeRequestTypeBuilder) WithUrisVersion(urisVersion uint32) SessionlessInvokeRequestTypeBuilder { @@ -155,31 +137,16 @@ func (b *_SessionlessInvokeRequestTypeBuilder) WithUrisVersion(urisVersion uint3 return b } -func (b *_SessionlessInvokeRequestTypeBuilder) WithNoOfNamespaceUris(noOfNamespaceUris int32) SessionlessInvokeRequestTypeBuilder { - b.NoOfNamespaceUris = noOfNamespaceUris - return b -} - func (b *_SessionlessInvokeRequestTypeBuilder) WithNamespaceUris(namespaceUris ...PascalString) SessionlessInvokeRequestTypeBuilder { b.NamespaceUris = namespaceUris return b } -func (b *_SessionlessInvokeRequestTypeBuilder) WithNoOfServerUris(noOfServerUris int32) SessionlessInvokeRequestTypeBuilder { - b.NoOfServerUris = noOfServerUris - return b -} - func (b *_SessionlessInvokeRequestTypeBuilder) WithServerUris(serverUris ...PascalString) SessionlessInvokeRequestTypeBuilder { b.ServerUris = serverUris return b } -func (b *_SessionlessInvokeRequestTypeBuilder) WithNoOfLocaleIds(noOfLocaleIds int32) SessionlessInvokeRequestTypeBuilder { - b.NoOfLocaleIds = noOfLocaleIds - return b -} - func (b *_SessionlessInvokeRequestTypeBuilder) WithLocaleIds(localeIds ...PascalString) SessionlessInvokeRequestTypeBuilder { b.LocaleIds = localeIds return b @@ -240,8 +207,8 @@ func (b *_SessionlessInvokeRequestType) CreateSessionlessInvokeRequestTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SessionlessInvokeRequestType) GetIdentifier() string { - return "15903" +func (m *_SessionlessInvokeRequestType) GetExtensionId() int32 { + return int32(15903) } /////////////////////// @@ -262,26 +229,14 @@ func (m *_SessionlessInvokeRequestType) GetUrisVersion() uint32 { return m.UrisVersion } -func (m *_SessionlessInvokeRequestType) GetNoOfNamespaceUris() int32 { - return m.NoOfNamespaceUris -} - func (m *_SessionlessInvokeRequestType) GetNamespaceUris() []PascalString { return m.NamespaceUris } -func (m *_SessionlessInvokeRequestType) GetNoOfServerUris() int32 { - return m.NoOfServerUris -} - func (m *_SessionlessInvokeRequestType) GetServerUris() []PascalString { return m.ServerUris } -func (m *_SessionlessInvokeRequestType) GetNoOfLocaleIds() int32 { - return m.NoOfLocaleIds -} - func (m *_SessionlessInvokeRequestType) GetLocaleIds() []PascalString { return m.LocaleIds } @@ -316,7 +271,7 @@ func (m *_SessionlessInvokeRequestType) GetLengthInBits(ctx context.Context) uin // Simple field (urisVersion) lengthInBits += 32 - // Simple field (noOfNamespaceUris) + // Implicit Field (noOfNamespaceUris) lengthInBits += 32 // Array field @@ -329,7 +284,7 @@ func (m *_SessionlessInvokeRequestType) GetLengthInBits(ctx context.Context) uin } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32 // Array field @@ -342,7 +297,7 @@ func (m *_SessionlessInvokeRequestType) GetLengthInBits(ctx context.Context) uin } } - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32 // Array field @@ -365,7 +320,7 @@ func (m *_SessionlessInvokeRequestType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_SessionlessInvokeRequestType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__sessionlessInvokeRequestType SessionlessInvokeRequestType, err error) { +func (m *_SessionlessInvokeRequestType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__sessionlessInvokeRequestType SessionlessInvokeRequestType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -382,11 +337,11 @@ func (m *_SessionlessInvokeRequestType) parse(ctx context.Context, readBuffer ut } m.UrisVersion = urisVersion - noOfNamespaceUris, err := ReadSimpleField(ctx, "noOfNamespaceUris", ReadSignedInt(readBuffer, uint8(32))) + noOfNamespaceUris, err := ReadImplicitField[int32](ctx, "noOfNamespaceUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNamespaceUris' field")) } - m.NoOfNamespaceUris = noOfNamespaceUris + _ = noOfNamespaceUris namespaceUris, err := ReadCountArrayField[PascalString](ctx, "namespaceUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfNamespaceUris)) if err != nil { @@ -394,11 +349,11 @@ func (m *_SessionlessInvokeRequestType) parse(ctx context.Context, readBuffer ut } m.NamespaceUris = namespaceUris - noOfServerUris, err := ReadSimpleField(ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) + noOfServerUris, err := ReadImplicitField[int32](ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerUris' field")) } - m.NoOfServerUris = noOfServerUris + _ = noOfServerUris serverUris, err := ReadCountArrayField[PascalString](ctx, "serverUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerUris)) if err != nil { @@ -406,11 +361,11 @@ func (m *_SessionlessInvokeRequestType) parse(ctx context.Context, readBuffer ut } m.ServerUris = serverUris - noOfLocaleIds, err := ReadSimpleField(ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) } - m.NoOfLocaleIds = noOfLocaleIds + _ = noOfLocaleIds localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) if err != nil { @@ -452,24 +407,24 @@ func (m *_SessionlessInvokeRequestType) SerializeWithWriteBuffer(ctx context.Con if err := WriteSimpleField[uint32](ctx, "urisVersion", m.GetUrisVersion(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'urisVersion' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNamespaceUris", m.GetNoOfNamespaceUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNamespaceUris := int32(utils.InlineIf(bool((m.GetNamespaceUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNamespaceUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNamespaceUris", noOfNamespaceUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNamespaceUris' field") } if err := WriteComplexTypeArrayField(ctx, "namespaceUris", m.GetNamespaceUris(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'namespaceUris' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerUris", m.GetNoOfServerUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerUris := int32(utils.InlineIf(bool((m.GetServerUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerUris", noOfServerUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerUris' field") } if err := WriteComplexTypeArrayField(ctx, "serverUris", m.GetServerUris(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'serverUris' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLocaleIds", m.GetNoOfLocaleIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") } @@ -502,11 +457,8 @@ func (m *_SessionlessInvokeRequestType) deepCopy() *_SessionlessInvokeRequestTyp _SessionlessInvokeRequestTypeCopy := &_SessionlessInvokeRequestType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.UrisVersion, - m.NoOfNamespaceUris, utils.DeepCopySlice[PascalString, PascalString](m.NamespaceUris), - m.NoOfServerUris, utils.DeepCopySlice[PascalString, PascalString](m.ServerUris), - m.NoOfLocaleIds, utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), m.ServiceId, } diff --git a/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeResponseType.go b/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeResponseType.go index 00dcc9dd261..25e1a9f3ada 100644 --- a/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeResponseType.go +++ b/plc4go/protocols/opcua/readwrite/model/SessionlessInvokeResponseType.go @@ -40,12 +40,8 @@ type SessionlessInvokeResponseType interface { utils.Serializable utils.Copyable ExtensionObjectDefinition - // GetNoOfNamespaceUris returns NoOfNamespaceUris (property field) - GetNoOfNamespaceUris() int32 // GetNamespaceUris returns NamespaceUris (property field) GetNamespaceUris() []PascalString - // GetNoOfServerUris returns NoOfServerUris (property field) - GetNoOfServerUris() int32 // GetServerUris returns ServerUris (property field) GetServerUris() []PascalString // GetServiceId returns ServiceId (property field) @@ -59,23 +55,19 @@ type SessionlessInvokeResponseType interface { // _SessionlessInvokeResponseType is the data-structure of this message type _SessionlessInvokeResponseType struct { ExtensionObjectDefinitionContract - NoOfNamespaceUris int32 - NamespaceUris []PascalString - NoOfServerUris int32 - ServerUris []PascalString - ServiceId uint32 + NamespaceUris []PascalString + ServerUris []PascalString + ServiceId uint32 } var _ SessionlessInvokeResponseType = (*_SessionlessInvokeResponseType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SessionlessInvokeResponseType)(nil) // NewSessionlessInvokeResponseType factory function for _SessionlessInvokeResponseType -func NewSessionlessInvokeResponseType(noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, serviceId uint32) *_SessionlessInvokeResponseType { +func NewSessionlessInvokeResponseType(namespaceUris []PascalString, serverUris []PascalString, serviceId uint32) *_SessionlessInvokeResponseType { _result := &_SessionlessInvokeResponseType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), - NoOfNamespaceUris: noOfNamespaceUris, NamespaceUris: namespaceUris, - NoOfServerUris: noOfServerUris, ServerUris: serverUris, ServiceId: serviceId, } @@ -92,13 +84,9 @@ func NewSessionlessInvokeResponseType(noOfNamespaceUris int32, namespaceUris []P type SessionlessInvokeResponseTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, serviceId uint32) SessionlessInvokeResponseTypeBuilder - // WithNoOfNamespaceUris adds NoOfNamespaceUris (property field) - WithNoOfNamespaceUris(int32) SessionlessInvokeResponseTypeBuilder + WithMandatoryFields(namespaceUris []PascalString, serverUris []PascalString, serviceId uint32) SessionlessInvokeResponseTypeBuilder // WithNamespaceUris adds NamespaceUris (property field) WithNamespaceUris(...PascalString) SessionlessInvokeResponseTypeBuilder - // WithNoOfServerUris adds NoOfServerUris (property field) - WithNoOfServerUris(int32) SessionlessInvokeResponseTypeBuilder // WithServerUris adds ServerUris (property field) WithServerUris(...PascalString) SessionlessInvokeResponseTypeBuilder // WithServiceId adds ServiceId (property field) @@ -128,13 +116,8 @@ func (b *_SessionlessInvokeResponseTypeBuilder) setParent(contract ExtensionObje b.ExtensionObjectDefinitionContract = contract } -func (b *_SessionlessInvokeResponseTypeBuilder) WithMandatoryFields(noOfNamespaceUris int32, namespaceUris []PascalString, noOfServerUris int32, serverUris []PascalString, serviceId uint32) SessionlessInvokeResponseTypeBuilder { - return b.WithNoOfNamespaceUris(noOfNamespaceUris).WithNamespaceUris(namespaceUris...).WithNoOfServerUris(noOfServerUris).WithServerUris(serverUris...).WithServiceId(serviceId) -} - -func (b *_SessionlessInvokeResponseTypeBuilder) WithNoOfNamespaceUris(noOfNamespaceUris int32) SessionlessInvokeResponseTypeBuilder { - b.NoOfNamespaceUris = noOfNamespaceUris - return b +func (b *_SessionlessInvokeResponseTypeBuilder) WithMandatoryFields(namespaceUris []PascalString, serverUris []PascalString, serviceId uint32) SessionlessInvokeResponseTypeBuilder { + return b.WithNamespaceUris(namespaceUris...).WithServerUris(serverUris...).WithServiceId(serviceId) } func (b *_SessionlessInvokeResponseTypeBuilder) WithNamespaceUris(namespaceUris ...PascalString) SessionlessInvokeResponseTypeBuilder { @@ -142,11 +125,6 @@ func (b *_SessionlessInvokeResponseTypeBuilder) WithNamespaceUris(namespaceUris return b } -func (b *_SessionlessInvokeResponseTypeBuilder) WithNoOfServerUris(noOfServerUris int32) SessionlessInvokeResponseTypeBuilder { - b.NoOfServerUris = noOfServerUris - return b -} - func (b *_SessionlessInvokeResponseTypeBuilder) WithServerUris(serverUris ...PascalString) SessionlessInvokeResponseTypeBuilder { b.ServerUris = serverUris return b @@ -207,8 +185,8 @@ func (b *_SessionlessInvokeResponseType) CreateSessionlessInvokeResponseTypeBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SessionlessInvokeResponseType) GetIdentifier() string { - return "21001" +func (m *_SessionlessInvokeResponseType) GetExtensionId() int32 { + return int32(21001) } /////////////////////// @@ -225,18 +203,10 @@ func (m *_SessionlessInvokeResponseType) GetParent() ExtensionObjectDefinitionCo /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SessionlessInvokeResponseType) GetNoOfNamespaceUris() int32 { - return m.NoOfNamespaceUris -} - func (m *_SessionlessInvokeResponseType) GetNamespaceUris() []PascalString { return m.NamespaceUris } -func (m *_SessionlessInvokeResponseType) GetNoOfServerUris() int32 { - return m.NoOfServerUris -} - func (m *_SessionlessInvokeResponseType) GetServerUris() []PascalString { return m.ServerUris } @@ -268,7 +238,7 @@ func (m *_SessionlessInvokeResponseType) GetTypeName() string { func (m *_SessionlessInvokeResponseType) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Simple field (noOfNamespaceUris) + // Implicit Field (noOfNamespaceUris) lengthInBits += 32 // Array field @@ -281,7 +251,7 @@ func (m *_SessionlessInvokeResponseType) GetLengthInBits(ctx context.Context) ui } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32 // Array field @@ -304,7 +274,7 @@ func (m *_SessionlessInvokeResponseType) GetLengthInBytes(ctx context.Context) u return m.GetLengthInBits(ctx) / 8 } -func (m *_SessionlessInvokeResponseType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__sessionlessInvokeResponseType SessionlessInvokeResponseType, err error) { +func (m *_SessionlessInvokeResponseType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__sessionlessInvokeResponseType SessionlessInvokeResponseType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -315,11 +285,11 @@ func (m *_SessionlessInvokeResponseType) parse(ctx context.Context, readBuffer u currentPos := positionAware.GetPos() _ = currentPos - noOfNamespaceUris, err := ReadSimpleField(ctx, "noOfNamespaceUris", ReadSignedInt(readBuffer, uint8(32))) + noOfNamespaceUris, err := ReadImplicitField[int32](ctx, "noOfNamespaceUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNamespaceUris' field")) } - m.NoOfNamespaceUris = noOfNamespaceUris + _ = noOfNamespaceUris namespaceUris, err := ReadCountArrayField[PascalString](ctx, "namespaceUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfNamespaceUris)) if err != nil { @@ -327,11 +297,11 @@ func (m *_SessionlessInvokeResponseType) parse(ctx context.Context, readBuffer u } m.NamespaceUris = namespaceUris - noOfServerUris, err := ReadSimpleField(ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) + noOfServerUris, err := ReadImplicitField[int32](ctx, "noOfServerUris", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfServerUris' field")) } - m.NoOfServerUris = noOfServerUris + _ = noOfServerUris serverUris, err := ReadCountArrayField[PascalString](ctx, "serverUris", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfServerUris)) if err != nil { @@ -369,16 +339,16 @@ func (m *_SessionlessInvokeResponseType) SerializeWithWriteBuffer(ctx context.Co if pushErr := writeBuffer.PushContext("SessionlessInvokeResponseType"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for SessionlessInvokeResponseType") } - - if err := WriteSimpleField[int32](ctx, "noOfNamespaceUris", m.GetNoOfNamespaceUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNamespaceUris := int32(utils.InlineIf(bool((m.GetNamespaceUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNamespaceUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNamespaceUris", noOfNamespaceUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNamespaceUris' field") } if err := WriteComplexTypeArrayField(ctx, "namespaceUris", m.GetNamespaceUris(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'namespaceUris' field") } - - if err := WriteSimpleField[int32](ctx, "noOfServerUris", m.GetNoOfServerUris(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfServerUris := int32(utils.InlineIf(bool((m.GetServerUris()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetServerUris()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfServerUris", noOfServerUris, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfServerUris' field") } @@ -410,9 +380,7 @@ func (m *_SessionlessInvokeResponseType) deepCopy() *_SessionlessInvokeResponseT } _SessionlessInvokeResponseTypeCopy := &_SessionlessInvokeResponseType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.NoOfNamespaceUris, utils.DeepCopySlice[PascalString, PascalString](m.NamespaceUris), - m.NoOfServerUris, utils.DeepCopySlice[PascalString, PascalString](m.ServerUris), m.ServiceId, } diff --git a/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeRequest.go b/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeRequest.go index 2e0217513e5..480dde8e2a3 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeRequest.go @@ -41,13 +41,11 @@ type SetMonitoringModeRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetMonitoringMode returns MonitoringMode (property field) GetMonitoringMode() MonitoringMode - // GetNoOfMonitoredItemIds returns NoOfMonitoredItemIds (property field) - GetNoOfMonitoredItemIds() int32 // GetMonitoredItemIds returns MonitoredItemIds (property field) GetMonitoredItemIds() []uint32 // IsSetMonitoringModeRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +57,25 @@ type SetMonitoringModeRequest interface { // _SetMonitoringModeRequest is the data-structure of this message type _SetMonitoringModeRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - SubscriptionId uint32 - MonitoringMode MonitoringMode - NoOfMonitoredItemIds int32 - MonitoredItemIds []uint32 + RequestHeader RequestHeader + SubscriptionId uint32 + MonitoringMode MonitoringMode + MonitoredItemIds []uint32 } var _ SetMonitoringModeRequest = (*_SetMonitoringModeRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetMonitoringModeRequest)(nil) // NewSetMonitoringModeRequest factory function for _SetMonitoringModeRequest -func NewSetMonitoringModeRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, monitoringMode MonitoringMode, noOfMonitoredItemIds int32, monitoredItemIds []uint32) *_SetMonitoringModeRequest { +func NewSetMonitoringModeRequest(requestHeader RequestHeader, subscriptionId uint32, monitoringMode MonitoringMode, monitoredItemIds []uint32) *_SetMonitoringModeRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for SetMonitoringModeRequest must not be nil") + panic("requestHeader of type RequestHeader for SetMonitoringModeRequest must not be nil") } _result := &_SetMonitoringModeRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, SubscriptionId: subscriptionId, MonitoringMode: monitoringMode, - NoOfMonitoredItemIds: noOfMonitoredItemIds, MonitoredItemIds: monitoredItemIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +91,15 @@ func NewSetMonitoringModeRequest(requestHeader ExtensionObjectDefinition, subscr type SetMonitoringModeRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, monitoringMode MonitoringMode, noOfMonitoredItemIds int32, monitoredItemIds []uint32) SetMonitoringModeRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, monitoringMode MonitoringMode, monitoredItemIds []uint32) SetMonitoringModeRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) SetMonitoringModeRequestBuilder + WithRequestHeader(RequestHeader) SetMonitoringModeRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetMonitoringModeRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) SetMonitoringModeRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) SetMonitoringModeRequestBuilder // WithMonitoringMode adds MonitoringMode (property field) WithMonitoringMode(MonitoringMode) SetMonitoringModeRequestBuilder - // WithNoOfMonitoredItemIds adds NoOfMonitoredItemIds (property field) - WithNoOfMonitoredItemIds(int32) SetMonitoringModeRequestBuilder // WithMonitoredItemIds adds MonitoredItemIds (property field) WithMonitoredItemIds(...uint32) SetMonitoringModeRequestBuilder // Build builds the SetMonitoringModeRequest or returns an error if something is wrong @@ -133,24 +127,24 @@ func (b *_SetMonitoringModeRequestBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_SetMonitoringModeRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, monitoringMode MonitoringMode, noOfMonitoredItemIds int32, monitoredItemIds []uint32) SetMonitoringModeRequestBuilder { - return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithMonitoringMode(monitoringMode).WithNoOfMonitoredItemIds(noOfMonitoredItemIds).WithMonitoredItemIds(monitoredItemIds...) +func (b *_SetMonitoringModeRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, monitoringMode MonitoringMode, monitoredItemIds []uint32) SetMonitoringModeRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithMonitoringMode(monitoringMode).WithMonitoredItemIds(monitoredItemIds...) } -func (b *_SetMonitoringModeRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) SetMonitoringModeRequestBuilder { +func (b *_SetMonitoringModeRequestBuilder) WithRequestHeader(requestHeader RequestHeader) SetMonitoringModeRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_SetMonitoringModeRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetMonitoringModeRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetMonitoringModeRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) SetMonitoringModeRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -165,11 +159,6 @@ func (b *_SetMonitoringModeRequestBuilder) WithMonitoringMode(monitoringMode Mon return b } -func (b *_SetMonitoringModeRequestBuilder) WithNoOfMonitoredItemIds(noOfMonitoredItemIds int32) SetMonitoringModeRequestBuilder { - b.NoOfMonitoredItemIds = noOfMonitoredItemIds - return b -} - func (b *_SetMonitoringModeRequestBuilder) WithMonitoredItemIds(monitoredItemIds ...uint32) SetMonitoringModeRequestBuilder { b.MonitoredItemIds = monitoredItemIds return b @@ -231,8 +220,8 @@ func (b *_SetMonitoringModeRequest) CreateSetMonitoringModeRequestBuilder() SetM /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetMonitoringModeRequest) GetIdentifier() string { - return "769" +func (m *_SetMonitoringModeRequest) GetExtensionId() int32 { + return int32(769) } /////////////////////// @@ -249,7 +238,7 @@ func (m *_SetMonitoringModeRequest) GetParent() ExtensionObjectDefinitionContrac /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetMonitoringModeRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_SetMonitoringModeRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -261,10 +250,6 @@ func (m *_SetMonitoringModeRequest) GetMonitoringMode() MonitoringMode { return m.MonitoringMode } -func (m *_SetMonitoringModeRequest) GetNoOfMonitoredItemIds() int32 { - return m.NoOfMonitoredItemIds -} - func (m *_SetMonitoringModeRequest) GetMonitoredItemIds() []uint32 { return m.MonitoredItemIds } @@ -301,7 +286,7 @@ func (m *_SetMonitoringModeRequest) GetLengthInBits(ctx context.Context) uint16 // Simple field (monitoringMode) lengthInBits += 32 - // Simple field (noOfMonitoredItemIds) + // Implicit Field (noOfMonitoredItemIds) lengthInBits += 32 // Array field @@ -316,7 +301,7 @@ func (m *_SetMonitoringModeRequest) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_SetMonitoringModeRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setMonitoringModeRequest SetMonitoringModeRequest, err error) { +func (m *_SetMonitoringModeRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setMonitoringModeRequest SetMonitoringModeRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -327,7 +312,7 @@ func (m *_SetMonitoringModeRequest) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -345,11 +330,11 @@ func (m *_SetMonitoringModeRequest) parse(ctx context.Context, readBuffer utils. } m.MonitoringMode = monitoringMode - noOfMonitoredItemIds, err := ReadSimpleField(ctx, "noOfMonitoredItemIds", ReadSignedInt(readBuffer, uint8(32))) + noOfMonitoredItemIds, err := ReadImplicitField[int32](ctx, "noOfMonitoredItemIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfMonitoredItemIds' field")) } - m.NoOfMonitoredItemIds = noOfMonitoredItemIds + _ = noOfMonitoredItemIds monitoredItemIds, err := ReadCountArrayField[uint32](ctx, "monitoredItemIds", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfMonitoredItemIds)) if err != nil { @@ -382,7 +367,7 @@ func (m *_SetMonitoringModeRequest) SerializeWithWriteBuffer(ctx context.Context return errors.Wrap(pushErr, "Error pushing for SetMonitoringModeRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -393,8 +378,8 @@ func (m *_SetMonitoringModeRequest) SerializeWithWriteBuffer(ctx context.Context if err := WriteSimpleEnumField[MonitoringMode](ctx, "monitoringMode", "MonitoringMode", m.GetMonitoringMode(), WriteEnum[MonitoringMode, uint32](MonitoringMode.GetValue, MonitoringMode.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { return errors.Wrap(err, "Error serializing 'monitoringMode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfMonitoredItemIds", m.GetNoOfMonitoredItemIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfMonitoredItemIds := int32(utils.InlineIf(bool((m.GetMonitoredItemIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetMonitoredItemIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfMonitoredItemIds", noOfMonitoredItemIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfMonitoredItemIds' field") } @@ -422,10 +407,9 @@ func (m *_SetMonitoringModeRequest) deepCopy() *_SetMonitoringModeRequest { } _SetMonitoringModeRequestCopy := &_SetMonitoringModeRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.MonitoringMode, - m.NoOfMonitoredItemIds, utils.DeepCopySlice[uint32, uint32](m.MonitoredItemIds), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeResponse.go b/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeResponse.go index 5ddbc0c9447..1a496c5cb5b 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/SetMonitoringModeResponse.go @@ -41,13 +41,9 @@ type SetMonitoringModeResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsSetMonitoringModeResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type SetMonitoringModeResponse interface { // _SetMonitoringModeResponse is the data-structure of this message type _SetMonitoringModeResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ SetMonitoringModeResponse = (*_SetMonitoringModeResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetMonitoringModeResponse)(nil) // NewSetMonitoringModeResponse factory function for _SetMonitoringModeResponse -func NewSetMonitoringModeResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_SetMonitoringModeResponse { +func NewSetMonitoringModeResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_SetMonitoringModeResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for SetMonitoringModeResponse must not be nil") + panic("responseHeader of type ResponseHeader for SetMonitoringModeResponse must not be nil") } _result := &_SetMonitoringModeResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewSetMonitoringModeResponse(responseHeader ExtensionObjectDefinition, noOf type SetMonitoringModeResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) SetMonitoringModeResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) SetMonitoringModeResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) SetMonitoringModeResponseBuilder + WithResponseHeader(ResponseHeader) SetMonitoringModeResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetMonitoringModeResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) SetMonitoringModeResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetMonitoringModeResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) SetMonitoringModeResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) SetMonitoringModeResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) SetMonitoringModeResponseBuilder // Build builds the SetMonitoringModeResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_SetMonitoringModeResponseBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_SetMonitoringModeResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) SetMonitoringModeResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_SetMonitoringModeResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) SetMonitoringModeResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_SetMonitoringModeResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) SetMonitoringModeResponseBuilder { +func (b *_SetMonitoringModeResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) SetMonitoringModeResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_SetMonitoringModeResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetMonitoringModeResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetMonitoringModeResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetMonitoringModeResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_SetMonitoringModeResponseBuilder) WithNoOfResults(noOfResults int32) SetMonitoringModeResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_SetMonitoringModeResponseBuilder) WithResults(results ...StatusCode) SetMonitoringModeResponseBuilder { b.Results = results return b } -func (b *_SetMonitoringModeResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) SetMonitoringModeResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_SetMonitoringModeResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) SetMonitoringModeResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_SetMonitoringModeResponse) CreateSetMonitoringModeResponseBuilder() Se /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetMonitoringModeResponse) GetIdentifier() string { - return "772" +func (m *_SetMonitoringModeResponse) GetExtensionId() int32 { + return int32(772) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_SetMonitoringModeResponse) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetMonitoringModeResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_SetMonitoringModeResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_SetMonitoringModeResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_SetMonitoringModeResponse) GetResults() []StatusCode { return m.Results } -func (m *_SetMonitoringModeResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_SetMonitoringModeResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_SetMonitoringModeResponse) GetLengthInBits(ctx context.Context) uint16 // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_SetMonitoringModeResponse) GetLengthInBits(ctx context.Context) uint16 } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_SetMonitoringModeResponse) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_SetMonitoringModeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setMonitoringModeResponse SetMonitoringModeResponse, err error) { +func (m *_SetMonitoringModeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setMonitoringModeResponse SetMonitoringModeResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_SetMonitoringModeResponse) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_SetMonitoringModeResponse) parse(ctx context.Context, readBuffer utils } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_SetMonitoringModeResponse) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for SetMonitoringModeResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_SetMonitoringModeResponse) deepCopy() *_SetMonitoringModeResponse { } _SetMonitoringModeResponseCopy := &_SetMonitoringModeResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/SetPublishingModeRequest.go b/plc4go/protocols/opcua/readwrite/model/SetPublishingModeRequest.go index 16d01fd0617..f27ade45c74 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetPublishingModeRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/SetPublishingModeRequest.go @@ -41,11 +41,9 @@ type SetPublishingModeRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetPublishingEnabled returns PublishingEnabled (property field) GetPublishingEnabled() bool - // GetNoOfSubscriptionIds returns NoOfSubscriptionIds (property field) - GetNoOfSubscriptionIds() int32 // GetSubscriptionIds returns SubscriptionIds (property field) GetSubscriptionIds() []uint32 // IsSetPublishingModeRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -57,10 +55,9 @@ type SetPublishingModeRequest interface { // _SetPublishingModeRequest is the data-structure of this message type _SetPublishingModeRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - PublishingEnabled bool - NoOfSubscriptionIds int32 - SubscriptionIds []uint32 + RequestHeader RequestHeader + PublishingEnabled bool + SubscriptionIds []uint32 // Reserved Fields reservedField0 *uint8 } @@ -69,15 +66,14 @@ var _ SetPublishingModeRequest = (*_SetPublishingModeRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetPublishingModeRequest)(nil) // NewSetPublishingModeRequest factory function for _SetPublishingModeRequest -func NewSetPublishingModeRequest(requestHeader ExtensionObjectDefinition, publishingEnabled bool, noOfSubscriptionIds int32, subscriptionIds []uint32) *_SetPublishingModeRequest { +func NewSetPublishingModeRequest(requestHeader RequestHeader, publishingEnabled bool, subscriptionIds []uint32) *_SetPublishingModeRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for SetPublishingModeRequest must not be nil") + panic("requestHeader of type RequestHeader for SetPublishingModeRequest must not be nil") } _result := &_SetPublishingModeRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, PublishingEnabled: publishingEnabled, - NoOfSubscriptionIds: noOfSubscriptionIds, SubscriptionIds: subscriptionIds, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -93,15 +89,13 @@ func NewSetPublishingModeRequest(requestHeader ExtensionObjectDefinition, publis type SetPublishingModeRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, publishingEnabled bool, noOfSubscriptionIds int32, subscriptionIds []uint32) SetPublishingModeRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, publishingEnabled bool, subscriptionIds []uint32) SetPublishingModeRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) SetPublishingModeRequestBuilder + WithRequestHeader(RequestHeader) SetPublishingModeRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetPublishingModeRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) SetPublishingModeRequestBuilder // WithPublishingEnabled adds PublishingEnabled (property field) WithPublishingEnabled(bool) SetPublishingModeRequestBuilder - // WithNoOfSubscriptionIds adds NoOfSubscriptionIds (property field) - WithNoOfSubscriptionIds(int32) SetPublishingModeRequestBuilder // WithSubscriptionIds adds SubscriptionIds (property field) WithSubscriptionIds(...uint32) SetPublishingModeRequestBuilder // Build builds the SetPublishingModeRequest or returns an error if something is wrong @@ -129,24 +123,24 @@ func (b *_SetPublishingModeRequestBuilder) setParent(contract ExtensionObjectDef b.ExtensionObjectDefinitionContract = contract } -func (b *_SetPublishingModeRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, publishingEnabled bool, noOfSubscriptionIds int32, subscriptionIds []uint32) SetPublishingModeRequestBuilder { - return b.WithRequestHeader(requestHeader).WithPublishingEnabled(publishingEnabled).WithNoOfSubscriptionIds(noOfSubscriptionIds).WithSubscriptionIds(subscriptionIds...) +func (b *_SetPublishingModeRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, publishingEnabled bool, subscriptionIds []uint32) SetPublishingModeRequestBuilder { + return b.WithRequestHeader(requestHeader).WithPublishingEnabled(publishingEnabled).WithSubscriptionIds(subscriptionIds...) } -func (b *_SetPublishingModeRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) SetPublishingModeRequestBuilder { +func (b *_SetPublishingModeRequestBuilder) WithRequestHeader(requestHeader RequestHeader) SetPublishingModeRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_SetPublishingModeRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetPublishingModeRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetPublishingModeRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) SetPublishingModeRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -156,11 +150,6 @@ func (b *_SetPublishingModeRequestBuilder) WithPublishingEnabled(publishingEnabl return b } -func (b *_SetPublishingModeRequestBuilder) WithNoOfSubscriptionIds(noOfSubscriptionIds int32) SetPublishingModeRequestBuilder { - b.NoOfSubscriptionIds = noOfSubscriptionIds - return b -} - func (b *_SetPublishingModeRequestBuilder) WithSubscriptionIds(subscriptionIds ...uint32) SetPublishingModeRequestBuilder { b.SubscriptionIds = subscriptionIds return b @@ -222,8 +211,8 @@ func (b *_SetPublishingModeRequest) CreateSetPublishingModeRequestBuilder() SetP /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetPublishingModeRequest) GetIdentifier() string { - return "799" +func (m *_SetPublishingModeRequest) GetExtensionId() int32 { + return int32(799) } /////////////////////// @@ -240,7 +229,7 @@ func (m *_SetPublishingModeRequest) GetParent() ExtensionObjectDefinitionContrac /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetPublishingModeRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_SetPublishingModeRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -248,10 +237,6 @@ func (m *_SetPublishingModeRequest) GetPublishingEnabled() bool { return m.PublishingEnabled } -func (m *_SetPublishingModeRequest) GetNoOfSubscriptionIds() int32 { - return m.NoOfSubscriptionIds -} - func (m *_SetPublishingModeRequest) GetSubscriptionIds() []uint32 { return m.SubscriptionIds } @@ -288,7 +273,7 @@ func (m *_SetPublishingModeRequest) GetLengthInBits(ctx context.Context) uint16 // Simple field (publishingEnabled) lengthInBits += 1 - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32 // Array field @@ -303,7 +288,7 @@ func (m *_SetPublishingModeRequest) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_SetPublishingModeRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setPublishingModeRequest SetPublishingModeRequest, err error) { +func (m *_SetPublishingModeRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setPublishingModeRequest SetPublishingModeRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -314,7 +299,7 @@ func (m *_SetPublishingModeRequest) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -332,11 +317,11 @@ func (m *_SetPublishingModeRequest) parse(ctx context.Context, readBuffer utils. } m.PublishingEnabled = publishingEnabled - noOfSubscriptionIds, err := ReadSimpleField(ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) + noOfSubscriptionIds, err := ReadImplicitField[int32](ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSubscriptionIds' field")) } - m.NoOfSubscriptionIds = noOfSubscriptionIds + _ = noOfSubscriptionIds subscriptionIds, err := ReadCountArrayField[uint32](ctx, "subscriptionIds", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfSubscriptionIds)) if err != nil { @@ -369,7 +354,7 @@ func (m *_SetPublishingModeRequest) SerializeWithWriteBuffer(ctx context.Context return errors.Wrap(pushErr, "Error pushing for SetPublishingModeRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -380,8 +365,8 @@ func (m *_SetPublishingModeRequest) SerializeWithWriteBuffer(ctx context.Context if err := WriteSimpleField[bool](ctx, "publishingEnabled", m.GetPublishingEnabled(), WriteBoolean(writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'publishingEnabled' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSubscriptionIds", m.GetNoOfSubscriptionIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSubscriptionIds := int32(utils.InlineIf(bool((m.GetSubscriptionIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSubscriptionIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSubscriptionIds", noOfSubscriptionIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSubscriptionIds' field") } @@ -409,9 +394,8 @@ func (m *_SetPublishingModeRequest) deepCopy() *_SetPublishingModeRequest { } _SetPublishingModeRequestCopy := &_SetPublishingModeRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.PublishingEnabled, - m.NoOfSubscriptionIds, utils.DeepCopySlice[uint32, uint32](m.SubscriptionIds), m.reservedField0, } diff --git a/plc4go/protocols/opcua/readwrite/model/SetPublishingModeResponse.go b/plc4go/protocols/opcua/readwrite/model/SetPublishingModeResponse.go index 579ec6c5c60..a84265abcf1 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetPublishingModeResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/SetPublishingModeResponse.go @@ -41,13 +41,9 @@ type SetPublishingModeResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsSetPublishingModeResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type SetPublishingModeResponse interface { // _SetPublishingModeResponse is the data-structure of this message type _SetPublishingModeResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ SetPublishingModeResponse = (*_SetPublishingModeResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetPublishingModeResponse)(nil) // NewSetPublishingModeResponse factory function for _SetPublishingModeResponse -func NewSetPublishingModeResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_SetPublishingModeResponse { +func NewSetPublishingModeResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_SetPublishingModeResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for SetPublishingModeResponse must not be nil") + panic("responseHeader of type ResponseHeader for SetPublishingModeResponse must not be nil") } _result := &_SetPublishingModeResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewSetPublishingModeResponse(responseHeader ExtensionObjectDefinition, noOf type SetPublishingModeResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) SetPublishingModeResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) SetPublishingModeResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) SetPublishingModeResponseBuilder + WithResponseHeader(ResponseHeader) SetPublishingModeResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetPublishingModeResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) SetPublishingModeResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetPublishingModeResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) SetPublishingModeResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) SetPublishingModeResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) SetPublishingModeResponseBuilder // Build builds the SetPublishingModeResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_SetPublishingModeResponseBuilder) setParent(contract ExtensionObjectDe b.ExtensionObjectDefinitionContract = contract } -func (b *_SetPublishingModeResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) SetPublishingModeResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_SetPublishingModeResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) SetPublishingModeResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_SetPublishingModeResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) SetPublishingModeResponseBuilder { +func (b *_SetPublishingModeResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) SetPublishingModeResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_SetPublishingModeResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetPublishingModeResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetPublishingModeResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetPublishingModeResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_SetPublishingModeResponseBuilder) WithNoOfResults(noOfResults int32) SetPublishingModeResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_SetPublishingModeResponseBuilder) WithResults(results ...StatusCode) SetPublishingModeResponseBuilder { b.Results = results return b } -func (b *_SetPublishingModeResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) SetPublishingModeResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_SetPublishingModeResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) SetPublishingModeResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_SetPublishingModeResponse) CreateSetPublishingModeResponseBuilder() Se /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetPublishingModeResponse) GetIdentifier() string { - return "802" +func (m *_SetPublishingModeResponse) GetExtensionId() int32 { + return int32(802) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_SetPublishingModeResponse) GetParent() ExtensionObjectDefinitionContra /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetPublishingModeResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_SetPublishingModeResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_SetPublishingModeResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_SetPublishingModeResponse) GetResults() []StatusCode { return m.Results } -func (m *_SetPublishingModeResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_SetPublishingModeResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_SetPublishingModeResponse) GetLengthInBits(ctx context.Context) uint16 // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_SetPublishingModeResponse) GetLengthInBits(ctx context.Context) uint16 } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_SetPublishingModeResponse) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_SetPublishingModeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setPublishingModeResponse SetPublishingModeResponse, err error) { +func (m *_SetPublishingModeResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setPublishingModeResponse SetPublishingModeResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_SetPublishingModeResponse) parse(ctx context.Context, readBuffer utils currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_SetPublishingModeResponse) parse(ctx context.Context, readBuffer utils } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_SetPublishingModeResponse) SerializeWithWriteBuffer(ctx context.Contex return errors.Wrap(pushErr, "Error pushing for SetPublishingModeResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_SetPublishingModeResponse) deepCopy() *_SetPublishingModeResponse { } _SetPublishingModeResponseCopy := &_SetPublishingModeResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/SetTriggeringRequest.go b/plc4go/protocols/opcua/readwrite/model/SetTriggeringRequest.go index e97374250ad..bef998f9af1 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetTriggeringRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/SetTriggeringRequest.go @@ -41,17 +41,13 @@ type SetTriggeringRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition + GetRequestHeader() RequestHeader // GetSubscriptionId returns SubscriptionId (property field) GetSubscriptionId() uint32 // GetTriggeringItemId returns TriggeringItemId (property field) GetTriggeringItemId() uint32 - // GetNoOfLinksToAdd returns NoOfLinksToAdd (property field) - GetNoOfLinksToAdd() int32 // GetLinksToAdd returns LinksToAdd (property field) GetLinksToAdd() []uint32 - // GetNoOfLinksToRemove returns NoOfLinksToRemove (property field) - GetNoOfLinksToRemove() int32 // GetLinksToRemove returns LinksToRemove (property field) GetLinksToRemove() []uint32 // IsSetTriggeringRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -63,31 +59,27 @@ type SetTriggeringRequest interface { // _SetTriggeringRequest is the data-structure of this message type _SetTriggeringRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - SubscriptionId uint32 - TriggeringItemId uint32 - NoOfLinksToAdd int32 - LinksToAdd []uint32 - NoOfLinksToRemove int32 - LinksToRemove []uint32 + RequestHeader RequestHeader + SubscriptionId uint32 + TriggeringItemId uint32 + LinksToAdd []uint32 + LinksToRemove []uint32 } var _ SetTriggeringRequest = (*_SetTriggeringRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetTriggeringRequest)(nil) // NewSetTriggeringRequest factory function for _SetTriggeringRequest -func NewSetTriggeringRequest(requestHeader ExtensionObjectDefinition, subscriptionId uint32, triggeringItemId uint32, noOfLinksToAdd int32, linksToAdd []uint32, noOfLinksToRemove int32, linksToRemove []uint32) *_SetTriggeringRequest { +func NewSetTriggeringRequest(requestHeader RequestHeader, subscriptionId uint32, triggeringItemId uint32, linksToAdd []uint32, linksToRemove []uint32) *_SetTriggeringRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for SetTriggeringRequest must not be nil") + panic("requestHeader of type RequestHeader for SetTriggeringRequest must not be nil") } _result := &_SetTriggeringRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, SubscriptionId: subscriptionId, TriggeringItemId: triggeringItemId, - NoOfLinksToAdd: noOfLinksToAdd, LinksToAdd: linksToAdd, - NoOfLinksToRemove: noOfLinksToRemove, LinksToRemove: linksToRemove, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -103,21 +95,17 @@ func NewSetTriggeringRequest(requestHeader ExtensionObjectDefinition, subscripti type SetTriggeringRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, triggeringItemId uint32, noOfLinksToAdd int32, linksToAdd []uint32, noOfLinksToRemove int32, linksToRemove []uint32) SetTriggeringRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, triggeringItemId uint32, linksToAdd []uint32, linksToRemove []uint32) SetTriggeringRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) SetTriggeringRequestBuilder + WithRequestHeader(RequestHeader) SetTriggeringRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetTriggeringRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) SetTriggeringRequestBuilder // WithSubscriptionId adds SubscriptionId (property field) WithSubscriptionId(uint32) SetTriggeringRequestBuilder // WithTriggeringItemId adds TriggeringItemId (property field) WithTriggeringItemId(uint32) SetTriggeringRequestBuilder - // WithNoOfLinksToAdd adds NoOfLinksToAdd (property field) - WithNoOfLinksToAdd(int32) SetTriggeringRequestBuilder // WithLinksToAdd adds LinksToAdd (property field) WithLinksToAdd(...uint32) SetTriggeringRequestBuilder - // WithNoOfLinksToRemove adds NoOfLinksToRemove (property field) - WithNoOfLinksToRemove(int32) SetTriggeringRequestBuilder // WithLinksToRemove adds LinksToRemove (property field) WithLinksToRemove(...uint32) SetTriggeringRequestBuilder // Build builds the SetTriggeringRequest or returns an error if something is wrong @@ -145,24 +133,24 @@ func (b *_SetTriggeringRequestBuilder) setParent(contract ExtensionObjectDefinit b.ExtensionObjectDefinitionContract = contract } -func (b *_SetTriggeringRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, subscriptionId uint32, triggeringItemId uint32, noOfLinksToAdd int32, linksToAdd []uint32, noOfLinksToRemove int32, linksToRemove []uint32) SetTriggeringRequestBuilder { - return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTriggeringItemId(triggeringItemId).WithNoOfLinksToAdd(noOfLinksToAdd).WithLinksToAdd(linksToAdd...).WithNoOfLinksToRemove(noOfLinksToRemove).WithLinksToRemove(linksToRemove...) +func (b *_SetTriggeringRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionId uint32, triggeringItemId uint32, linksToAdd []uint32, linksToRemove []uint32) SetTriggeringRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionId(subscriptionId).WithTriggeringItemId(triggeringItemId).WithLinksToAdd(linksToAdd...).WithLinksToRemove(linksToRemove...) } -func (b *_SetTriggeringRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) SetTriggeringRequestBuilder { +func (b *_SetTriggeringRequestBuilder) WithRequestHeader(requestHeader RequestHeader) SetTriggeringRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_SetTriggeringRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetTriggeringRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetTriggeringRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) SetTriggeringRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } @@ -177,21 +165,11 @@ func (b *_SetTriggeringRequestBuilder) WithTriggeringItemId(triggeringItemId uin return b } -func (b *_SetTriggeringRequestBuilder) WithNoOfLinksToAdd(noOfLinksToAdd int32) SetTriggeringRequestBuilder { - b.NoOfLinksToAdd = noOfLinksToAdd - return b -} - func (b *_SetTriggeringRequestBuilder) WithLinksToAdd(linksToAdd ...uint32) SetTriggeringRequestBuilder { b.LinksToAdd = linksToAdd return b } -func (b *_SetTriggeringRequestBuilder) WithNoOfLinksToRemove(noOfLinksToRemove int32) SetTriggeringRequestBuilder { - b.NoOfLinksToRemove = noOfLinksToRemove - return b -} - func (b *_SetTriggeringRequestBuilder) WithLinksToRemove(linksToRemove ...uint32) SetTriggeringRequestBuilder { b.LinksToRemove = linksToRemove return b @@ -253,8 +231,8 @@ func (b *_SetTriggeringRequest) CreateSetTriggeringRequestBuilder() SetTriggerin /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetTriggeringRequest) GetIdentifier() string { - return "775" +func (m *_SetTriggeringRequest) GetExtensionId() int32 { + return int32(775) } /////////////////////// @@ -271,7 +249,7 @@ func (m *_SetTriggeringRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetTriggeringRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_SetTriggeringRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } @@ -283,18 +261,10 @@ func (m *_SetTriggeringRequest) GetTriggeringItemId() uint32 { return m.TriggeringItemId } -func (m *_SetTriggeringRequest) GetNoOfLinksToAdd() int32 { - return m.NoOfLinksToAdd -} - func (m *_SetTriggeringRequest) GetLinksToAdd() []uint32 { return m.LinksToAdd } -func (m *_SetTriggeringRequest) GetNoOfLinksToRemove() int32 { - return m.NoOfLinksToRemove -} - func (m *_SetTriggeringRequest) GetLinksToRemove() []uint32 { return m.LinksToRemove } @@ -331,7 +301,7 @@ func (m *_SetTriggeringRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (triggeringItemId) lengthInBits += 32 - // Simple field (noOfLinksToAdd) + // Implicit Field (noOfLinksToAdd) lengthInBits += 32 // Array field @@ -339,7 +309,7 @@ func (m *_SetTriggeringRequest) GetLengthInBits(ctx context.Context) uint16 { lengthInBits += 32 * uint16(len(m.LinksToAdd)) } - // Simple field (noOfLinksToRemove) + // Implicit Field (noOfLinksToRemove) lengthInBits += 32 // Array field @@ -354,7 +324,7 @@ func (m *_SetTriggeringRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_SetTriggeringRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setTriggeringRequest SetTriggeringRequest, err error) { +func (m *_SetTriggeringRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setTriggeringRequest SetTriggeringRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -365,7 +335,7 @@ func (m *_SetTriggeringRequest) parse(ctx context.Context, readBuffer utils.Read currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } @@ -383,11 +353,11 @@ func (m *_SetTriggeringRequest) parse(ctx context.Context, readBuffer utils.Read } m.TriggeringItemId = triggeringItemId - noOfLinksToAdd, err := ReadSimpleField(ctx, "noOfLinksToAdd", ReadSignedInt(readBuffer, uint8(32))) + noOfLinksToAdd, err := ReadImplicitField[int32](ctx, "noOfLinksToAdd", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLinksToAdd' field")) } - m.NoOfLinksToAdd = noOfLinksToAdd + _ = noOfLinksToAdd linksToAdd, err := ReadCountArrayField[uint32](ctx, "linksToAdd", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfLinksToAdd)) if err != nil { @@ -395,11 +365,11 @@ func (m *_SetTriggeringRequest) parse(ctx context.Context, readBuffer utils.Read } m.LinksToAdd = linksToAdd - noOfLinksToRemove, err := ReadSimpleField(ctx, "noOfLinksToRemove", ReadSignedInt(readBuffer, uint8(32))) + noOfLinksToRemove, err := ReadImplicitField[int32](ctx, "noOfLinksToRemove", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLinksToRemove' field")) } - m.NoOfLinksToRemove = noOfLinksToRemove + _ = noOfLinksToRemove linksToRemove, err := ReadCountArrayField[uint32](ctx, "linksToRemove", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfLinksToRemove)) if err != nil { @@ -432,7 +402,7 @@ func (m *_SetTriggeringRequest) SerializeWithWriteBuffer(ctx context.Context, wr return errors.Wrap(pushErr, "Error pushing for SetTriggeringRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } @@ -443,16 +413,16 @@ func (m *_SetTriggeringRequest) SerializeWithWriteBuffer(ctx context.Context, wr if err := WriteSimpleField[uint32](ctx, "triggeringItemId", m.GetTriggeringItemId(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'triggeringItemId' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLinksToAdd", m.GetNoOfLinksToAdd(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLinksToAdd := int32(utils.InlineIf(bool((m.GetLinksToAdd()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLinksToAdd()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLinksToAdd", noOfLinksToAdd, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLinksToAdd' field") } if err := WriteSimpleTypeArrayField(ctx, "linksToAdd", m.GetLinksToAdd(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'linksToAdd' field") } - - if err := WriteSimpleField[int32](ctx, "noOfLinksToRemove", m.GetNoOfLinksToRemove(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfLinksToRemove := int32(utils.InlineIf(bool((m.GetLinksToRemove()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLinksToRemove()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLinksToRemove", noOfLinksToRemove, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfLinksToRemove' field") } @@ -480,12 +450,10 @@ func (m *_SetTriggeringRequest) deepCopy() *_SetTriggeringRequest { } _SetTriggeringRequestCopy := &_SetTriggeringRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), + m.RequestHeader.DeepCopy().(RequestHeader), m.SubscriptionId, m.TriggeringItemId, - m.NoOfLinksToAdd, utils.DeepCopySlice[uint32, uint32](m.LinksToAdd), - m.NoOfLinksToRemove, utils.DeepCopySlice[uint32, uint32](m.LinksToRemove), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/SetTriggeringResponse.go b/plc4go/protocols/opcua/readwrite/model/SetTriggeringResponse.go index 9d44586e40a..25fa3ff6d9b 100644 --- a/plc4go/protocols/opcua/readwrite/model/SetTriggeringResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/SetTriggeringResponse.go @@ -41,21 +41,13 @@ type SetTriggeringResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfAddResults returns NoOfAddResults (property field) - GetNoOfAddResults() int32 + GetResponseHeader() ResponseHeader // GetAddResults returns AddResults (property field) GetAddResults() []StatusCode - // GetNoOfAddDiagnosticInfos returns NoOfAddDiagnosticInfos (property field) - GetNoOfAddDiagnosticInfos() int32 // GetAddDiagnosticInfos returns AddDiagnosticInfos (property field) GetAddDiagnosticInfos() []DiagnosticInfo - // GetNoOfRemoveResults returns NoOfRemoveResults (property field) - GetNoOfRemoveResults() int32 // GetRemoveResults returns RemoveResults (property field) GetRemoveResults() []StatusCode - // GetNoOfRemoveDiagnosticInfos returns NoOfRemoveDiagnosticInfos (property field) - GetNoOfRemoveDiagnosticInfos() int32 // GetRemoveDiagnosticInfos returns RemoveDiagnosticInfos (property field) GetRemoveDiagnosticInfos() []DiagnosticInfo // IsSetTriggeringResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -67,35 +59,27 @@ type SetTriggeringResponse interface { // _SetTriggeringResponse is the data-structure of this message type _SetTriggeringResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfAddResults int32 - AddResults []StatusCode - NoOfAddDiagnosticInfos int32 - AddDiagnosticInfos []DiagnosticInfo - NoOfRemoveResults int32 - RemoveResults []StatusCode - NoOfRemoveDiagnosticInfos int32 - RemoveDiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + AddResults []StatusCode + AddDiagnosticInfos []DiagnosticInfo + RemoveResults []StatusCode + RemoveDiagnosticInfos []DiagnosticInfo } var _ SetTriggeringResponse = (*_SetTriggeringResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_SetTriggeringResponse)(nil) // NewSetTriggeringResponse factory function for _SetTriggeringResponse -func NewSetTriggeringResponse(responseHeader ExtensionObjectDefinition, noOfAddResults int32, addResults []StatusCode, noOfAddDiagnosticInfos int32, addDiagnosticInfos []DiagnosticInfo, noOfRemoveResults int32, removeResults []StatusCode, noOfRemoveDiagnosticInfos int32, removeDiagnosticInfos []DiagnosticInfo) *_SetTriggeringResponse { +func NewSetTriggeringResponse(responseHeader ResponseHeader, addResults []StatusCode, addDiagnosticInfos []DiagnosticInfo, removeResults []StatusCode, removeDiagnosticInfos []DiagnosticInfo) *_SetTriggeringResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for SetTriggeringResponse must not be nil") + panic("responseHeader of type ResponseHeader for SetTriggeringResponse must not be nil") } _result := &_SetTriggeringResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfAddResults: noOfAddResults, AddResults: addResults, - NoOfAddDiagnosticInfos: noOfAddDiagnosticInfos, AddDiagnosticInfos: addDiagnosticInfos, - NoOfRemoveResults: noOfRemoveResults, RemoveResults: removeResults, - NoOfRemoveDiagnosticInfos: noOfRemoveDiagnosticInfos, RemoveDiagnosticInfos: removeDiagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -111,25 +95,17 @@ func NewSetTriggeringResponse(responseHeader ExtensionObjectDefinition, noOfAddR type SetTriggeringResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfAddResults int32, addResults []StatusCode, noOfAddDiagnosticInfos int32, addDiagnosticInfos []DiagnosticInfo, noOfRemoveResults int32, removeResults []StatusCode, noOfRemoveDiagnosticInfos int32, removeDiagnosticInfos []DiagnosticInfo) SetTriggeringResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, addResults []StatusCode, addDiagnosticInfos []DiagnosticInfo, removeResults []StatusCode, removeDiagnosticInfos []DiagnosticInfo) SetTriggeringResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) SetTriggeringResponseBuilder + WithResponseHeader(ResponseHeader) SetTriggeringResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetTriggeringResponseBuilder - // WithNoOfAddResults adds NoOfAddResults (property field) - WithNoOfAddResults(int32) SetTriggeringResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetTriggeringResponseBuilder // WithAddResults adds AddResults (property field) WithAddResults(...StatusCode) SetTriggeringResponseBuilder - // WithNoOfAddDiagnosticInfos adds NoOfAddDiagnosticInfos (property field) - WithNoOfAddDiagnosticInfos(int32) SetTriggeringResponseBuilder // WithAddDiagnosticInfos adds AddDiagnosticInfos (property field) WithAddDiagnosticInfos(...DiagnosticInfo) SetTriggeringResponseBuilder - // WithNoOfRemoveResults adds NoOfRemoveResults (property field) - WithNoOfRemoveResults(int32) SetTriggeringResponseBuilder // WithRemoveResults adds RemoveResults (property field) WithRemoveResults(...StatusCode) SetTriggeringResponseBuilder - // WithNoOfRemoveDiagnosticInfos adds NoOfRemoveDiagnosticInfos (property field) - WithNoOfRemoveDiagnosticInfos(int32) SetTriggeringResponseBuilder // WithRemoveDiagnosticInfos adds RemoveDiagnosticInfos (property field) WithRemoveDiagnosticInfos(...DiagnosticInfo) SetTriggeringResponseBuilder // Build builds the SetTriggeringResponse or returns an error if something is wrong @@ -157,63 +133,43 @@ func (b *_SetTriggeringResponseBuilder) setParent(contract ExtensionObjectDefini b.ExtensionObjectDefinitionContract = contract } -func (b *_SetTriggeringResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfAddResults int32, addResults []StatusCode, noOfAddDiagnosticInfos int32, addDiagnosticInfos []DiagnosticInfo, noOfRemoveResults int32, removeResults []StatusCode, noOfRemoveDiagnosticInfos int32, removeDiagnosticInfos []DiagnosticInfo) SetTriggeringResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfAddResults(noOfAddResults).WithAddResults(addResults...).WithNoOfAddDiagnosticInfos(noOfAddDiagnosticInfos).WithAddDiagnosticInfos(addDiagnosticInfos...).WithNoOfRemoveResults(noOfRemoveResults).WithRemoveResults(removeResults...).WithNoOfRemoveDiagnosticInfos(noOfRemoveDiagnosticInfos).WithRemoveDiagnosticInfos(removeDiagnosticInfos...) +func (b *_SetTriggeringResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, addResults []StatusCode, addDiagnosticInfos []DiagnosticInfo, removeResults []StatusCode, removeDiagnosticInfos []DiagnosticInfo) SetTriggeringResponseBuilder { + return b.WithResponseHeader(responseHeader).WithAddResults(addResults...).WithAddDiagnosticInfos(addDiagnosticInfos...).WithRemoveResults(removeResults...).WithRemoveDiagnosticInfos(removeDiagnosticInfos...) } -func (b *_SetTriggeringResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) SetTriggeringResponseBuilder { +func (b *_SetTriggeringResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) SetTriggeringResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_SetTriggeringResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) SetTriggeringResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_SetTriggeringResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) SetTriggeringResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_SetTriggeringResponseBuilder) WithNoOfAddResults(noOfAddResults int32) SetTriggeringResponseBuilder { - b.NoOfAddResults = noOfAddResults - return b -} - func (b *_SetTriggeringResponseBuilder) WithAddResults(addResults ...StatusCode) SetTriggeringResponseBuilder { b.AddResults = addResults return b } -func (b *_SetTriggeringResponseBuilder) WithNoOfAddDiagnosticInfos(noOfAddDiagnosticInfos int32) SetTriggeringResponseBuilder { - b.NoOfAddDiagnosticInfos = noOfAddDiagnosticInfos - return b -} - func (b *_SetTriggeringResponseBuilder) WithAddDiagnosticInfos(addDiagnosticInfos ...DiagnosticInfo) SetTriggeringResponseBuilder { b.AddDiagnosticInfos = addDiagnosticInfos return b } -func (b *_SetTriggeringResponseBuilder) WithNoOfRemoveResults(noOfRemoveResults int32) SetTriggeringResponseBuilder { - b.NoOfRemoveResults = noOfRemoveResults - return b -} - func (b *_SetTriggeringResponseBuilder) WithRemoveResults(removeResults ...StatusCode) SetTriggeringResponseBuilder { b.RemoveResults = removeResults return b } -func (b *_SetTriggeringResponseBuilder) WithNoOfRemoveDiagnosticInfos(noOfRemoveDiagnosticInfos int32) SetTriggeringResponseBuilder { - b.NoOfRemoveDiagnosticInfos = noOfRemoveDiagnosticInfos - return b -} - func (b *_SetTriggeringResponseBuilder) WithRemoveDiagnosticInfos(removeDiagnosticInfos ...DiagnosticInfo) SetTriggeringResponseBuilder { b.RemoveDiagnosticInfos = removeDiagnosticInfos return b @@ -275,8 +231,8 @@ func (b *_SetTriggeringResponse) CreateSetTriggeringResponseBuilder() SetTrigger /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SetTriggeringResponse) GetIdentifier() string { - return "778" +func (m *_SetTriggeringResponse) GetExtensionId() int32 { + return int32(778) } /////////////////////// @@ -293,38 +249,22 @@ func (m *_SetTriggeringResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_SetTriggeringResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_SetTriggeringResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_SetTriggeringResponse) GetNoOfAddResults() int32 { - return m.NoOfAddResults -} - func (m *_SetTriggeringResponse) GetAddResults() []StatusCode { return m.AddResults } -func (m *_SetTriggeringResponse) GetNoOfAddDiagnosticInfos() int32 { - return m.NoOfAddDiagnosticInfos -} - func (m *_SetTriggeringResponse) GetAddDiagnosticInfos() []DiagnosticInfo { return m.AddDiagnosticInfos } -func (m *_SetTriggeringResponse) GetNoOfRemoveResults() int32 { - return m.NoOfRemoveResults -} - func (m *_SetTriggeringResponse) GetRemoveResults() []StatusCode { return m.RemoveResults } -func (m *_SetTriggeringResponse) GetNoOfRemoveDiagnosticInfos() int32 { - return m.NoOfRemoveDiagnosticInfos -} - func (m *_SetTriggeringResponse) GetRemoveDiagnosticInfos() []DiagnosticInfo { return m.RemoveDiagnosticInfos } @@ -355,7 +295,7 @@ func (m *_SetTriggeringResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfAddResults) + // Implicit Field (noOfAddResults) lengthInBits += 32 // Array field @@ -368,7 +308,7 @@ func (m *_SetTriggeringResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfAddDiagnosticInfos) + // Implicit Field (noOfAddDiagnosticInfos) lengthInBits += 32 // Array field @@ -381,7 +321,7 @@ func (m *_SetTriggeringResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfRemoveResults) + // Implicit Field (noOfRemoveResults) lengthInBits += 32 // Array field @@ -394,7 +334,7 @@ func (m *_SetTriggeringResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfRemoveDiagnosticInfos) + // Implicit Field (noOfRemoveDiagnosticInfos) lengthInBits += 32 // Array field @@ -414,7 +354,7 @@ func (m *_SetTriggeringResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__setTriggeringResponse SetTriggeringResponse, err error) { +func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__setTriggeringResponse SetTriggeringResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -425,17 +365,17 @@ func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfAddResults, err := ReadSimpleField(ctx, "noOfAddResults", ReadSignedInt(readBuffer, uint8(32))) + noOfAddResults, err := ReadImplicitField[int32](ctx, "noOfAddResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAddResults' field")) } - m.NoOfAddResults = noOfAddResults + _ = noOfAddResults addResults, err := ReadCountArrayField[StatusCode](ctx, "addResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfAddResults)) if err != nil { @@ -443,11 +383,11 @@ func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.Rea } m.AddResults = addResults - noOfAddDiagnosticInfos, err := ReadSimpleField(ctx, "noOfAddDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfAddDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfAddDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAddDiagnosticInfos' field")) } - m.NoOfAddDiagnosticInfos = noOfAddDiagnosticInfos + _ = noOfAddDiagnosticInfos addDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "addDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfAddDiagnosticInfos)) if err != nil { @@ -455,11 +395,11 @@ func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.Rea } m.AddDiagnosticInfos = addDiagnosticInfos - noOfRemoveResults, err := ReadSimpleField(ctx, "noOfRemoveResults", ReadSignedInt(readBuffer, uint8(32))) + noOfRemoveResults, err := ReadImplicitField[int32](ctx, "noOfRemoveResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfRemoveResults' field")) } - m.NoOfRemoveResults = noOfRemoveResults + _ = noOfRemoveResults removeResults, err := ReadCountArrayField[StatusCode](ctx, "removeResults", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfRemoveResults)) if err != nil { @@ -467,11 +407,11 @@ func (m *_SetTriggeringResponse) parse(ctx context.Context, readBuffer utils.Rea } m.RemoveResults = removeResults - noOfRemoveDiagnosticInfos, err := ReadSimpleField(ctx, "noOfRemoveDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfRemoveDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfRemoveDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfRemoveDiagnosticInfos' field")) } - m.NoOfRemoveDiagnosticInfos = noOfRemoveDiagnosticInfos + _ = noOfRemoveDiagnosticInfos removeDiagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "removeDiagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfRemoveDiagnosticInfos)) if err != nil { @@ -504,35 +444,35 @@ func (m *_SetTriggeringResponse) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for SetTriggeringResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfAddResults", m.GetNoOfAddResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfAddResults := int32(utils.InlineIf(bool((m.GetAddResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAddResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAddResults", noOfAddResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfAddResults' field") } if err := WriteComplexTypeArrayField(ctx, "addResults", m.GetAddResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'addResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfAddDiagnosticInfos", m.GetNoOfAddDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfAddDiagnosticInfos := int32(utils.InlineIf(bool((m.GetAddDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAddDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAddDiagnosticInfos", noOfAddDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfAddDiagnosticInfos' field") } if err := WriteComplexTypeArrayField(ctx, "addDiagnosticInfos", m.GetAddDiagnosticInfos(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'addDiagnosticInfos' field") } - - if err := WriteSimpleField[int32](ctx, "noOfRemoveResults", m.GetNoOfRemoveResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfRemoveResults := int32(utils.InlineIf(bool((m.GetRemoveResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetRemoveResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfRemoveResults", noOfRemoveResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfRemoveResults' field") } if err := WriteComplexTypeArrayField(ctx, "removeResults", m.GetRemoveResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'removeResults' field") } - - if err := WriteSimpleField[int32](ctx, "noOfRemoveDiagnosticInfos", m.GetNoOfRemoveDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfRemoveDiagnosticInfos := int32(utils.InlineIf(bool((m.GetRemoveDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetRemoveDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfRemoveDiagnosticInfos", noOfRemoveDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfRemoveDiagnosticInfos' field") } @@ -560,14 +500,10 @@ func (m *_SetTriggeringResponse) deepCopy() *_SetTriggeringResponse { } _SetTriggeringResponseCopy := &_SetTriggeringResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfAddResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.AddResults), - m.NoOfAddDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.AddDiagnosticInfos), - m.NoOfRemoveResults, utils.DeepCopySlice[StatusCode, StatusCode](m.RemoveResults), - m.NoOfRemoveDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.RemoveDiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/SignatureData.go b/plc4go/protocols/opcua/readwrite/model/SignatureData.go index 90ff9338c8a..8558e6b28f5 100644 --- a/plc4go/protocols/opcua/readwrite/model/SignatureData.go +++ b/plc4go/protocols/opcua/readwrite/model/SignatureData.go @@ -222,8 +222,8 @@ func (b *_SignatureData) CreateSignatureDataBuilder() SignatureDataBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SignatureData) GetIdentifier() string { - return "458" +func (m *_SignatureData) GetExtensionId() int32 { + return int32(458) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_SignatureData) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_SignatureData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__signatureData SignatureData, err error) { +func (m *_SignatureData) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__signatureData SignatureData, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/SignedSoftwareCertificate.go b/plc4go/protocols/opcua/readwrite/model/SignedSoftwareCertificate.go index a247047bb06..84acd59d654 100644 --- a/plc4go/protocols/opcua/readwrite/model/SignedSoftwareCertificate.go +++ b/plc4go/protocols/opcua/readwrite/model/SignedSoftwareCertificate.go @@ -222,8 +222,8 @@ func (b *_SignedSoftwareCertificate) CreateSignedSoftwareCertificateBuilder() Si /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SignedSoftwareCertificate) GetIdentifier() string { - return "346" +func (m *_SignedSoftwareCertificate) GetExtensionId() int32 { + return int32(346) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_SignedSoftwareCertificate) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_SignedSoftwareCertificate) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__signedSoftwareCertificate SignedSoftwareCertificate, err error) { +func (m *_SignedSoftwareCertificate) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__signedSoftwareCertificate SignedSoftwareCertificate, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/SimpleAttributeOperand.go b/plc4go/protocols/opcua/readwrite/model/SimpleAttributeOperand.go new file mode 100644 index 00000000000..67a7bb325d1 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/SimpleAttributeOperand.go @@ -0,0 +1,461 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SimpleAttributeOperand is the corresponding interface of SimpleAttributeOperand +type SimpleAttributeOperand interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetTypeDefinitionId returns TypeDefinitionId (property field) + GetTypeDefinitionId() NodeId + // GetBrowsePath returns BrowsePath (property field) + GetBrowsePath() []QualifiedName + // GetAttributeId returns AttributeId (property field) + GetAttributeId() uint32 + // GetIndexRange returns IndexRange (property field) + GetIndexRange() PascalString + // IsSimpleAttributeOperand is a marker method to prevent unintentional type checks (interfaces of same signature) + IsSimpleAttributeOperand() + // CreateBuilder creates a SimpleAttributeOperandBuilder + CreateSimpleAttributeOperandBuilder() SimpleAttributeOperandBuilder +} + +// _SimpleAttributeOperand is the data-structure of this message +type _SimpleAttributeOperand struct { + ExtensionObjectDefinitionContract + TypeDefinitionId NodeId + BrowsePath []QualifiedName + AttributeId uint32 + IndexRange PascalString +} + +var _ SimpleAttributeOperand = (*_SimpleAttributeOperand)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_SimpleAttributeOperand)(nil) + +// NewSimpleAttributeOperand factory function for _SimpleAttributeOperand +func NewSimpleAttributeOperand(typeDefinitionId NodeId, browsePath []QualifiedName, attributeId uint32, indexRange PascalString) *_SimpleAttributeOperand { + if typeDefinitionId == nil { + panic("typeDefinitionId of type NodeId for SimpleAttributeOperand must not be nil") + } + if indexRange == nil { + panic("indexRange of type PascalString for SimpleAttributeOperand must not be nil") + } + _result := &_SimpleAttributeOperand{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + TypeDefinitionId: typeDefinitionId, + BrowsePath: browsePath, + AttributeId: attributeId, + IndexRange: indexRange, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// SimpleAttributeOperandBuilder is a builder for SimpleAttributeOperand +type SimpleAttributeOperandBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(typeDefinitionId NodeId, browsePath []QualifiedName, attributeId uint32, indexRange PascalString) SimpleAttributeOperandBuilder + // WithTypeDefinitionId adds TypeDefinitionId (property field) + WithTypeDefinitionId(NodeId) SimpleAttributeOperandBuilder + // WithTypeDefinitionIdBuilder adds TypeDefinitionId (property field) which is build by the builder + WithTypeDefinitionIdBuilder(func(NodeIdBuilder) NodeIdBuilder) SimpleAttributeOperandBuilder + // WithBrowsePath adds BrowsePath (property field) + WithBrowsePath(...QualifiedName) SimpleAttributeOperandBuilder + // WithAttributeId adds AttributeId (property field) + WithAttributeId(uint32) SimpleAttributeOperandBuilder + // WithIndexRange adds IndexRange (property field) + WithIndexRange(PascalString) SimpleAttributeOperandBuilder + // WithIndexRangeBuilder adds IndexRange (property field) which is build by the builder + WithIndexRangeBuilder(func(PascalStringBuilder) PascalStringBuilder) SimpleAttributeOperandBuilder + // Build builds the SimpleAttributeOperand or returns an error if something is wrong + Build() (SimpleAttributeOperand, error) + // MustBuild does the same as Build but panics on error + MustBuild() SimpleAttributeOperand +} + +// NewSimpleAttributeOperandBuilder() creates a SimpleAttributeOperandBuilder +func NewSimpleAttributeOperandBuilder() SimpleAttributeOperandBuilder { + return &_SimpleAttributeOperandBuilder{_SimpleAttributeOperand: new(_SimpleAttributeOperand)} +} + +type _SimpleAttributeOperandBuilder struct { + *_SimpleAttributeOperand + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (SimpleAttributeOperandBuilder) = (*_SimpleAttributeOperandBuilder)(nil) + +func (b *_SimpleAttributeOperandBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_SimpleAttributeOperandBuilder) WithMandatoryFields(typeDefinitionId NodeId, browsePath []QualifiedName, attributeId uint32, indexRange PascalString) SimpleAttributeOperandBuilder { + return b.WithTypeDefinitionId(typeDefinitionId).WithBrowsePath(browsePath...).WithAttributeId(attributeId).WithIndexRange(indexRange) +} + +func (b *_SimpleAttributeOperandBuilder) WithTypeDefinitionId(typeDefinitionId NodeId) SimpleAttributeOperandBuilder { + b.TypeDefinitionId = typeDefinitionId + return b +} + +func (b *_SimpleAttributeOperandBuilder) WithTypeDefinitionIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) SimpleAttributeOperandBuilder { + builder := builderSupplier(b.TypeDefinitionId.CreateNodeIdBuilder()) + var err error + b.TypeDefinitionId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_SimpleAttributeOperandBuilder) WithBrowsePath(browsePath ...QualifiedName) SimpleAttributeOperandBuilder { + b.BrowsePath = browsePath + return b +} + +func (b *_SimpleAttributeOperandBuilder) WithAttributeId(attributeId uint32) SimpleAttributeOperandBuilder { + b.AttributeId = attributeId + return b +} + +func (b *_SimpleAttributeOperandBuilder) WithIndexRange(indexRange PascalString) SimpleAttributeOperandBuilder { + b.IndexRange = indexRange + return b +} + +func (b *_SimpleAttributeOperandBuilder) WithIndexRangeBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) SimpleAttributeOperandBuilder { + builder := builderSupplier(b.IndexRange.CreatePascalStringBuilder()) + var err error + b.IndexRange, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_SimpleAttributeOperandBuilder) Build() (SimpleAttributeOperand, error) { + if b.TypeDefinitionId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'typeDefinitionId' not set")) + } + if b.IndexRange == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'indexRange' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._SimpleAttributeOperand.deepCopy(), nil +} + +func (b *_SimpleAttributeOperandBuilder) MustBuild() SimpleAttributeOperand { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_SimpleAttributeOperandBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_SimpleAttributeOperandBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_SimpleAttributeOperandBuilder) DeepCopy() any { + _copy := b.CreateSimpleAttributeOperandBuilder().(*_SimpleAttributeOperandBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateSimpleAttributeOperandBuilder creates a SimpleAttributeOperandBuilder +func (b *_SimpleAttributeOperand) CreateSimpleAttributeOperandBuilder() SimpleAttributeOperandBuilder { + if b == nil { + return NewSimpleAttributeOperandBuilder() + } + return &_SimpleAttributeOperandBuilder{_SimpleAttributeOperand: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_SimpleAttributeOperand) GetExtensionId() int32 { + return int32(603) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_SimpleAttributeOperand) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_SimpleAttributeOperand) GetTypeDefinitionId() NodeId { + return m.TypeDefinitionId +} + +func (m *_SimpleAttributeOperand) GetBrowsePath() []QualifiedName { + return m.BrowsePath +} + +func (m *_SimpleAttributeOperand) GetAttributeId() uint32 { + return m.AttributeId +} + +func (m *_SimpleAttributeOperand) GetIndexRange() PascalString { + return m.IndexRange +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastSimpleAttributeOperand(structType any) SimpleAttributeOperand { + if casted, ok := structType.(SimpleAttributeOperand); ok { + return casted + } + if casted, ok := structType.(*SimpleAttributeOperand); ok { + return *casted + } + return nil +} + +func (m *_SimpleAttributeOperand) GetTypeName() string { + return "SimpleAttributeOperand" +} + +func (m *_SimpleAttributeOperand) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (typeDefinitionId) + lengthInBits += m.TypeDefinitionId.GetLengthInBits(ctx) + + // Implicit Field (noOfBrowsePath) + lengthInBits += 32 + + // Array field + if len(m.BrowsePath) > 0 { + for _curItem, element := range m.BrowsePath { + arrayCtx := utils.CreateArrayContext(ctx, len(m.BrowsePath), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (attributeId) + lengthInBits += 32 + + // Simple field (indexRange) + lengthInBits += m.IndexRange.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_SimpleAttributeOperand) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_SimpleAttributeOperand) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__simpleAttributeOperand SimpleAttributeOperand, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("SimpleAttributeOperand"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for SimpleAttributeOperand") + } + currentPos := positionAware.GetPos() + _ = currentPos + + typeDefinitionId, err := ReadSimpleField[NodeId](ctx, "typeDefinitionId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'typeDefinitionId' field")) + } + m.TypeDefinitionId = typeDefinitionId + + noOfBrowsePath, err := ReadImplicitField[int32](ctx, "noOfBrowsePath", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfBrowsePath' field")) + } + _ = noOfBrowsePath + + browsePath, err := ReadCountArrayField[QualifiedName](ctx, "browsePath", ReadComplex[QualifiedName](QualifiedNameParseWithBuffer, readBuffer), uint64(noOfBrowsePath)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'browsePath' field")) + } + m.BrowsePath = browsePath + + attributeId, err := ReadSimpleField(ctx, "attributeId", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'attributeId' field")) + } + m.AttributeId = attributeId + + indexRange, err := ReadSimpleField[PascalString](ctx, "indexRange", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'indexRange' field")) + } + m.IndexRange = indexRange + + if closeErr := readBuffer.CloseContext("SimpleAttributeOperand"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for SimpleAttributeOperand") + } + + return m, nil +} + +func (m *_SimpleAttributeOperand) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_SimpleAttributeOperand) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("SimpleAttributeOperand"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for SimpleAttributeOperand") + } + + if err := WriteSimpleField[NodeId](ctx, "typeDefinitionId", m.GetTypeDefinitionId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'typeDefinitionId' field") + } + noOfBrowsePath := int32(utils.InlineIf(bool((m.GetBrowsePath()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetBrowsePath()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfBrowsePath", noOfBrowsePath, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfBrowsePath' field") + } + + if err := WriteComplexTypeArrayField(ctx, "browsePath", m.GetBrowsePath(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'browsePath' field") + } + + if err := WriteSimpleField[uint32](ctx, "attributeId", m.GetAttributeId(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'attributeId' field") + } + + if err := WriteSimpleField[PascalString](ctx, "indexRange", m.GetIndexRange(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'indexRange' field") + } + + if popErr := writeBuffer.PopContext("SimpleAttributeOperand"); popErr != nil { + return errors.Wrap(popErr, "Error popping for SimpleAttributeOperand") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_SimpleAttributeOperand) IsSimpleAttributeOperand() {} + +func (m *_SimpleAttributeOperand) DeepCopy() any { + return m.deepCopy() +} + +func (m *_SimpleAttributeOperand) deepCopy() *_SimpleAttributeOperand { + if m == nil { + return nil + } + _SimpleAttributeOperandCopy := &_SimpleAttributeOperand{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.TypeDefinitionId.DeepCopy().(NodeId), + utils.DeepCopySlice[QualifiedName, QualifiedName](m.BrowsePath), + m.AttributeId, + m.IndexRange.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _SimpleAttributeOperandCopy +} + +func (m *_SimpleAttributeOperand) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/SimpleTypeDescription.go b/plc4go/protocols/opcua/readwrite/model/SimpleTypeDescription.go new file mode 100644 index 00000000000..dc44f8031f7 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/SimpleTypeDescription.go @@ -0,0 +1,465 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SimpleTypeDescription is the corresponding interface of SimpleTypeDescription +type SimpleTypeDescription interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataTypeId returns DataTypeId (property field) + GetDataTypeId() NodeId + // GetName returns Name (property field) + GetName() QualifiedName + // GetBaseDataType returns BaseDataType (property field) + GetBaseDataType() NodeId + // GetBuiltInType returns BuiltInType (property field) + GetBuiltInType() uint8 + // IsSimpleTypeDescription is a marker method to prevent unintentional type checks (interfaces of same signature) + IsSimpleTypeDescription() + // CreateBuilder creates a SimpleTypeDescriptionBuilder + CreateSimpleTypeDescriptionBuilder() SimpleTypeDescriptionBuilder +} + +// _SimpleTypeDescription is the data-structure of this message +type _SimpleTypeDescription struct { + ExtensionObjectDefinitionContract + DataTypeId NodeId + Name QualifiedName + BaseDataType NodeId + BuiltInType uint8 +} + +var _ SimpleTypeDescription = (*_SimpleTypeDescription)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_SimpleTypeDescription)(nil) + +// NewSimpleTypeDescription factory function for _SimpleTypeDescription +func NewSimpleTypeDescription(dataTypeId NodeId, name QualifiedName, baseDataType NodeId, builtInType uint8) *_SimpleTypeDescription { + if dataTypeId == nil { + panic("dataTypeId of type NodeId for SimpleTypeDescription must not be nil") + } + if name == nil { + panic("name of type QualifiedName for SimpleTypeDescription must not be nil") + } + if baseDataType == nil { + panic("baseDataType of type NodeId for SimpleTypeDescription must not be nil") + } + _result := &_SimpleTypeDescription{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataTypeId: dataTypeId, + Name: name, + BaseDataType: baseDataType, + BuiltInType: builtInType, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// SimpleTypeDescriptionBuilder is a builder for SimpleTypeDescription +type SimpleTypeDescriptionBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataTypeId NodeId, name QualifiedName, baseDataType NodeId, builtInType uint8) SimpleTypeDescriptionBuilder + // WithDataTypeId adds DataTypeId (property field) + WithDataTypeId(NodeId) SimpleTypeDescriptionBuilder + // WithDataTypeIdBuilder adds DataTypeId (property field) which is build by the builder + WithDataTypeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) SimpleTypeDescriptionBuilder + // WithName adds Name (property field) + WithName(QualifiedName) SimpleTypeDescriptionBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(QualifiedNameBuilder) QualifiedNameBuilder) SimpleTypeDescriptionBuilder + // WithBaseDataType adds BaseDataType (property field) + WithBaseDataType(NodeId) SimpleTypeDescriptionBuilder + // WithBaseDataTypeBuilder adds BaseDataType (property field) which is build by the builder + WithBaseDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) SimpleTypeDescriptionBuilder + // WithBuiltInType adds BuiltInType (property field) + WithBuiltInType(uint8) SimpleTypeDescriptionBuilder + // Build builds the SimpleTypeDescription or returns an error if something is wrong + Build() (SimpleTypeDescription, error) + // MustBuild does the same as Build but panics on error + MustBuild() SimpleTypeDescription +} + +// NewSimpleTypeDescriptionBuilder() creates a SimpleTypeDescriptionBuilder +func NewSimpleTypeDescriptionBuilder() SimpleTypeDescriptionBuilder { + return &_SimpleTypeDescriptionBuilder{_SimpleTypeDescription: new(_SimpleTypeDescription)} +} + +type _SimpleTypeDescriptionBuilder struct { + *_SimpleTypeDescription + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (SimpleTypeDescriptionBuilder) = (*_SimpleTypeDescriptionBuilder)(nil) + +func (b *_SimpleTypeDescriptionBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_SimpleTypeDescriptionBuilder) WithMandatoryFields(dataTypeId NodeId, name QualifiedName, baseDataType NodeId, builtInType uint8) SimpleTypeDescriptionBuilder { + return b.WithDataTypeId(dataTypeId).WithName(name).WithBaseDataType(baseDataType).WithBuiltInType(builtInType) +} + +func (b *_SimpleTypeDescriptionBuilder) WithDataTypeId(dataTypeId NodeId) SimpleTypeDescriptionBuilder { + b.DataTypeId = dataTypeId + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithDataTypeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) SimpleTypeDescriptionBuilder { + builder := builderSupplier(b.DataTypeId.CreateNodeIdBuilder()) + var err error + b.DataTypeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithName(name QualifiedName) SimpleTypeDescriptionBuilder { + b.Name = name + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithNameBuilder(builderSupplier func(QualifiedNameBuilder) QualifiedNameBuilder) SimpleTypeDescriptionBuilder { + builder := builderSupplier(b.Name.CreateQualifiedNameBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "QualifiedNameBuilder failed")) + } + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithBaseDataType(baseDataType NodeId) SimpleTypeDescriptionBuilder { + b.BaseDataType = baseDataType + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithBaseDataTypeBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) SimpleTypeDescriptionBuilder { + builder := builderSupplier(b.BaseDataType.CreateNodeIdBuilder()) + var err error + b.BaseDataType, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_SimpleTypeDescriptionBuilder) WithBuiltInType(builtInType uint8) SimpleTypeDescriptionBuilder { + b.BuiltInType = builtInType + return b +} + +func (b *_SimpleTypeDescriptionBuilder) Build() (SimpleTypeDescription, error) { + if b.DataTypeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataTypeId' not set")) + } + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.BaseDataType == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'baseDataType' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._SimpleTypeDescription.deepCopy(), nil +} + +func (b *_SimpleTypeDescriptionBuilder) MustBuild() SimpleTypeDescription { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_SimpleTypeDescriptionBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_SimpleTypeDescriptionBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_SimpleTypeDescriptionBuilder) DeepCopy() any { + _copy := b.CreateSimpleTypeDescriptionBuilder().(*_SimpleTypeDescriptionBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateSimpleTypeDescriptionBuilder creates a SimpleTypeDescriptionBuilder +func (b *_SimpleTypeDescription) CreateSimpleTypeDescriptionBuilder() SimpleTypeDescriptionBuilder { + if b == nil { + return NewSimpleTypeDescriptionBuilder() + } + return &_SimpleTypeDescriptionBuilder{_SimpleTypeDescription: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_SimpleTypeDescription) GetExtensionId() int32 { + return int32(15007) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_SimpleTypeDescription) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_SimpleTypeDescription) GetDataTypeId() NodeId { + return m.DataTypeId +} + +func (m *_SimpleTypeDescription) GetName() QualifiedName { + return m.Name +} + +func (m *_SimpleTypeDescription) GetBaseDataType() NodeId { + return m.BaseDataType +} + +func (m *_SimpleTypeDescription) GetBuiltInType() uint8 { + return m.BuiltInType +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastSimpleTypeDescription(structType any) SimpleTypeDescription { + if casted, ok := structType.(SimpleTypeDescription); ok { + return casted + } + if casted, ok := structType.(*SimpleTypeDescription); ok { + return *casted + } + return nil +} + +func (m *_SimpleTypeDescription) GetTypeName() string { + return "SimpleTypeDescription" +} + +func (m *_SimpleTypeDescription) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataTypeId) + lengthInBits += m.DataTypeId.GetLengthInBits(ctx) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Simple field (baseDataType) + lengthInBits += m.BaseDataType.GetLengthInBits(ctx) + + // Simple field (builtInType) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_SimpleTypeDescription) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_SimpleTypeDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__simpleTypeDescription SimpleTypeDescription, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("SimpleTypeDescription"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for SimpleTypeDescription") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataTypeId, err := ReadSimpleField[NodeId](ctx, "dataTypeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataTypeId' field")) + } + m.DataTypeId = dataTypeId + + name, err := ReadSimpleField[QualifiedName](ctx, "name", ReadComplex[QualifiedName](QualifiedNameParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + baseDataType, err := ReadSimpleField[NodeId](ctx, "baseDataType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'baseDataType' field")) + } + m.BaseDataType = baseDataType + + builtInType, err := ReadSimpleField(ctx, "builtInType", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'builtInType' field")) + } + m.BuiltInType = builtInType + + if closeErr := readBuffer.CloseContext("SimpleTypeDescription"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for SimpleTypeDescription") + } + + return m, nil +} + +func (m *_SimpleTypeDescription) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_SimpleTypeDescription) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("SimpleTypeDescription"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for SimpleTypeDescription") + } + + if err := WriteSimpleField[NodeId](ctx, "dataTypeId", m.GetDataTypeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataTypeId' field") + } + + if err := WriteSimpleField[QualifiedName](ctx, "name", m.GetName(), WriteComplex[QualifiedName](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteSimpleField[NodeId](ctx, "baseDataType", m.GetBaseDataType(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'baseDataType' field") + } + + if err := WriteSimpleField[uint8](ctx, "builtInType", m.GetBuiltInType(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'builtInType' field") + } + + if popErr := writeBuffer.PopContext("SimpleTypeDescription"); popErr != nil { + return errors.Wrap(popErr, "Error popping for SimpleTypeDescription") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_SimpleTypeDescription) IsSimpleTypeDescription() {} + +func (m *_SimpleTypeDescription) DeepCopy() any { + return m.deepCopy() +} + +func (m *_SimpleTypeDescription) deepCopy() *_SimpleTypeDescription { + if m == nil { + return nil + } + _SimpleTypeDescriptionCopy := &_SimpleTypeDescription{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataTypeId.DeepCopy().(NodeId), + m.Name.DeepCopy().(QualifiedName), + m.BaseDataType.DeepCopy().(NodeId), + m.BuiltInType, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _SimpleTypeDescriptionCopy +} + +func (m *_SimpleTypeDescription) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetDataType.go b/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetDataType.go new file mode 100644 index 00000000000..e974d13ec05 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetDataType.go @@ -0,0 +1,485 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// StandaloneSubscribedDataSetDataType is the corresponding interface of StandaloneSubscribedDataSetDataType +type StandaloneSubscribedDataSetDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetName returns Name (property field) + GetName() PascalString + // GetDataSetFolder returns DataSetFolder (property field) + GetDataSetFolder() []PascalString + // GetDataSetMetaData returns DataSetMetaData (property field) + GetDataSetMetaData() DataSetMetaDataType + // GetSubscribedDataSet returns SubscribedDataSet (property field) + GetSubscribedDataSet() ExtensionObject + // IsStandaloneSubscribedDataSetDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsStandaloneSubscribedDataSetDataType() + // CreateBuilder creates a StandaloneSubscribedDataSetDataTypeBuilder + CreateStandaloneSubscribedDataSetDataTypeBuilder() StandaloneSubscribedDataSetDataTypeBuilder +} + +// _StandaloneSubscribedDataSetDataType is the data-structure of this message +type _StandaloneSubscribedDataSetDataType struct { + ExtensionObjectDefinitionContract + Name PascalString + DataSetFolder []PascalString + DataSetMetaData DataSetMetaDataType + SubscribedDataSet ExtensionObject +} + +var _ StandaloneSubscribedDataSetDataType = (*_StandaloneSubscribedDataSetDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_StandaloneSubscribedDataSetDataType)(nil) + +// NewStandaloneSubscribedDataSetDataType factory function for _StandaloneSubscribedDataSetDataType +func NewStandaloneSubscribedDataSetDataType(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, subscribedDataSet ExtensionObject) *_StandaloneSubscribedDataSetDataType { + if name == nil { + panic("name of type PascalString for StandaloneSubscribedDataSetDataType must not be nil") + } + if dataSetMetaData == nil { + panic("dataSetMetaData of type DataSetMetaDataType for StandaloneSubscribedDataSetDataType must not be nil") + } + if subscribedDataSet == nil { + panic("subscribedDataSet of type ExtensionObject for StandaloneSubscribedDataSetDataType must not be nil") + } + _result := &_StandaloneSubscribedDataSetDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Name: name, + DataSetFolder: dataSetFolder, + DataSetMetaData: dataSetMetaData, + SubscribedDataSet: subscribedDataSet, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// StandaloneSubscribedDataSetDataTypeBuilder is a builder for StandaloneSubscribedDataSetDataType +type StandaloneSubscribedDataSetDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, subscribedDataSet ExtensionObject) StandaloneSubscribedDataSetDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) StandaloneSubscribedDataSetDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) StandaloneSubscribedDataSetDataTypeBuilder + // WithDataSetFolder adds DataSetFolder (property field) + WithDataSetFolder(...PascalString) StandaloneSubscribedDataSetDataTypeBuilder + // WithDataSetMetaData adds DataSetMetaData (property field) + WithDataSetMetaData(DataSetMetaDataType) StandaloneSubscribedDataSetDataTypeBuilder + // WithDataSetMetaDataBuilder adds DataSetMetaData (property field) which is build by the builder + WithDataSetMetaDataBuilder(func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) StandaloneSubscribedDataSetDataTypeBuilder + // WithSubscribedDataSet adds SubscribedDataSet (property field) + WithSubscribedDataSet(ExtensionObject) StandaloneSubscribedDataSetDataTypeBuilder + // WithSubscribedDataSetBuilder adds SubscribedDataSet (property field) which is build by the builder + WithSubscribedDataSetBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) StandaloneSubscribedDataSetDataTypeBuilder + // Build builds the StandaloneSubscribedDataSetDataType or returns an error if something is wrong + Build() (StandaloneSubscribedDataSetDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() StandaloneSubscribedDataSetDataType +} + +// NewStandaloneSubscribedDataSetDataTypeBuilder() creates a StandaloneSubscribedDataSetDataTypeBuilder +func NewStandaloneSubscribedDataSetDataTypeBuilder() StandaloneSubscribedDataSetDataTypeBuilder { + return &_StandaloneSubscribedDataSetDataTypeBuilder{_StandaloneSubscribedDataSetDataType: new(_StandaloneSubscribedDataSetDataType)} +} + +type _StandaloneSubscribedDataSetDataTypeBuilder struct { + *_StandaloneSubscribedDataSetDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (StandaloneSubscribedDataSetDataTypeBuilder) = (*_StandaloneSubscribedDataSetDataTypeBuilder)(nil) + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithMandatoryFields(name PascalString, dataSetFolder []PascalString, dataSetMetaData DataSetMetaDataType, subscribedDataSet ExtensionObject) StandaloneSubscribedDataSetDataTypeBuilder { + return b.WithName(name).WithDataSetFolder(dataSetFolder...).WithDataSetMetaData(dataSetMetaData).WithSubscribedDataSet(subscribedDataSet) +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithName(name PascalString) StandaloneSubscribedDataSetDataTypeBuilder { + b.Name = name + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) StandaloneSubscribedDataSetDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithDataSetFolder(dataSetFolder ...PascalString) StandaloneSubscribedDataSetDataTypeBuilder { + b.DataSetFolder = dataSetFolder + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithDataSetMetaData(dataSetMetaData DataSetMetaDataType) StandaloneSubscribedDataSetDataTypeBuilder { + b.DataSetMetaData = dataSetMetaData + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithDataSetMetaDataBuilder(builderSupplier func(DataSetMetaDataTypeBuilder) DataSetMetaDataTypeBuilder) StandaloneSubscribedDataSetDataTypeBuilder { + builder := builderSupplier(b.DataSetMetaData.CreateDataSetMetaDataTypeBuilder()) + var err error + b.DataSetMetaData, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "DataSetMetaDataTypeBuilder failed")) + } + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithSubscribedDataSet(subscribedDataSet ExtensionObject) StandaloneSubscribedDataSetDataTypeBuilder { + b.SubscribedDataSet = subscribedDataSet + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) WithSubscribedDataSetBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) StandaloneSubscribedDataSetDataTypeBuilder { + builder := builderSupplier(b.SubscribedDataSet.CreateExtensionObjectBuilder()) + var err error + b.SubscribedDataSet, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) Build() (StandaloneSubscribedDataSetDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.DataSetMetaData == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetMetaData' not set")) + } + if b.SubscribedDataSet == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'subscribedDataSet' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._StandaloneSubscribedDataSetDataType.deepCopy(), nil +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) MustBuild() StandaloneSubscribedDataSetDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_StandaloneSubscribedDataSetDataTypeBuilder) DeepCopy() any { + _copy := b.CreateStandaloneSubscribedDataSetDataTypeBuilder().(*_StandaloneSubscribedDataSetDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateStandaloneSubscribedDataSetDataTypeBuilder creates a StandaloneSubscribedDataSetDataTypeBuilder +func (b *_StandaloneSubscribedDataSetDataType) CreateStandaloneSubscribedDataSetDataTypeBuilder() StandaloneSubscribedDataSetDataTypeBuilder { + if b == nil { + return NewStandaloneSubscribedDataSetDataTypeBuilder() + } + return &_StandaloneSubscribedDataSetDataTypeBuilder{_StandaloneSubscribedDataSetDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_StandaloneSubscribedDataSetDataType) GetExtensionId() int32 { + return int32(23602) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_StandaloneSubscribedDataSetDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StandaloneSubscribedDataSetDataType) GetName() PascalString { + return m.Name +} + +func (m *_StandaloneSubscribedDataSetDataType) GetDataSetFolder() []PascalString { + return m.DataSetFolder +} + +func (m *_StandaloneSubscribedDataSetDataType) GetDataSetMetaData() DataSetMetaDataType { + return m.DataSetMetaData +} + +func (m *_StandaloneSubscribedDataSetDataType) GetSubscribedDataSet() ExtensionObject { + return m.SubscribedDataSet +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastStandaloneSubscribedDataSetDataType(structType any) StandaloneSubscribedDataSetDataType { + if casted, ok := structType.(StandaloneSubscribedDataSetDataType); ok { + return casted + } + if casted, ok := structType.(*StandaloneSubscribedDataSetDataType); ok { + return *casted + } + return nil +} + +func (m *_StandaloneSubscribedDataSetDataType) GetTypeName() string { + return "StandaloneSubscribedDataSetDataType" +} + +func (m *_StandaloneSubscribedDataSetDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Implicit Field (noOfDataSetFolder) + lengthInBits += 32 + + // Array field + if len(m.DataSetFolder) > 0 { + for _curItem, element := range m.DataSetFolder { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetFolder), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (dataSetMetaData) + lengthInBits += m.DataSetMetaData.GetLengthInBits(ctx) + + // Simple field (subscribedDataSet) + lengthInBits += m.SubscribedDataSet.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_StandaloneSubscribedDataSetDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_StandaloneSubscribedDataSetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__standaloneSubscribedDataSetDataType StandaloneSubscribedDataSetDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StandaloneSubscribedDataSetDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StandaloneSubscribedDataSetDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + noOfDataSetFolder, err := ReadImplicitField[int32](ctx, "noOfDataSetFolder", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetFolder' field")) + } + _ = noOfDataSetFolder + + dataSetFolder, err := ReadCountArrayField[PascalString](ctx, "dataSetFolder", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfDataSetFolder)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetFolder' field")) + } + m.DataSetFolder = dataSetFolder + + dataSetMetaData, err := ReadSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", ReadComplex[DataSetMetaDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetMetaDataType]((int32)(int32(14525))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMetaData' field")) + } + m.DataSetMetaData = dataSetMetaData + + subscribedDataSet, err := ReadSimpleField[ExtensionObject](ctx, "subscribedDataSet", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'subscribedDataSet' field")) + } + m.SubscribedDataSet = subscribedDataSet + + if closeErr := readBuffer.CloseContext("StandaloneSubscribedDataSetDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StandaloneSubscribedDataSetDataType") + } + + return m, nil +} + +func (m *_StandaloneSubscribedDataSetDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_StandaloneSubscribedDataSetDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("StandaloneSubscribedDataSetDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StandaloneSubscribedDataSetDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + noOfDataSetFolder := int32(utils.InlineIf(bool((m.GetDataSetFolder()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetFolder()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetFolder", noOfDataSetFolder, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetFolder' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetFolder", m.GetDataSetFolder(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetFolder' field") + } + + if err := WriteSimpleField[DataSetMetaDataType](ctx, "dataSetMetaData", m.GetDataSetMetaData(), WriteComplex[DataSetMetaDataType](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMetaData' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "subscribedDataSet", m.GetSubscribedDataSet(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'subscribedDataSet' field") + } + + if popErr := writeBuffer.PopContext("StandaloneSubscribedDataSetDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StandaloneSubscribedDataSetDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_StandaloneSubscribedDataSetDataType) IsStandaloneSubscribedDataSetDataType() {} + +func (m *_StandaloneSubscribedDataSetDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_StandaloneSubscribedDataSetDataType) deepCopy() *_StandaloneSubscribedDataSetDataType { + if m == nil { + return nil + } + _StandaloneSubscribedDataSetDataTypeCopy := &_StandaloneSubscribedDataSetDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Name.DeepCopy().(PascalString), + utils.DeepCopySlice[PascalString, PascalString](m.DataSetFolder), + m.DataSetMetaData.DeepCopy().(DataSetMetaDataType), + m.SubscribedDataSet.DeepCopy().(ExtensionObject), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _StandaloneSubscribedDataSetDataTypeCopy +} + +func (m *_StandaloneSubscribedDataSetDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetRefDataType.go b/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetRefDataType.go new file mode 100644 index 00000000000..e4768ccee48 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/StandaloneSubscribedDataSetRefDataType.go @@ -0,0 +1,330 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// StandaloneSubscribedDataSetRefDataType is the corresponding interface of StandaloneSubscribedDataSetRefDataType +type StandaloneSubscribedDataSetRefDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataSetName returns DataSetName (property field) + GetDataSetName() PascalString + // IsStandaloneSubscribedDataSetRefDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsStandaloneSubscribedDataSetRefDataType() + // CreateBuilder creates a StandaloneSubscribedDataSetRefDataTypeBuilder + CreateStandaloneSubscribedDataSetRefDataTypeBuilder() StandaloneSubscribedDataSetRefDataTypeBuilder +} + +// _StandaloneSubscribedDataSetRefDataType is the data-structure of this message +type _StandaloneSubscribedDataSetRefDataType struct { + ExtensionObjectDefinitionContract + DataSetName PascalString +} + +var _ StandaloneSubscribedDataSetRefDataType = (*_StandaloneSubscribedDataSetRefDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_StandaloneSubscribedDataSetRefDataType)(nil) + +// NewStandaloneSubscribedDataSetRefDataType factory function for _StandaloneSubscribedDataSetRefDataType +func NewStandaloneSubscribedDataSetRefDataType(dataSetName PascalString) *_StandaloneSubscribedDataSetRefDataType { + if dataSetName == nil { + panic("dataSetName of type PascalString for StandaloneSubscribedDataSetRefDataType must not be nil") + } + _result := &_StandaloneSubscribedDataSetRefDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataSetName: dataSetName, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// StandaloneSubscribedDataSetRefDataTypeBuilder is a builder for StandaloneSubscribedDataSetRefDataType +type StandaloneSubscribedDataSetRefDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataSetName PascalString) StandaloneSubscribedDataSetRefDataTypeBuilder + // WithDataSetName adds DataSetName (property field) + WithDataSetName(PascalString) StandaloneSubscribedDataSetRefDataTypeBuilder + // WithDataSetNameBuilder adds DataSetName (property field) which is build by the builder + WithDataSetNameBuilder(func(PascalStringBuilder) PascalStringBuilder) StandaloneSubscribedDataSetRefDataTypeBuilder + // Build builds the StandaloneSubscribedDataSetRefDataType or returns an error if something is wrong + Build() (StandaloneSubscribedDataSetRefDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() StandaloneSubscribedDataSetRefDataType +} + +// NewStandaloneSubscribedDataSetRefDataTypeBuilder() creates a StandaloneSubscribedDataSetRefDataTypeBuilder +func NewStandaloneSubscribedDataSetRefDataTypeBuilder() StandaloneSubscribedDataSetRefDataTypeBuilder { + return &_StandaloneSubscribedDataSetRefDataTypeBuilder{_StandaloneSubscribedDataSetRefDataType: new(_StandaloneSubscribedDataSetRefDataType)} +} + +type _StandaloneSubscribedDataSetRefDataTypeBuilder struct { + *_StandaloneSubscribedDataSetRefDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (StandaloneSubscribedDataSetRefDataTypeBuilder) = (*_StandaloneSubscribedDataSetRefDataTypeBuilder)(nil) + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) WithMandatoryFields(dataSetName PascalString) StandaloneSubscribedDataSetRefDataTypeBuilder { + return b.WithDataSetName(dataSetName) +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) WithDataSetName(dataSetName PascalString) StandaloneSubscribedDataSetRefDataTypeBuilder { + b.DataSetName = dataSetName + return b +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) WithDataSetNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) StandaloneSubscribedDataSetRefDataTypeBuilder { + builder := builderSupplier(b.DataSetName.CreatePascalStringBuilder()) + var err error + b.DataSetName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) Build() (StandaloneSubscribedDataSetRefDataType, error) { + if b.DataSetName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._StandaloneSubscribedDataSetRefDataType.deepCopy(), nil +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) MustBuild() StandaloneSubscribedDataSetRefDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_StandaloneSubscribedDataSetRefDataTypeBuilder) DeepCopy() any { + _copy := b.CreateStandaloneSubscribedDataSetRefDataTypeBuilder().(*_StandaloneSubscribedDataSetRefDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateStandaloneSubscribedDataSetRefDataTypeBuilder creates a StandaloneSubscribedDataSetRefDataTypeBuilder +func (b *_StandaloneSubscribedDataSetRefDataType) CreateStandaloneSubscribedDataSetRefDataTypeBuilder() StandaloneSubscribedDataSetRefDataTypeBuilder { + if b == nil { + return NewStandaloneSubscribedDataSetRefDataTypeBuilder() + } + return &_StandaloneSubscribedDataSetRefDataTypeBuilder{_StandaloneSubscribedDataSetRefDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_StandaloneSubscribedDataSetRefDataType) GetExtensionId() int32 { + return int32(23601) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_StandaloneSubscribedDataSetRefDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StandaloneSubscribedDataSetRefDataType) GetDataSetName() PascalString { + return m.DataSetName +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastStandaloneSubscribedDataSetRefDataType(structType any) StandaloneSubscribedDataSetRefDataType { + if casted, ok := structType.(StandaloneSubscribedDataSetRefDataType); ok { + return casted + } + if casted, ok := structType.(*StandaloneSubscribedDataSetRefDataType); ok { + return *casted + } + return nil +} + +func (m *_StandaloneSubscribedDataSetRefDataType) GetTypeName() string { + return "StandaloneSubscribedDataSetRefDataType" +} + +func (m *_StandaloneSubscribedDataSetRefDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataSetName) + lengthInBits += m.DataSetName.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_StandaloneSubscribedDataSetRefDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_StandaloneSubscribedDataSetRefDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__standaloneSubscribedDataSetRefDataType StandaloneSubscribedDataSetRefDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StandaloneSubscribedDataSetRefDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StandaloneSubscribedDataSetRefDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataSetName, err := ReadSimpleField[PascalString](ctx, "dataSetName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetName' field")) + } + m.DataSetName = dataSetName + + if closeErr := readBuffer.CloseContext("StandaloneSubscribedDataSetRefDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StandaloneSubscribedDataSetRefDataType") + } + + return m, nil +} + +func (m *_StandaloneSubscribedDataSetRefDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_StandaloneSubscribedDataSetRefDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("StandaloneSubscribedDataSetRefDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StandaloneSubscribedDataSetRefDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "dataSetName", m.GetDataSetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetName' field") + } + + if popErr := writeBuffer.PopContext("StandaloneSubscribedDataSetRefDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StandaloneSubscribedDataSetRefDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_StandaloneSubscribedDataSetRefDataType) IsStandaloneSubscribedDataSetRefDataType() {} + +func (m *_StandaloneSubscribedDataSetRefDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_StandaloneSubscribedDataSetRefDataType) deepCopy() *_StandaloneSubscribedDataSetRefDataType { + if m == nil { + return nil + } + _StandaloneSubscribedDataSetRefDataTypeCopy := &_StandaloneSubscribedDataSetRefDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataSetName.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _StandaloneSubscribedDataSetRefDataTypeCopy +} + +func (m *_StandaloneSubscribedDataSetRefDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/StaticHelper.go b/plc4go/protocols/opcua/readwrite/model/StaticHelper.go index 86c487662f2..3a62e71c984 100644 --- a/plc4go/protocols/opcua/readwrite/model/StaticHelper.go +++ b/plc4go/protocols/opcua/readwrite/model/StaticHelper.go @@ -21,6 +21,7 @@ package model import ( "context" + "strconv" ) func Utf8LengthToPascalLength(_ context.Context, stringValue string) int32 { @@ -33,3 +34,11 @@ func Utf8LengthToPascalLength(_ context.Context, stringValue string) int32 { func PascalLengthToUtf8Length(_ context.Context, slength int32) int32 { return max(slength, 0) } + +func ExtensionId(_ context.Context, expandedNodeId ExpandedNodeId) int32 { + nodeId, err := strconv.ParseUint(expandedNodeId.GetNodeId().GetIdentifier(), 10, 16) + if err != nil { + return -1 + } + return int32(nodeId) +} diff --git a/plc4go/protocols/opcua/readwrite/model/StatusChangeNotification.go b/plc4go/protocols/opcua/readwrite/model/StatusChangeNotification.go index 98fa1161de9..499e70247bd 100644 --- a/plc4go/protocols/opcua/readwrite/model/StatusChangeNotification.go +++ b/plc4go/protocols/opcua/readwrite/model/StatusChangeNotification.go @@ -222,8 +222,8 @@ func (b *_StatusChangeNotification) CreateStatusChangeNotificationBuilder() Stat /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_StatusChangeNotification) GetIdentifier() string { - return "820" +func (m *_StatusChangeNotification) GetExtensionId() int32 { + return int32(820) } /////////////////////// @@ -271,9 +271,6 @@ func (m *_StatusChangeNotification) GetTypeName() string { func (m *_StatusChangeNotification) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Implicit Field (notificationLength) - lengthInBits += 32 - // Simple field (status) lengthInBits += m.Status.GetLengthInBits(ctx) @@ -287,7 +284,7 @@ func (m *_StatusChangeNotification) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_StatusChangeNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__statusChangeNotification StatusChangeNotification, err error) { +func (m *_StatusChangeNotification) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__statusChangeNotification StatusChangeNotification, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -298,12 +295,6 @@ func (m *_StatusChangeNotification) parse(ctx context.Context, readBuffer utils. currentPos := positionAware.GetPos() _ = currentPos - notificationLength, err := ReadImplicitField[int32](ctx, "notificationLength", ReadSignedInt(readBuffer, uint8(32))) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'notificationLength' field")) - } - _ = notificationLength - status, err := ReadSimpleField[StatusCode](ctx, "status", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'status' field")) @@ -340,10 +331,6 @@ func (m *_StatusChangeNotification) SerializeWithWriteBuffer(ctx context.Context if pushErr := writeBuffer.PushContext("StatusChangeNotification"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for StatusChangeNotification") } - notificationLength := int32(int32(m.GetLengthInBytes(ctx))) - if err := WriteImplicitField(ctx, "notificationLength", notificationLength, WriteSignedInt(writeBuffer, 32)); err != nil { - return errors.Wrap(err, "Error serializing 'notificationLength' field") - } if err := WriteSimpleField[StatusCode](ctx, "status", m.GetStatus(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'status' field") diff --git a/plc4go/protocols/opcua/readwrite/model/StatusResult.go b/plc4go/protocols/opcua/readwrite/model/StatusResult.go index 005acda8640..6be3309256c 100644 --- a/plc4go/protocols/opcua/readwrite/model/StatusResult.go +++ b/plc4go/protocols/opcua/readwrite/model/StatusResult.go @@ -222,8 +222,8 @@ func (b *_StatusResult) CreateStatusResultBuilder() StatusResultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_StatusResult) GetIdentifier() string { - return "301" +func (m *_StatusResult) GetExtensionId() int32 { + return int32(301) } /////////////////////// @@ -284,7 +284,7 @@ func (m *_StatusResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_StatusResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__statusResult StatusResult, err error) { +func (m *_StatusResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__statusResult StatusResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/StructureDefinition.go b/plc4go/protocols/opcua/readwrite/model/StructureDefinition.go new file mode 100644 index 00000000000..cba34d4a496 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/StructureDefinition.go @@ -0,0 +1,461 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// StructureDefinition is the corresponding interface of StructureDefinition +type StructureDefinition interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDefaultEncodingId returns DefaultEncodingId (property field) + GetDefaultEncodingId() NodeId + // GetBaseDataType returns BaseDataType (property field) + GetBaseDataType() NodeId + // GetStructureType returns StructureType (property field) + GetStructureType() StructureType + // GetFields returns Fields (property field) + GetFields() []StructureField + // IsStructureDefinition is a marker method to prevent unintentional type checks (interfaces of same signature) + IsStructureDefinition() + // CreateBuilder creates a StructureDefinitionBuilder + CreateStructureDefinitionBuilder() StructureDefinitionBuilder +} + +// _StructureDefinition is the data-structure of this message +type _StructureDefinition struct { + ExtensionObjectDefinitionContract + DefaultEncodingId NodeId + BaseDataType NodeId + StructureType StructureType + Fields []StructureField +} + +var _ StructureDefinition = (*_StructureDefinition)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_StructureDefinition)(nil) + +// NewStructureDefinition factory function for _StructureDefinition +func NewStructureDefinition(defaultEncodingId NodeId, baseDataType NodeId, structureType StructureType, fields []StructureField) *_StructureDefinition { + if defaultEncodingId == nil { + panic("defaultEncodingId of type NodeId for StructureDefinition must not be nil") + } + if baseDataType == nil { + panic("baseDataType of type NodeId for StructureDefinition must not be nil") + } + _result := &_StructureDefinition{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DefaultEncodingId: defaultEncodingId, + BaseDataType: baseDataType, + StructureType: structureType, + Fields: fields, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// StructureDefinitionBuilder is a builder for StructureDefinition +type StructureDefinitionBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(defaultEncodingId NodeId, baseDataType NodeId, structureType StructureType, fields []StructureField) StructureDefinitionBuilder + // WithDefaultEncodingId adds DefaultEncodingId (property field) + WithDefaultEncodingId(NodeId) StructureDefinitionBuilder + // WithDefaultEncodingIdBuilder adds DefaultEncodingId (property field) which is build by the builder + WithDefaultEncodingIdBuilder(func(NodeIdBuilder) NodeIdBuilder) StructureDefinitionBuilder + // WithBaseDataType adds BaseDataType (property field) + WithBaseDataType(NodeId) StructureDefinitionBuilder + // WithBaseDataTypeBuilder adds BaseDataType (property field) which is build by the builder + WithBaseDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) StructureDefinitionBuilder + // WithStructureType adds StructureType (property field) + WithStructureType(StructureType) StructureDefinitionBuilder + // WithFields adds Fields (property field) + WithFields(...StructureField) StructureDefinitionBuilder + // Build builds the StructureDefinition or returns an error if something is wrong + Build() (StructureDefinition, error) + // MustBuild does the same as Build but panics on error + MustBuild() StructureDefinition +} + +// NewStructureDefinitionBuilder() creates a StructureDefinitionBuilder +func NewStructureDefinitionBuilder() StructureDefinitionBuilder { + return &_StructureDefinitionBuilder{_StructureDefinition: new(_StructureDefinition)} +} + +type _StructureDefinitionBuilder struct { + *_StructureDefinition + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (StructureDefinitionBuilder) = (*_StructureDefinitionBuilder)(nil) + +func (b *_StructureDefinitionBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_StructureDefinitionBuilder) WithMandatoryFields(defaultEncodingId NodeId, baseDataType NodeId, structureType StructureType, fields []StructureField) StructureDefinitionBuilder { + return b.WithDefaultEncodingId(defaultEncodingId).WithBaseDataType(baseDataType).WithStructureType(structureType).WithFields(fields...) +} + +func (b *_StructureDefinitionBuilder) WithDefaultEncodingId(defaultEncodingId NodeId) StructureDefinitionBuilder { + b.DefaultEncodingId = defaultEncodingId + return b +} + +func (b *_StructureDefinitionBuilder) WithDefaultEncodingIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) StructureDefinitionBuilder { + builder := builderSupplier(b.DefaultEncodingId.CreateNodeIdBuilder()) + var err error + b.DefaultEncodingId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_StructureDefinitionBuilder) WithBaseDataType(baseDataType NodeId) StructureDefinitionBuilder { + b.BaseDataType = baseDataType + return b +} + +func (b *_StructureDefinitionBuilder) WithBaseDataTypeBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) StructureDefinitionBuilder { + builder := builderSupplier(b.BaseDataType.CreateNodeIdBuilder()) + var err error + b.BaseDataType, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_StructureDefinitionBuilder) WithStructureType(structureType StructureType) StructureDefinitionBuilder { + b.StructureType = structureType + return b +} + +func (b *_StructureDefinitionBuilder) WithFields(fields ...StructureField) StructureDefinitionBuilder { + b.Fields = fields + return b +} + +func (b *_StructureDefinitionBuilder) Build() (StructureDefinition, error) { + if b.DefaultEncodingId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'defaultEncodingId' not set")) + } + if b.BaseDataType == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'baseDataType' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._StructureDefinition.deepCopy(), nil +} + +func (b *_StructureDefinitionBuilder) MustBuild() StructureDefinition { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_StructureDefinitionBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_StructureDefinitionBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_StructureDefinitionBuilder) DeepCopy() any { + _copy := b.CreateStructureDefinitionBuilder().(*_StructureDefinitionBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateStructureDefinitionBuilder creates a StructureDefinitionBuilder +func (b *_StructureDefinition) CreateStructureDefinitionBuilder() StructureDefinitionBuilder { + if b == nil { + return NewStructureDefinitionBuilder() + } + return &_StructureDefinitionBuilder{_StructureDefinition: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_StructureDefinition) GetExtensionId() int32 { + return int32(101) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_StructureDefinition) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StructureDefinition) GetDefaultEncodingId() NodeId { + return m.DefaultEncodingId +} + +func (m *_StructureDefinition) GetBaseDataType() NodeId { + return m.BaseDataType +} + +func (m *_StructureDefinition) GetStructureType() StructureType { + return m.StructureType +} + +func (m *_StructureDefinition) GetFields() []StructureField { + return m.Fields +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastStructureDefinition(structType any) StructureDefinition { + if casted, ok := structType.(StructureDefinition); ok { + return casted + } + if casted, ok := structType.(*StructureDefinition); ok { + return *casted + } + return nil +} + +func (m *_StructureDefinition) GetTypeName() string { + return "StructureDefinition" +} + +func (m *_StructureDefinition) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (defaultEncodingId) + lengthInBits += m.DefaultEncodingId.GetLengthInBits(ctx) + + // Simple field (baseDataType) + lengthInBits += m.BaseDataType.GetLengthInBits(ctx) + + // Simple field (structureType) + lengthInBits += 32 + + // Implicit Field (noOfFields) + lengthInBits += 32 + + // Array field + if len(m.Fields) > 0 { + for _curItem, element := range m.Fields { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Fields), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_StructureDefinition) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_StructureDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__structureDefinition StructureDefinition, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StructureDefinition"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StructureDefinition") + } + currentPos := positionAware.GetPos() + _ = currentPos + + defaultEncodingId, err := ReadSimpleField[NodeId](ctx, "defaultEncodingId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'defaultEncodingId' field")) + } + m.DefaultEncodingId = defaultEncodingId + + baseDataType, err := ReadSimpleField[NodeId](ctx, "baseDataType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'baseDataType' field")) + } + m.BaseDataType = baseDataType + + structureType, err := ReadEnumField[StructureType](ctx, "structureType", "StructureType", ReadEnum(StructureTypeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'structureType' field")) + } + m.StructureType = structureType + + noOfFields, err := ReadImplicitField[int32](ctx, "noOfFields", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfFields' field")) + } + _ = noOfFields + + fields, err := ReadCountArrayField[StructureField](ctx, "fields", ReadComplex[StructureField](ExtensionObjectDefinitionParseWithBufferProducer[StructureField]((int32)(int32(103))), readBuffer), uint64(noOfFields)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'fields' field")) + } + m.Fields = fields + + if closeErr := readBuffer.CloseContext("StructureDefinition"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StructureDefinition") + } + + return m, nil +} + +func (m *_StructureDefinition) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_StructureDefinition) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("StructureDefinition"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StructureDefinition") + } + + if err := WriteSimpleField[NodeId](ctx, "defaultEncodingId", m.GetDefaultEncodingId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'defaultEncodingId' field") + } + + if err := WriteSimpleField[NodeId](ctx, "baseDataType", m.GetBaseDataType(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'baseDataType' field") + } + + if err := WriteSimpleEnumField[StructureType](ctx, "structureType", "StructureType", m.GetStructureType(), WriteEnum[StructureType, uint32](StructureType.GetValue, StructureType.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'structureType' field") + } + noOfFields := int32(utils.InlineIf(bool((m.GetFields()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetFields()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfFields", noOfFields, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfFields' field") + } + + if err := WriteComplexTypeArrayField(ctx, "fields", m.GetFields(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'fields' field") + } + + if popErr := writeBuffer.PopContext("StructureDefinition"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StructureDefinition") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_StructureDefinition) IsStructureDefinition() {} + +func (m *_StructureDefinition) DeepCopy() any { + return m.deepCopy() +} + +func (m *_StructureDefinition) deepCopy() *_StructureDefinition { + if m == nil { + return nil + } + _StructureDefinitionCopy := &_StructureDefinition{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DefaultEncodingId.DeepCopy().(NodeId), + m.BaseDataType.DeepCopy().(NodeId), + m.StructureType, + utils.DeepCopySlice[StructureField, StructureField](m.Fields), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _StructureDefinitionCopy +} + +func (m *_StructureDefinition) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/StructureDescription.go b/plc4go/protocols/opcua/readwrite/model/StructureDescription.go new file mode 100644 index 00000000000..27a36e30643 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/StructureDescription.go @@ -0,0 +1,436 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// StructureDescription is the corresponding interface of StructureDescription +type StructureDescription interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataTypeId returns DataTypeId (property field) + GetDataTypeId() NodeId + // GetName returns Name (property field) + GetName() QualifiedName + // GetStructureDefinition returns StructureDefinition (property field) + GetStructureDefinition() StructureDefinition + // IsStructureDescription is a marker method to prevent unintentional type checks (interfaces of same signature) + IsStructureDescription() + // CreateBuilder creates a StructureDescriptionBuilder + CreateStructureDescriptionBuilder() StructureDescriptionBuilder +} + +// _StructureDescription is the data-structure of this message +type _StructureDescription struct { + ExtensionObjectDefinitionContract + DataTypeId NodeId + Name QualifiedName + StructureDefinition StructureDefinition +} + +var _ StructureDescription = (*_StructureDescription)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_StructureDescription)(nil) + +// NewStructureDescription factory function for _StructureDescription +func NewStructureDescription(dataTypeId NodeId, name QualifiedName, structureDefinition StructureDefinition) *_StructureDescription { + if dataTypeId == nil { + panic("dataTypeId of type NodeId for StructureDescription must not be nil") + } + if name == nil { + panic("name of type QualifiedName for StructureDescription must not be nil") + } + if structureDefinition == nil { + panic("structureDefinition of type StructureDefinition for StructureDescription must not be nil") + } + _result := &_StructureDescription{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataTypeId: dataTypeId, + Name: name, + StructureDefinition: structureDefinition, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// StructureDescriptionBuilder is a builder for StructureDescription +type StructureDescriptionBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataTypeId NodeId, name QualifiedName, structureDefinition StructureDefinition) StructureDescriptionBuilder + // WithDataTypeId adds DataTypeId (property field) + WithDataTypeId(NodeId) StructureDescriptionBuilder + // WithDataTypeIdBuilder adds DataTypeId (property field) which is build by the builder + WithDataTypeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) StructureDescriptionBuilder + // WithName adds Name (property field) + WithName(QualifiedName) StructureDescriptionBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(QualifiedNameBuilder) QualifiedNameBuilder) StructureDescriptionBuilder + // WithStructureDefinition adds StructureDefinition (property field) + WithStructureDefinition(StructureDefinition) StructureDescriptionBuilder + // WithStructureDefinitionBuilder adds StructureDefinition (property field) which is build by the builder + WithStructureDefinitionBuilder(func(StructureDefinitionBuilder) StructureDefinitionBuilder) StructureDescriptionBuilder + // Build builds the StructureDescription or returns an error if something is wrong + Build() (StructureDescription, error) + // MustBuild does the same as Build but panics on error + MustBuild() StructureDescription +} + +// NewStructureDescriptionBuilder() creates a StructureDescriptionBuilder +func NewStructureDescriptionBuilder() StructureDescriptionBuilder { + return &_StructureDescriptionBuilder{_StructureDescription: new(_StructureDescription)} +} + +type _StructureDescriptionBuilder struct { + *_StructureDescription + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (StructureDescriptionBuilder) = (*_StructureDescriptionBuilder)(nil) + +func (b *_StructureDescriptionBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_StructureDescriptionBuilder) WithMandatoryFields(dataTypeId NodeId, name QualifiedName, structureDefinition StructureDefinition) StructureDescriptionBuilder { + return b.WithDataTypeId(dataTypeId).WithName(name).WithStructureDefinition(structureDefinition) +} + +func (b *_StructureDescriptionBuilder) WithDataTypeId(dataTypeId NodeId) StructureDescriptionBuilder { + b.DataTypeId = dataTypeId + return b +} + +func (b *_StructureDescriptionBuilder) WithDataTypeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) StructureDescriptionBuilder { + builder := builderSupplier(b.DataTypeId.CreateNodeIdBuilder()) + var err error + b.DataTypeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_StructureDescriptionBuilder) WithName(name QualifiedName) StructureDescriptionBuilder { + b.Name = name + return b +} + +func (b *_StructureDescriptionBuilder) WithNameBuilder(builderSupplier func(QualifiedNameBuilder) QualifiedNameBuilder) StructureDescriptionBuilder { + builder := builderSupplier(b.Name.CreateQualifiedNameBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "QualifiedNameBuilder failed")) + } + return b +} + +func (b *_StructureDescriptionBuilder) WithStructureDefinition(structureDefinition StructureDefinition) StructureDescriptionBuilder { + b.StructureDefinition = structureDefinition + return b +} + +func (b *_StructureDescriptionBuilder) WithStructureDefinitionBuilder(builderSupplier func(StructureDefinitionBuilder) StructureDefinitionBuilder) StructureDescriptionBuilder { + builder := builderSupplier(b.StructureDefinition.CreateStructureDefinitionBuilder()) + var err error + b.StructureDefinition, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "StructureDefinitionBuilder failed")) + } + return b +} + +func (b *_StructureDescriptionBuilder) Build() (StructureDescription, error) { + if b.DataTypeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataTypeId' not set")) + } + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.StructureDefinition == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'structureDefinition' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._StructureDescription.deepCopy(), nil +} + +func (b *_StructureDescriptionBuilder) MustBuild() StructureDescription { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_StructureDescriptionBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_StructureDescriptionBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_StructureDescriptionBuilder) DeepCopy() any { + _copy := b.CreateStructureDescriptionBuilder().(*_StructureDescriptionBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateStructureDescriptionBuilder creates a StructureDescriptionBuilder +func (b *_StructureDescription) CreateStructureDescriptionBuilder() StructureDescriptionBuilder { + if b == nil { + return NewStructureDescriptionBuilder() + } + return &_StructureDescriptionBuilder{_StructureDescription: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_StructureDescription) GetExtensionId() int32 { + return int32(15489) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_StructureDescription) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StructureDescription) GetDataTypeId() NodeId { + return m.DataTypeId +} + +func (m *_StructureDescription) GetName() QualifiedName { + return m.Name +} + +func (m *_StructureDescription) GetStructureDefinition() StructureDefinition { + return m.StructureDefinition +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastStructureDescription(structType any) StructureDescription { + if casted, ok := structType.(StructureDescription); ok { + return casted + } + if casted, ok := structType.(*StructureDescription); ok { + return *casted + } + return nil +} + +func (m *_StructureDescription) GetTypeName() string { + return "StructureDescription" +} + +func (m *_StructureDescription) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataTypeId) + lengthInBits += m.DataTypeId.GetLengthInBits(ctx) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Simple field (structureDefinition) + lengthInBits += m.StructureDefinition.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_StructureDescription) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_StructureDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__structureDescription StructureDescription, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StructureDescription"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StructureDescription") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataTypeId, err := ReadSimpleField[NodeId](ctx, "dataTypeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataTypeId' field")) + } + m.DataTypeId = dataTypeId + + name, err := ReadSimpleField[QualifiedName](ctx, "name", ReadComplex[QualifiedName](QualifiedNameParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + structureDefinition, err := ReadSimpleField[StructureDefinition](ctx, "structureDefinition", ReadComplex[StructureDefinition](ExtensionObjectDefinitionParseWithBufferProducer[StructureDefinition]((int32)(int32(101))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'structureDefinition' field")) + } + m.StructureDefinition = structureDefinition + + if closeErr := readBuffer.CloseContext("StructureDescription"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StructureDescription") + } + + return m, nil +} + +func (m *_StructureDescription) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_StructureDescription) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("StructureDescription"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StructureDescription") + } + + if err := WriteSimpleField[NodeId](ctx, "dataTypeId", m.GetDataTypeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataTypeId' field") + } + + if err := WriteSimpleField[QualifiedName](ctx, "name", m.GetName(), WriteComplex[QualifiedName](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteSimpleField[StructureDefinition](ctx, "structureDefinition", m.GetStructureDefinition(), WriteComplex[StructureDefinition](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'structureDefinition' field") + } + + if popErr := writeBuffer.PopContext("StructureDescription"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StructureDescription") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_StructureDescription) IsStructureDescription() {} + +func (m *_StructureDescription) DeepCopy() any { + return m.deepCopy() +} + +func (m *_StructureDescription) deepCopy() *_StructureDescription { + if m == nil { + return nil + } + _StructureDescriptionCopy := &_StructureDescription{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataTypeId.DeepCopy().(NodeId), + m.Name.DeepCopy().(QualifiedName), + m.StructureDefinition.DeepCopy().(StructureDefinition), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _StructureDescriptionCopy +} + +func (m *_StructureDescription) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/StructureField.go b/plc4go/protocols/opcua/readwrite/model/StructureField.go index 1336303fef8..cfe86a76209 100644 --- a/plc4go/protocols/opcua/readwrite/model/StructureField.go +++ b/plc4go/protocols/opcua/readwrite/model/StructureField.go @@ -48,8 +48,6 @@ type StructureField interface { GetDataType() NodeId // GetValueRank returns ValueRank (property field) GetValueRank() int32 - // GetNoOfArrayDimensions returns NoOfArrayDimensions (property field) - GetNoOfArrayDimensions() int32 // GetArrayDimensions returns ArrayDimensions (property field) GetArrayDimensions() []uint32 // GetMaxStringLength returns MaxStringLength (property field) @@ -65,14 +63,13 @@ type StructureField interface { // _StructureField is the data-structure of this message type _StructureField struct { ExtensionObjectDefinitionContract - Name PascalString - Description LocalizedText - DataType NodeId - ValueRank int32 - NoOfArrayDimensions int32 - ArrayDimensions []uint32 - MaxStringLength uint32 - IsOptional bool + Name PascalString + Description LocalizedText + DataType NodeId + ValueRank int32 + ArrayDimensions []uint32 + MaxStringLength uint32 + IsOptional bool // Reserved Fields reservedField0 *uint8 } @@ -81,7 +78,7 @@ var _ StructureField = (*_StructureField)(nil) var _ ExtensionObjectDefinitionRequirements = (*_StructureField)(nil) // NewStructureField factory function for _StructureField -func NewStructureField(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) *_StructureField { +func NewStructureField(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) *_StructureField { if name == nil { panic("name of type PascalString for StructureField must not be nil") } @@ -97,7 +94,6 @@ func NewStructureField(name PascalString, description LocalizedText, dataType No Description: description, DataType: dataType, ValueRank: valueRank, - NoOfArrayDimensions: noOfArrayDimensions, ArrayDimensions: arrayDimensions, MaxStringLength: maxStringLength, IsOptional: isOptional, @@ -115,7 +111,7 @@ func NewStructureField(name PascalString, description LocalizedText, dataType No type StructureFieldBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) StructureFieldBuilder + WithMandatoryFields(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) StructureFieldBuilder // WithName adds Name (property field) WithName(PascalString) StructureFieldBuilder // WithNameBuilder adds Name (property field) which is build by the builder @@ -130,8 +126,6 @@ type StructureFieldBuilder interface { WithDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) StructureFieldBuilder // WithValueRank adds ValueRank (property field) WithValueRank(int32) StructureFieldBuilder - // WithNoOfArrayDimensions adds NoOfArrayDimensions (property field) - WithNoOfArrayDimensions(int32) StructureFieldBuilder // WithArrayDimensions adds ArrayDimensions (property field) WithArrayDimensions(...uint32) StructureFieldBuilder // WithMaxStringLength adds MaxStringLength (property field) @@ -163,8 +157,8 @@ func (b *_StructureFieldBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_StructureFieldBuilder) WithMandatoryFields(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, noOfArrayDimensions int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) StructureFieldBuilder { - return b.WithName(name).WithDescription(description).WithDataType(dataType).WithValueRank(valueRank).WithNoOfArrayDimensions(noOfArrayDimensions).WithArrayDimensions(arrayDimensions...).WithMaxStringLength(maxStringLength).WithIsOptional(isOptional) +func (b *_StructureFieldBuilder) WithMandatoryFields(name PascalString, description LocalizedText, dataType NodeId, valueRank int32, arrayDimensions []uint32, maxStringLength uint32, isOptional bool) StructureFieldBuilder { + return b.WithName(name).WithDescription(description).WithDataType(dataType).WithValueRank(valueRank).WithArrayDimensions(arrayDimensions...).WithMaxStringLength(maxStringLength).WithIsOptional(isOptional) } func (b *_StructureFieldBuilder) WithName(name PascalString) StructureFieldBuilder { @@ -226,11 +220,6 @@ func (b *_StructureFieldBuilder) WithValueRank(valueRank int32) StructureFieldBu return b } -func (b *_StructureFieldBuilder) WithNoOfArrayDimensions(noOfArrayDimensions int32) StructureFieldBuilder { - b.NoOfArrayDimensions = noOfArrayDimensions - return b -} - func (b *_StructureFieldBuilder) WithArrayDimensions(arrayDimensions ...uint32) StructureFieldBuilder { b.ArrayDimensions = arrayDimensions return b @@ -314,8 +303,8 @@ func (b *_StructureField) CreateStructureFieldBuilder() StructureFieldBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_StructureField) GetIdentifier() string { - return "103" +func (m *_StructureField) GetExtensionId() int32 { + return int32(103) } /////////////////////// @@ -348,10 +337,6 @@ func (m *_StructureField) GetValueRank() int32 { return m.ValueRank } -func (m *_StructureField) GetNoOfArrayDimensions() int32 { - return m.NoOfArrayDimensions -} - func (m *_StructureField) GetArrayDimensions() []uint32 { return m.ArrayDimensions } @@ -399,7 +384,7 @@ func (m *_StructureField) GetLengthInBits(ctx context.Context) uint16 { // Simple field (valueRank) lengthInBits += 32 - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32 // Array field @@ -423,7 +408,7 @@ func (m *_StructureField) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_StructureField) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__structureField StructureField, err error) { +func (m *_StructureField) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__structureField StructureField, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -458,11 +443,11 @@ func (m *_StructureField) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.ValueRank = valueRank - noOfArrayDimensions, err := ReadSimpleField(ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) + noOfArrayDimensions, err := ReadImplicitField[int32](ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfArrayDimensions' field")) } - m.NoOfArrayDimensions = noOfArrayDimensions + _ = noOfArrayDimensions arrayDimensions, err := ReadCountArrayField[uint32](ctx, "arrayDimensions", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfArrayDimensions)) if err != nil { @@ -528,8 +513,8 @@ func (m *_StructureField) SerializeWithWriteBuffer(ctx context.Context, writeBuf if err := WriteSimpleField[int32](ctx, "valueRank", m.GetValueRank(), WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'valueRank' field") } - - if err := WriteSimpleField[int32](ctx, "noOfArrayDimensions", m.GetNoOfArrayDimensions(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfArrayDimensions := int32(utils.InlineIf(bool((m.GetArrayDimensions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetArrayDimensions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfArrayDimensions", noOfArrayDimensions, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfArrayDimensions' field") } @@ -573,7 +558,6 @@ func (m *_StructureField) deepCopy() *_StructureField { m.Description.DeepCopy().(LocalizedText), m.DataType.DeepCopy().(NodeId), m.ValueRank, - m.NoOfArrayDimensions, utils.DeepCopySlice[uint32, uint32](m.ArrayDimensions), m.MaxStringLength, m.IsOptional, diff --git a/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetDataType.go b/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetDataType.go index ff69c0da6b2..60988e1be83 100644 --- a/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetDataType.go @@ -150,8 +150,8 @@ func (b *_SubscribedDataSetDataType) CreateSubscribedDataSetDataTypeBuilder() Su /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SubscribedDataSetDataType) GetIdentifier() string { - return "15632" +func (m *_SubscribedDataSetDataType) GetExtensionId() int32 { + return int32(15632) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_SubscribedDataSetDataType) GetLengthInBytes(ctx context.Context) uint1 return m.GetLengthInBits(ctx) / 8 } -func (m *_SubscribedDataSetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__subscribedDataSetDataType SubscribedDataSetDataType, err error) { +func (m *_SubscribedDataSetDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__subscribedDataSetDataType SubscribedDataSetDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetMirrorDataType.go b/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetMirrorDataType.go new file mode 100644 index 00000000000..de63a8b20bf --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/SubscribedDataSetMirrorDataType.go @@ -0,0 +1,379 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SubscribedDataSetMirrorDataType is the corresponding interface of SubscribedDataSetMirrorDataType +type SubscribedDataSetMirrorDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetParentNodeName returns ParentNodeName (property field) + GetParentNodeName() PascalString + // GetRolePermissions returns RolePermissions (property field) + GetRolePermissions() []RolePermissionType + // IsSubscribedDataSetMirrorDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsSubscribedDataSetMirrorDataType() + // CreateBuilder creates a SubscribedDataSetMirrorDataTypeBuilder + CreateSubscribedDataSetMirrorDataTypeBuilder() SubscribedDataSetMirrorDataTypeBuilder +} + +// _SubscribedDataSetMirrorDataType is the data-structure of this message +type _SubscribedDataSetMirrorDataType struct { + ExtensionObjectDefinitionContract + ParentNodeName PascalString + RolePermissions []RolePermissionType +} + +var _ SubscribedDataSetMirrorDataType = (*_SubscribedDataSetMirrorDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_SubscribedDataSetMirrorDataType)(nil) + +// NewSubscribedDataSetMirrorDataType factory function for _SubscribedDataSetMirrorDataType +func NewSubscribedDataSetMirrorDataType(parentNodeName PascalString, rolePermissions []RolePermissionType) *_SubscribedDataSetMirrorDataType { + if parentNodeName == nil { + panic("parentNodeName of type PascalString for SubscribedDataSetMirrorDataType must not be nil") + } + _result := &_SubscribedDataSetMirrorDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + ParentNodeName: parentNodeName, + RolePermissions: rolePermissions, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// SubscribedDataSetMirrorDataTypeBuilder is a builder for SubscribedDataSetMirrorDataType +type SubscribedDataSetMirrorDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(parentNodeName PascalString, rolePermissions []RolePermissionType) SubscribedDataSetMirrorDataTypeBuilder + // WithParentNodeName adds ParentNodeName (property field) + WithParentNodeName(PascalString) SubscribedDataSetMirrorDataTypeBuilder + // WithParentNodeNameBuilder adds ParentNodeName (property field) which is build by the builder + WithParentNodeNameBuilder(func(PascalStringBuilder) PascalStringBuilder) SubscribedDataSetMirrorDataTypeBuilder + // WithRolePermissions adds RolePermissions (property field) + WithRolePermissions(...RolePermissionType) SubscribedDataSetMirrorDataTypeBuilder + // Build builds the SubscribedDataSetMirrorDataType or returns an error if something is wrong + Build() (SubscribedDataSetMirrorDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() SubscribedDataSetMirrorDataType +} + +// NewSubscribedDataSetMirrorDataTypeBuilder() creates a SubscribedDataSetMirrorDataTypeBuilder +func NewSubscribedDataSetMirrorDataTypeBuilder() SubscribedDataSetMirrorDataTypeBuilder { + return &_SubscribedDataSetMirrorDataTypeBuilder{_SubscribedDataSetMirrorDataType: new(_SubscribedDataSetMirrorDataType)} +} + +type _SubscribedDataSetMirrorDataTypeBuilder struct { + *_SubscribedDataSetMirrorDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (SubscribedDataSetMirrorDataTypeBuilder) = (*_SubscribedDataSetMirrorDataTypeBuilder)(nil) + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) WithMandatoryFields(parentNodeName PascalString, rolePermissions []RolePermissionType) SubscribedDataSetMirrorDataTypeBuilder { + return b.WithParentNodeName(parentNodeName).WithRolePermissions(rolePermissions...) +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) WithParentNodeName(parentNodeName PascalString) SubscribedDataSetMirrorDataTypeBuilder { + b.ParentNodeName = parentNodeName + return b +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) WithParentNodeNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) SubscribedDataSetMirrorDataTypeBuilder { + builder := builderSupplier(b.ParentNodeName.CreatePascalStringBuilder()) + var err error + b.ParentNodeName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) WithRolePermissions(rolePermissions ...RolePermissionType) SubscribedDataSetMirrorDataTypeBuilder { + b.RolePermissions = rolePermissions + return b +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) Build() (SubscribedDataSetMirrorDataType, error) { + if b.ParentNodeName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'parentNodeName' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._SubscribedDataSetMirrorDataType.deepCopy(), nil +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) MustBuild() SubscribedDataSetMirrorDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_SubscribedDataSetMirrorDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_SubscribedDataSetMirrorDataTypeBuilder) DeepCopy() any { + _copy := b.CreateSubscribedDataSetMirrorDataTypeBuilder().(*_SubscribedDataSetMirrorDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateSubscribedDataSetMirrorDataTypeBuilder creates a SubscribedDataSetMirrorDataTypeBuilder +func (b *_SubscribedDataSetMirrorDataType) CreateSubscribedDataSetMirrorDataTypeBuilder() SubscribedDataSetMirrorDataTypeBuilder { + if b == nil { + return NewSubscribedDataSetMirrorDataTypeBuilder() + } + return &_SubscribedDataSetMirrorDataTypeBuilder{_SubscribedDataSetMirrorDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_SubscribedDataSetMirrorDataType) GetExtensionId() int32 { + return int32(15637) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_SubscribedDataSetMirrorDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_SubscribedDataSetMirrorDataType) GetParentNodeName() PascalString { + return m.ParentNodeName +} + +func (m *_SubscribedDataSetMirrorDataType) GetRolePermissions() []RolePermissionType { + return m.RolePermissions +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastSubscribedDataSetMirrorDataType(structType any) SubscribedDataSetMirrorDataType { + if casted, ok := structType.(SubscribedDataSetMirrorDataType); ok { + return casted + } + if casted, ok := structType.(*SubscribedDataSetMirrorDataType); ok { + return *casted + } + return nil +} + +func (m *_SubscribedDataSetMirrorDataType) GetTypeName() string { + return "SubscribedDataSetMirrorDataType" +} + +func (m *_SubscribedDataSetMirrorDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (parentNodeName) + lengthInBits += m.ParentNodeName.GetLengthInBits(ctx) + + // Implicit Field (noOfRolePermissions) + lengthInBits += 32 + + // Array field + if len(m.RolePermissions) > 0 { + for _curItem, element := range m.RolePermissions { + arrayCtx := utils.CreateArrayContext(ctx, len(m.RolePermissions), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_SubscribedDataSetMirrorDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_SubscribedDataSetMirrorDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__subscribedDataSetMirrorDataType SubscribedDataSetMirrorDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("SubscribedDataSetMirrorDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for SubscribedDataSetMirrorDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + parentNodeName, err := ReadSimpleField[PascalString](ctx, "parentNodeName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'parentNodeName' field")) + } + m.ParentNodeName = parentNodeName + + noOfRolePermissions, err := ReadImplicitField[int32](ctx, "noOfRolePermissions", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfRolePermissions' field")) + } + _ = noOfRolePermissions + + rolePermissions, err := ReadCountArrayField[RolePermissionType](ctx, "rolePermissions", ReadComplex[RolePermissionType](ExtensionObjectDefinitionParseWithBufferProducer[RolePermissionType]((int32)(int32(98))), readBuffer), uint64(noOfRolePermissions)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'rolePermissions' field")) + } + m.RolePermissions = rolePermissions + + if closeErr := readBuffer.CloseContext("SubscribedDataSetMirrorDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for SubscribedDataSetMirrorDataType") + } + + return m, nil +} + +func (m *_SubscribedDataSetMirrorDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_SubscribedDataSetMirrorDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("SubscribedDataSetMirrorDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for SubscribedDataSetMirrorDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "parentNodeName", m.GetParentNodeName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'parentNodeName' field") + } + noOfRolePermissions := int32(utils.InlineIf(bool((m.GetRolePermissions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetRolePermissions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfRolePermissions", noOfRolePermissions, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfRolePermissions' field") + } + + if err := WriteComplexTypeArrayField(ctx, "rolePermissions", m.GetRolePermissions(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'rolePermissions' field") + } + + if popErr := writeBuffer.PopContext("SubscribedDataSetMirrorDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for SubscribedDataSetMirrorDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_SubscribedDataSetMirrorDataType) IsSubscribedDataSetMirrorDataType() {} + +func (m *_SubscribedDataSetMirrorDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_SubscribedDataSetMirrorDataType) deepCopy() *_SubscribedDataSetMirrorDataType { + if m == nil { + return nil + } + _SubscribedDataSetMirrorDataTypeCopy := &_SubscribedDataSetMirrorDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.ParentNodeName.DeepCopy().(PascalString), + utils.DeepCopySlice[RolePermissionType, RolePermissionType](m.RolePermissions), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _SubscribedDataSetMirrorDataTypeCopy +} + +func (m *_SubscribedDataSetMirrorDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/SubscriptionAcknowledgement.go b/plc4go/protocols/opcua/readwrite/model/SubscriptionAcknowledgement.go index 3f8255331d3..6f318eb4dcf 100644 --- a/plc4go/protocols/opcua/readwrite/model/SubscriptionAcknowledgement.go +++ b/plc4go/protocols/opcua/readwrite/model/SubscriptionAcknowledgement.go @@ -174,8 +174,8 @@ func (b *_SubscriptionAcknowledgement) CreateSubscriptionAcknowledgementBuilder( /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SubscriptionAcknowledgement) GetIdentifier() string { - return "823" +func (m *_SubscriptionAcknowledgement) GetExtensionId() int32 { + return int32(823) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_SubscriptionAcknowledgement) GetLengthInBytes(ctx context.Context) uin return m.GetLengthInBits(ctx) / 8 } -func (m *_SubscriptionAcknowledgement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__subscriptionAcknowledgement SubscriptionAcknowledgement, err error) { +func (m *_SubscriptionAcknowledgement) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__subscriptionAcknowledgement SubscriptionAcknowledgement, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/SubscriptionDiagnosticsDataType.go b/plc4go/protocols/opcua/readwrite/model/SubscriptionDiagnosticsDataType.go index 7ef5afd6f30..5dd95cdb47f 100644 --- a/plc4go/protocols/opcua/readwrite/model/SubscriptionDiagnosticsDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/SubscriptionDiagnosticsDataType.go @@ -519,8 +519,8 @@ func (b *_SubscriptionDiagnosticsDataType) CreateSubscriptionDiagnosticsDataType /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_SubscriptionDiagnosticsDataType) GetIdentifier() string { - return "876" +func (m *_SubscriptionDiagnosticsDataType) GetExtensionId() int32 { + return int32(876) } /////////////////////// @@ -787,7 +787,7 @@ func (m *_SubscriptionDiagnosticsDataType) GetLengthInBytes(ctx context.Context) return m.GetLengthInBits(ctx) / 8 } -func (m *_SubscriptionDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__subscriptionDiagnosticsDataType SubscriptionDiagnosticsDataType, err error) { +func (m *_SubscriptionDiagnosticsDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__subscriptionDiagnosticsDataType SubscriptionDiagnosticsDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/TargetVariablesDataType.go b/plc4go/protocols/opcua/readwrite/model/TargetVariablesDataType.go new file mode 100644 index 00000000000..346d25009f3 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/TargetVariablesDataType.go @@ -0,0 +1,326 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// TargetVariablesDataType is the corresponding interface of TargetVariablesDataType +type TargetVariablesDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetTargetVariables returns TargetVariables (property field) + GetTargetVariables() []FieldTargetDataType + // IsTargetVariablesDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsTargetVariablesDataType() + // CreateBuilder creates a TargetVariablesDataTypeBuilder + CreateTargetVariablesDataTypeBuilder() TargetVariablesDataTypeBuilder +} + +// _TargetVariablesDataType is the data-structure of this message +type _TargetVariablesDataType struct { + ExtensionObjectDefinitionContract + TargetVariables []FieldTargetDataType +} + +var _ TargetVariablesDataType = (*_TargetVariablesDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_TargetVariablesDataType)(nil) + +// NewTargetVariablesDataType factory function for _TargetVariablesDataType +func NewTargetVariablesDataType(targetVariables []FieldTargetDataType) *_TargetVariablesDataType { + _result := &_TargetVariablesDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + TargetVariables: targetVariables, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// TargetVariablesDataTypeBuilder is a builder for TargetVariablesDataType +type TargetVariablesDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(targetVariables []FieldTargetDataType) TargetVariablesDataTypeBuilder + // WithTargetVariables adds TargetVariables (property field) + WithTargetVariables(...FieldTargetDataType) TargetVariablesDataTypeBuilder + // Build builds the TargetVariablesDataType or returns an error if something is wrong + Build() (TargetVariablesDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() TargetVariablesDataType +} + +// NewTargetVariablesDataTypeBuilder() creates a TargetVariablesDataTypeBuilder +func NewTargetVariablesDataTypeBuilder() TargetVariablesDataTypeBuilder { + return &_TargetVariablesDataTypeBuilder{_TargetVariablesDataType: new(_TargetVariablesDataType)} +} + +type _TargetVariablesDataTypeBuilder struct { + *_TargetVariablesDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (TargetVariablesDataTypeBuilder) = (*_TargetVariablesDataTypeBuilder)(nil) + +func (b *_TargetVariablesDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_TargetVariablesDataTypeBuilder) WithMandatoryFields(targetVariables []FieldTargetDataType) TargetVariablesDataTypeBuilder { + return b.WithTargetVariables(targetVariables...) +} + +func (b *_TargetVariablesDataTypeBuilder) WithTargetVariables(targetVariables ...FieldTargetDataType) TargetVariablesDataTypeBuilder { + b.TargetVariables = targetVariables + return b +} + +func (b *_TargetVariablesDataTypeBuilder) Build() (TargetVariablesDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._TargetVariablesDataType.deepCopy(), nil +} + +func (b *_TargetVariablesDataTypeBuilder) MustBuild() TargetVariablesDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_TargetVariablesDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_TargetVariablesDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_TargetVariablesDataTypeBuilder) DeepCopy() any { + _copy := b.CreateTargetVariablesDataTypeBuilder().(*_TargetVariablesDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateTargetVariablesDataTypeBuilder creates a TargetVariablesDataTypeBuilder +func (b *_TargetVariablesDataType) CreateTargetVariablesDataTypeBuilder() TargetVariablesDataTypeBuilder { + if b == nil { + return NewTargetVariablesDataTypeBuilder() + } + return &_TargetVariablesDataTypeBuilder{_TargetVariablesDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_TargetVariablesDataType) GetExtensionId() int32 { + return int32(15633) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_TargetVariablesDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_TargetVariablesDataType) GetTargetVariables() []FieldTargetDataType { + return m.TargetVariables +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastTargetVariablesDataType(structType any) TargetVariablesDataType { + if casted, ok := structType.(TargetVariablesDataType); ok { + return casted + } + if casted, ok := structType.(*TargetVariablesDataType); ok { + return *casted + } + return nil +} + +func (m *_TargetVariablesDataType) GetTypeName() string { + return "TargetVariablesDataType" +} + +func (m *_TargetVariablesDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfTargetVariables) + lengthInBits += 32 + + // Array field + if len(m.TargetVariables) > 0 { + for _curItem, element := range m.TargetVariables { + arrayCtx := utils.CreateArrayContext(ctx, len(m.TargetVariables), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_TargetVariablesDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_TargetVariablesDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__targetVariablesDataType TargetVariablesDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("TargetVariablesDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for TargetVariablesDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfTargetVariables, err := ReadImplicitField[int32](ctx, "noOfTargetVariables", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfTargetVariables' field")) + } + _ = noOfTargetVariables + + targetVariables, err := ReadCountArrayField[FieldTargetDataType](ctx, "targetVariables", ReadComplex[FieldTargetDataType](ExtensionObjectDefinitionParseWithBufferProducer[FieldTargetDataType]((int32)(int32(14746))), readBuffer), uint64(noOfTargetVariables)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'targetVariables' field")) + } + m.TargetVariables = targetVariables + + if closeErr := readBuffer.CloseContext("TargetVariablesDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for TargetVariablesDataType") + } + + return m, nil +} + +func (m *_TargetVariablesDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_TargetVariablesDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("TargetVariablesDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for TargetVariablesDataType") + } + noOfTargetVariables := int32(utils.InlineIf(bool((m.GetTargetVariables()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetTargetVariables()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfTargetVariables", noOfTargetVariables, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfTargetVariables' field") + } + + if err := WriteComplexTypeArrayField(ctx, "targetVariables", m.GetTargetVariables(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'targetVariables' field") + } + + if popErr := writeBuffer.PopContext("TargetVariablesDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for TargetVariablesDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_TargetVariablesDataType) IsTargetVariablesDataType() {} + +func (m *_TargetVariablesDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_TargetVariablesDataType) deepCopy() *_TargetVariablesDataType { + if m == nil { + return nil + } + _TargetVariablesDataTypeCopy := &_TargetVariablesDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[FieldTargetDataType, FieldTargetDataType](m.TargetVariables), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _TargetVariablesDataTypeCopy +} + +func (m *_TargetVariablesDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/Time.go b/plc4go/protocols/opcua/readwrite/model/Time.go deleted file mode 100644 index 4de21e4881b..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/Time.go +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// Time is the corresponding interface of Time -type Time interface { - fmt.Stringer - utils.LengthAware - utils.Serializable -} - -// TimeExactly can be used when we want exactly this type and not a type which fulfills Time. -// This is useful for switch cases. -type TimeExactly interface { - Time - isTime() bool -} - -// _Time is the data-structure of this message -type _Time struct { -} - -// NewTime factory function for _Time -func NewTime() *_Time { - return &_Time{} -} - -// Deprecated: use the interface for direct cast -func CastTime(structType any) Time { - if casted, ok := structType.(Time); ok { - return casted - } - if casted, ok := structType.(*Time); ok { - return *casted - } - return nil -} - -func (m *_Time) GetTypeName() string { - return "Time" -} - -func (m *_Time) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(0) - - return lengthInBits -} - -func (m *_Time) GetLengthInBytes(ctx context.Context) uint16 { - return m.GetLengthInBits(ctx) / 8 -} - -func TimeParse(ctx context.Context, theBytes []byte) (Time, error) { - return TimeParseWithBuffer(ctx, utils.NewReadBufferByteBased(theBytes)) -} - -func TimeParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer) (Time, error) { - positionAware := readBuffer - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pullErr := readBuffer.PullContext("Time"); pullErr != nil { - return nil, errors.Wrap(pullErr, "Error pulling for Time") - } - currentPos := positionAware.GetPos() - _ = currentPos - - if closeErr := readBuffer.CloseContext("Time"); closeErr != nil { - return nil, errors.Wrap(closeErr, "Error closing for Time") - } - - // Create the instance - return &_Time{}, nil -} - -func (m *_Time) Serialize() ([]byte, error) { - wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) - if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { - return nil, err - } - return wb.GetBytes(), nil -} - -func (m *_Time) SerializeWithWriteBuffer(ctx context.Context, wb utils.WriteBuffer) error { - positionAware := wb - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pushErr := wb.PushContext("Time"); pushErr != nil { - return errors.Wrap(pushErr, "Error pushing for Time") - } - - if popErr := wb.PopContext("Time"); popErr != nil { - return errors.Wrap(popErr, "Error popping for Time") - } - return nil -} - -func (m *_Time) isTime() bool { - return true -} - -func (m *_Time) String() string { - if m == nil { - return "" - } - wb := utils.NewWriteBufferBoxBased(utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), utils.WithWriteBufferBoxBasedMergeSingleBoxes()) - if err := wb.WriteSerializable(context.Background(), m); err != nil { - return err.Error() - } - return wb.GetBox().String() -} diff --git a/plc4go/protocols/opcua/readwrite/model/TimeZoneDataType.go b/plc4go/protocols/opcua/readwrite/model/TimeZoneDataType.go index e5f684d6e36..44863b85f4a 100644 --- a/plc4go/protocols/opcua/readwrite/model/TimeZoneDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/TimeZoneDataType.go @@ -176,8 +176,8 @@ func (b *_TimeZoneDataType) CreateTimeZoneDataTypeBuilder() TimeZoneDataTypeBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TimeZoneDataType) GetIdentifier() string { - return "8914" +func (m *_TimeZoneDataType) GetExtensionId() int32 { + return int32(8914) } /////////////////////// @@ -241,7 +241,7 @@ func (m *_TimeZoneDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_TimeZoneDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__timeZoneDataType TimeZoneDataType, err error) { +func (m *_TimeZoneDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__timeZoneDataType TimeZoneDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/TransactionErrorType.go b/plc4go/protocols/opcua/readwrite/model/TransactionErrorType.go index 3b94cf80e7d..453af3a06f5 100644 --- a/plc4go/protocols/opcua/readwrite/model/TransactionErrorType.go +++ b/plc4go/protocols/opcua/readwrite/model/TransactionErrorType.go @@ -257,8 +257,8 @@ func (b *_TransactionErrorType) CreateTransactionErrorTypeBuilder() TransactionE /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TransactionErrorType) GetIdentifier() string { - return "32287" +func (m *_TransactionErrorType) GetExtensionId() int32 { + return int32(32287) } /////////////////////// @@ -326,7 +326,7 @@ func (m *_TransactionErrorType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_TransactionErrorType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__transactionErrorType TransactionErrorType, err error) { +func (m *_TransactionErrorType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transactionErrorType TransactionErrorType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/TransferResult.go b/plc4go/protocols/opcua/readwrite/model/TransferResult.go index bb912275050..ffa5ab51f2d 100644 --- a/plc4go/protocols/opcua/readwrite/model/TransferResult.go +++ b/plc4go/protocols/opcua/readwrite/model/TransferResult.go @@ -42,8 +42,6 @@ type TransferResult interface { ExtensionObjectDefinition // GetStatusCode returns StatusCode (property field) GetStatusCode() StatusCode - // GetNoOfAvailableSequenceNumbers returns NoOfAvailableSequenceNumbers (property field) - GetNoOfAvailableSequenceNumbers() int32 // GetAvailableSequenceNumbers returns AvailableSequenceNumbers (property field) GetAvailableSequenceNumbers() []uint32 // IsTransferResult is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type TransferResult interface { // _TransferResult is the data-structure of this message type _TransferResult struct { ExtensionObjectDefinitionContract - StatusCode StatusCode - NoOfAvailableSequenceNumbers int32 - AvailableSequenceNumbers []uint32 + StatusCode StatusCode + AvailableSequenceNumbers []uint32 } var _ TransferResult = (*_TransferResult)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TransferResult)(nil) // NewTransferResult factory function for _TransferResult -func NewTransferResult(statusCode StatusCode, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32) *_TransferResult { +func NewTransferResult(statusCode StatusCode, availableSequenceNumbers []uint32) *_TransferResult { if statusCode == nil { panic("statusCode of type StatusCode for TransferResult must not be nil") } _result := &_TransferResult{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), StatusCode: statusCode, - NoOfAvailableSequenceNumbers: noOfAvailableSequenceNumbers, AvailableSequenceNumbers: availableSequenceNumbers, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewTransferResult(statusCode StatusCode, noOfAvailableSequenceNumbers int32 type TransferResultBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(statusCode StatusCode, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32) TransferResultBuilder + WithMandatoryFields(statusCode StatusCode, availableSequenceNumbers []uint32) TransferResultBuilder // WithStatusCode adds StatusCode (property field) WithStatusCode(StatusCode) TransferResultBuilder // WithStatusCodeBuilder adds StatusCode (property field) which is build by the builder WithStatusCodeBuilder(func(StatusCodeBuilder) StatusCodeBuilder) TransferResultBuilder - // WithNoOfAvailableSequenceNumbers adds NoOfAvailableSequenceNumbers (property field) - WithNoOfAvailableSequenceNumbers(int32) TransferResultBuilder // WithAvailableSequenceNumbers adds AvailableSequenceNumbers (property field) WithAvailableSequenceNumbers(...uint32) TransferResultBuilder // Build builds the TransferResult or returns an error if something is wrong @@ -121,8 +115,8 @@ func (b *_TransferResultBuilder) setParent(contract ExtensionObjectDefinitionCon b.ExtensionObjectDefinitionContract = contract } -func (b *_TransferResultBuilder) WithMandatoryFields(statusCode StatusCode, noOfAvailableSequenceNumbers int32, availableSequenceNumbers []uint32) TransferResultBuilder { - return b.WithStatusCode(statusCode).WithNoOfAvailableSequenceNumbers(noOfAvailableSequenceNumbers).WithAvailableSequenceNumbers(availableSequenceNumbers...) +func (b *_TransferResultBuilder) WithMandatoryFields(statusCode StatusCode, availableSequenceNumbers []uint32) TransferResultBuilder { + return b.WithStatusCode(statusCode).WithAvailableSequenceNumbers(availableSequenceNumbers...) } func (b *_TransferResultBuilder) WithStatusCode(statusCode StatusCode) TransferResultBuilder { @@ -143,11 +137,6 @@ func (b *_TransferResultBuilder) WithStatusCodeBuilder(builderSupplier func(Stat return b } -func (b *_TransferResultBuilder) WithNoOfAvailableSequenceNumbers(noOfAvailableSequenceNumbers int32) TransferResultBuilder { - b.NoOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers - return b -} - func (b *_TransferResultBuilder) WithAvailableSequenceNumbers(availableSequenceNumbers ...uint32) TransferResultBuilder { b.AvailableSequenceNumbers = availableSequenceNumbers return b @@ -209,8 +198,8 @@ func (b *_TransferResult) CreateTransferResultBuilder() TransferResultBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TransferResult) GetIdentifier() string { - return "838" +func (m *_TransferResult) GetExtensionId() int32 { + return int32(838) } /////////////////////// @@ -231,10 +220,6 @@ func (m *_TransferResult) GetStatusCode() StatusCode { return m.StatusCode } -func (m *_TransferResult) GetNoOfAvailableSequenceNumbers() int32 { - return m.NoOfAvailableSequenceNumbers -} - func (m *_TransferResult) GetAvailableSequenceNumbers() []uint32 { return m.AvailableSequenceNumbers } @@ -265,7 +250,7 @@ func (m *_TransferResult) GetLengthInBits(ctx context.Context) uint16 { // Simple field (statusCode) lengthInBits += m.StatusCode.GetLengthInBits(ctx) - // Simple field (noOfAvailableSequenceNumbers) + // Implicit Field (noOfAvailableSequenceNumbers) lengthInBits += 32 // Array field @@ -280,7 +265,7 @@ func (m *_TransferResult) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_TransferResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__transferResult TransferResult, err error) { +func (m *_TransferResult) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transferResult TransferResult, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -297,11 +282,11 @@ func (m *_TransferResult) parse(ctx context.Context, readBuffer utils.ReadBuffer } m.StatusCode = statusCode - noOfAvailableSequenceNumbers, err := ReadSimpleField(ctx, "noOfAvailableSequenceNumbers", ReadSignedInt(readBuffer, uint8(32))) + noOfAvailableSequenceNumbers, err := ReadImplicitField[int32](ctx, "noOfAvailableSequenceNumbers", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfAvailableSequenceNumbers' field")) } - m.NoOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers + _ = noOfAvailableSequenceNumbers availableSequenceNumbers, err := ReadCountArrayField[uint32](ctx, "availableSequenceNumbers", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfAvailableSequenceNumbers)) if err != nil { @@ -337,8 +322,8 @@ func (m *_TransferResult) SerializeWithWriteBuffer(ctx context.Context, writeBuf if err := WriteSimpleField[StatusCode](ctx, "statusCode", m.GetStatusCode(), WriteComplex[StatusCode](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'statusCode' field") } - - if err := WriteSimpleField[int32](ctx, "noOfAvailableSequenceNumbers", m.GetNoOfAvailableSequenceNumbers(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfAvailableSequenceNumbers := int32(utils.InlineIf(bool((m.GetAvailableSequenceNumbers()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetAvailableSequenceNumbers()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfAvailableSequenceNumbers", noOfAvailableSequenceNumbers, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfAvailableSequenceNumbers' field") } @@ -367,7 +352,6 @@ func (m *_TransferResult) deepCopy() *_TransferResult { _TransferResultCopy := &_TransferResult{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.StatusCode.DeepCopy().(StatusCode), - m.NoOfAvailableSequenceNumbers, utils.DeepCopySlice[uint32, uint32](m.AvailableSequenceNumbers), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsRequest.go b/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsRequest.go index d7477480add..d1a1126afa5 100644 --- a/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsRequest.go @@ -41,9 +41,7 @@ type TransferSubscriptionsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfSubscriptionIds returns NoOfSubscriptionIds (property field) - GetNoOfSubscriptionIds() int32 + GetRequestHeader() RequestHeader // GetSubscriptionIds returns SubscriptionIds (property field) GetSubscriptionIds() []uint32 // GetSendInitialValues returns SendInitialValues (property field) @@ -57,10 +55,9 @@ type TransferSubscriptionsRequest interface { // _TransferSubscriptionsRequest is the data-structure of this message type _TransferSubscriptionsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfSubscriptionIds int32 - SubscriptionIds []uint32 - SendInitialValues bool + RequestHeader RequestHeader + SubscriptionIds []uint32 + SendInitialValues bool // Reserved Fields reservedField0 *uint8 } @@ -69,14 +66,13 @@ var _ TransferSubscriptionsRequest = (*_TransferSubscriptionsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TransferSubscriptionsRequest)(nil) // NewTransferSubscriptionsRequest factory function for _TransferSubscriptionsRequest -func NewTransferSubscriptionsRequest(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32, sendInitialValues bool) *_TransferSubscriptionsRequest { +func NewTransferSubscriptionsRequest(requestHeader RequestHeader, subscriptionIds []uint32, sendInitialValues bool) *_TransferSubscriptionsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for TransferSubscriptionsRequest must not be nil") + panic("requestHeader of type RequestHeader for TransferSubscriptionsRequest must not be nil") } _result := &_TransferSubscriptionsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfSubscriptionIds: noOfSubscriptionIds, SubscriptionIds: subscriptionIds, SendInitialValues: sendInitialValues, } @@ -93,13 +89,11 @@ func NewTransferSubscriptionsRequest(requestHeader ExtensionObjectDefinition, no type TransferSubscriptionsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32, sendInitialValues bool) TransferSubscriptionsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, subscriptionIds []uint32, sendInitialValues bool) TransferSubscriptionsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) TransferSubscriptionsRequestBuilder + WithRequestHeader(RequestHeader) TransferSubscriptionsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TransferSubscriptionsRequestBuilder - // WithNoOfSubscriptionIds adds NoOfSubscriptionIds (property field) - WithNoOfSubscriptionIds(int32) TransferSubscriptionsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) TransferSubscriptionsRequestBuilder // WithSubscriptionIds adds SubscriptionIds (property field) WithSubscriptionIds(...uint32) TransferSubscriptionsRequestBuilder // WithSendInitialValues adds SendInitialValues (property field) @@ -129,33 +123,28 @@ func (b *_TransferSubscriptionsRequestBuilder) setParent(contract ExtensionObjec b.ExtensionObjectDefinitionContract = contract } -func (b *_TransferSubscriptionsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfSubscriptionIds int32, subscriptionIds []uint32, sendInitialValues bool) TransferSubscriptionsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfSubscriptionIds(noOfSubscriptionIds).WithSubscriptionIds(subscriptionIds...).WithSendInitialValues(sendInitialValues) +func (b *_TransferSubscriptionsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, subscriptionIds []uint32, sendInitialValues bool) TransferSubscriptionsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithSubscriptionIds(subscriptionIds...).WithSendInitialValues(sendInitialValues) } -func (b *_TransferSubscriptionsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) TransferSubscriptionsRequestBuilder { +func (b *_TransferSubscriptionsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) TransferSubscriptionsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_TransferSubscriptionsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TransferSubscriptionsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_TransferSubscriptionsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) TransferSubscriptionsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_TransferSubscriptionsRequestBuilder) WithNoOfSubscriptionIds(noOfSubscriptionIds int32) TransferSubscriptionsRequestBuilder { - b.NoOfSubscriptionIds = noOfSubscriptionIds - return b -} - func (b *_TransferSubscriptionsRequestBuilder) WithSubscriptionIds(subscriptionIds ...uint32) TransferSubscriptionsRequestBuilder { b.SubscriptionIds = subscriptionIds return b @@ -222,8 +211,8 @@ func (b *_TransferSubscriptionsRequest) CreateTransferSubscriptionsRequestBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TransferSubscriptionsRequest) GetIdentifier() string { - return "841" +func (m *_TransferSubscriptionsRequest) GetExtensionId() int32 { + return int32(841) } /////////////////////// @@ -240,14 +229,10 @@ func (m *_TransferSubscriptionsRequest) GetParent() ExtensionObjectDefinitionCon /////////////////////// Accessors for property fields. /////////////////////// -func (m *_TransferSubscriptionsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_TransferSubscriptionsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_TransferSubscriptionsRequest) GetNoOfSubscriptionIds() int32 { - return m.NoOfSubscriptionIds -} - func (m *_TransferSubscriptionsRequest) GetSubscriptionIds() []uint32 { return m.SubscriptionIds } @@ -282,7 +267,7 @@ func (m *_TransferSubscriptionsRequest) GetLengthInBits(ctx context.Context) uin // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32 // Array field @@ -303,7 +288,7 @@ func (m *_TransferSubscriptionsRequest) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_TransferSubscriptionsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__transferSubscriptionsRequest TransferSubscriptionsRequest, err error) { +func (m *_TransferSubscriptionsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transferSubscriptionsRequest TransferSubscriptionsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -314,17 +299,17 @@ func (m *_TransferSubscriptionsRequest) parse(ctx context.Context, readBuffer ut currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfSubscriptionIds, err := ReadSimpleField(ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) + noOfSubscriptionIds, err := ReadImplicitField[int32](ctx, "noOfSubscriptionIds", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSubscriptionIds' field")) } - m.NoOfSubscriptionIds = noOfSubscriptionIds + _ = noOfSubscriptionIds subscriptionIds, err := ReadCountArrayField[uint32](ctx, "subscriptionIds", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfSubscriptionIds)) if err != nil { @@ -369,11 +354,11 @@ func (m *_TransferSubscriptionsRequest) SerializeWithWriteBuffer(ctx context.Con return errors.Wrap(pushErr, "Error pushing for TransferSubscriptionsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfSubscriptionIds", m.GetNoOfSubscriptionIds(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfSubscriptionIds := int32(utils.InlineIf(bool((m.GetSubscriptionIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSubscriptionIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSubscriptionIds", noOfSubscriptionIds, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfSubscriptionIds' field") } @@ -409,8 +394,7 @@ func (m *_TransferSubscriptionsRequest) deepCopy() *_TransferSubscriptionsReques } _TransferSubscriptionsRequestCopy := &_TransferSubscriptionsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfSubscriptionIds, + m.RequestHeader.DeepCopy().(RequestHeader), utils.DeepCopySlice[uint32, uint32](m.SubscriptionIds), m.SendInitialValues, m.reservedField0, diff --git a/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsResponse.go b/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsResponse.go index ed2958507c8..cc9bb435eee 100644 --- a/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/TransferSubscriptionsResponse.go @@ -41,13 +41,9 @@ type TransferSubscriptionsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []TransferResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsTransferSubscriptionsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type TransferSubscriptionsResponse interface { // _TransferSubscriptionsResponse is the data-structure of this message type _TransferSubscriptionsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []TransferResult + DiagnosticInfos []DiagnosticInfo } var _ TransferSubscriptionsResponse = (*_TransferSubscriptionsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TransferSubscriptionsResponse)(nil) // NewTransferSubscriptionsResponse factory function for _TransferSubscriptionsResponse -func NewTransferSubscriptionsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_TransferSubscriptionsResponse { +func NewTransferSubscriptionsResponse(responseHeader ResponseHeader, results []TransferResult, diagnosticInfos []DiagnosticInfo) *_TransferSubscriptionsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for TransferSubscriptionsResponse must not be nil") + panic("responseHeader of type ResponseHeader for TransferSubscriptionsResponse must not be nil") } _result := &_TransferSubscriptionsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewTransferSubscriptionsResponse(responseHeader ExtensionObjectDefinition, type TransferSubscriptionsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) TransferSubscriptionsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []TransferResult, diagnosticInfos []DiagnosticInfo) TransferSubscriptionsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) TransferSubscriptionsResponseBuilder + WithResponseHeader(ResponseHeader) TransferSubscriptionsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TransferSubscriptionsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) TransferSubscriptionsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) TransferSubscriptionsResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) TransferSubscriptionsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) TransferSubscriptionsResponseBuilder + WithResults(...TransferResult) TransferSubscriptionsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) TransferSubscriptionsResponseBuilder // Build builds the TransferSubscriptionsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_TransferSubscriptionsResponseBuilder) setParent(contract ExtensionObje b.ExtensionObjectDefinitionContract = contract } -func (b *_TransferSubscriptionsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) TransferSubscriptionsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_TransferSubscriptionsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []TransferResult, diagnosticInfos []DiagnosticInfo) TransferSubscriptionsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_TransferSubscriptionsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) TransferSubscriptionsResponseBuilder { +func (b *_TransferSubscriptionsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) TransferSubscriptionsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_TransferSubscriptionsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TransferSubscriptionsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_TransferSubscriptionsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) TransferSubscriptionsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_TransferSubscriptionsResponseBuilder) WithNoOfResults(noOfResults int32) TransferSubscriptionsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_TransferSubscriptionsResponseBuilder) WithResults(results ...ExtensionObjectDefinition) TransferSubscriptionsResponseBuilder { +func (b *_TransferSubscriptionsResponseBuilder) WithResults(results ...TransferResult) TransferSubscriptionsResponseBuilder { b.Results = results return b } -func (b *_TransferSubscriptionsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) TransferSubscriptionsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_TransferSubscriptionsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) TransferSubscriptionsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_TransferSubscriptionsResponse) CreateTransferSubscriptionsResponseBuil /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TransferSubscriptionsResponse) GetIdentifier() string { - return "844" +func (m *_TransferSubscriptionsResponse) GetExtensionId() int32 { + return int32(844) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_TransferSubscriptionsResponse) GetParent() ExtensionObjectDefinitionCo /////////////////////// Accessors for property fields. /////////////////////// -func (m *_TransferSubscriptionsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_TransferSubscriptionsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_TransferSubscriptionsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_TransferSubscriptionsResponse) GetResults() []ExtensionObjectDefinition { +func (m *_TransferSubscriptionsResponse) GetResults() []TransferResult { return m.Results } -func (m *_TransferSubscriptionsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_TransferSubscriptionsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_TransferSubscriptionsResponse) GetLengthInBits(ctx context.Context) ui // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_TransferSubscriptionsResponse) GetLengthInBits(ctx context.Context) ui } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_TransferSubscriptionsResponse) GetLengthInBytes(ctx context.Context) u return m.GetLengthInBits(ctx) / 8 } -func (m *_TransferSubscriptionsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__transferSubscriptionsResponse TransferSubscriptionsResponse, err error) { +func (m *_TransferSubscriptionsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transferSubscriptionsResponse TransferSubscriptionsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_TransferSubscriptionsResponse) parse(ctx context.Context, readBuffer u currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("838")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[TransferResult](ctx, "results", ReadComplex[TransferResult](ExtensionObjectDefinitionParseWithBufferProducer[TransferResult]((int32)(int32(838))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_TransferSubscriptionsResponse) SerializeWithWriteBuffer(ctx context.Co return errors.Wrap(pushErr, "Error pushing for TransferSubscriptionsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_TransferSubscriptionsResponse) deepCopy() *_TransferSubscriptionsRespo } _TransferSubscriptionsResponseCopy := &_TransferSubscriptionsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[TransferResult, TransferResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsRequest.go b/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsRequest.go index fe45264f4f7..7973f9a14d4 100644 --- a/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsRequest.go @@ -41,11 +41,9 @@ type TranslateBrowsePathsToNodeIdsRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfBrowsePaths returns NoOfBrowsePaths (property field) - GetNoOfBrowsePaths() int32 + GetRequestHeader() RequestHeader // GetBrowsePaths returns BrowsePaths (property field) - GetBrowsePaths() []ExtensionObjectDefinition + GetBrowsePaths() []BrowsePath // IsTranslateBrowsePathsToNodeIdsRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsTranslateBrowsePathsToNodeIdsRequest() // CreateBuilder creates a TranslateBrowsePathsToNodeIdsRequestBuilder @@ -55,23 +53,21 @@ type TranslateBrowsePathsToNodeIdsRequest interface { // _TranslateBrowsePathsToNodeIdsRequest is the data-structure of this message type _TranslateBrowsePathsToNodeIdsRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfBrowsePaths int32 - BrowsePaths []ExtensionObjectDefinition + RequestHeader RequestHeader + BrowsePaths []BrowsePath } var _ TranslateBrowsePathsToNodeIdsRequest = (*_TranslateBrowsePathsToNodeIdsRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TranslateBrowsePathsToNodeIdsRequest)(nil) // NewTranslateBrowsePathsToNodeIdsRequest factory function for _TranslateBrowsePathsToNodeIdsRequest -func NewTranslateBrowsePathsToNodeIdsRequest(requestHeader ExtensionObjectDefinition, noOfBrowsePaths int32, browsePaths []ExtensionObjectDefinition) *_TranslateBrowsePathsToNodeIdsRequest { +func NewTranslateBrowsePathsToNodeIdsRequest(requestHeader RequestHeader, browsePaths []BrowsePath) *_TranslateBrowsePathsToNodeIdsRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for TranslateBrowsePathsToNodeIdsRequest must not be nil") + panic("requestHeader of type RequestHeader for TranslateBrowsePathsToNodeIdsRequest must not be nil") } _result := &_TranslateBrowsePathsToNodeIdsRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfBrowsePaths: noOfBrowsePaths, BrowsePaths: browsePaths, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewTranslateBrowsePathsToNodeIdsRequest(requestHeader ExtensionObjectDefini type TranslateBrowsePathsToNodeIdsRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfBrowsePaths int32, browsePaths []ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, browsePaths []BrowsePath) TranslateBrowsePathsToNodeIdsRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder + WithRequestHeader(RequestHeader) TranslateBrowsePathsToNodeIdsRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TranslateBrowsePathsToNodeIdsRequestBuilder - // WithNoOfBrowsePaths adds NoOfBrowsePaths (property field) - WithNoOfBrowsePaths(int32) TranslateBrowsePathsToNodeIdsRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) TranslateBrowsePathsToNodeIdsRequestBuilder // WithBrowsePaths adds BrowsePaths (property field) - WithBrowsePaths(...ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder + WithBrowsePaths(...BrowsePath) TranslateBrowsePathsToNodeIdsRequestBuilder // Build builds the TranslateBrowsePathsToNodeIdsRequest or returns an error if something is wrong Build() (TranslateBrowsePathsToNodeIdsRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) setParent(contract Extens b.ExtensionObjectDefinitionContract = contract } -func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfBrowsePaths int32, browsePaths []ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfBrowsePaths(noOfBrowsePaths).WithBrowsePaths(browsePaths...) +func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, browsePaths []BrowsePath) TranslateBrowsePathsToNodeIdsRequestBuilder { + return b.WithRequestHeader(requestHeader).WithBrowsePaths(browsePaths...) } -func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder { +func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithRequestHeader(requestHeader RequestHeader) TranslateBrowsePathsToNodeIdsRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TranslateBrowsePathsToNodeIdsRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) TranslateBrowsePathsToNodeIdsRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithNoOfBrowsePaths(noOfBrowsePaths int32) TranslateBrowsePathsToNodeIdsRequestBuilder { - b.NoOfBrowsePaths = noOfBrowsePaths - return b -} - -func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithBrowsePaths(browsePaths ...ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsRequestBuilder { +func (b *_TranslateBrowsePathsToNodeIdsRequestBuilder) WithBrowsePaths(browsePaths ...BrowsePath) TranslateBrowsePathsToNodeIdsRequestBuilder { b.BrowsePaths = browsePaths return b } @@ -209,8 +198,8 @@ func (b *_TranslateBrowsePathsToNodeIdsRequest) CreateTranslateBrowsePathsToNode /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TranslateBrowsePathsToNodeIdsRequest) GetIdentifier() string { - return "554" +func (m *_TranslateBrowsePathsToNodeIdsRequest) GetExtensionId() int32 { + return int32(554) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) GetParent() ExtensionObjectDefin /////////////////////// Accessors for property fields. /////////////////////// -func (m *_TranslateBrowsePathsToNodeIdsRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_TranslateBrowsePathsToNodeIdsRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_TranslateBrowsePathsToNodeIdsRequest) GetNoOfBrowsePaths() int32 { - return m.NoOfBrowsePaths -} - -func (m *_TranslateBrowsePathsToNodeIdsRequest) GetBrowsePaths() []ExtensionObjectDefinition { +func (m *_TranslateBrowsePathsToNodeIdsRequest) GetBrowsePaths() []BrowsePath { return m.BrowsePaths } @@ -265,7 +250,7 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) GetLengthInBits(ctx context.Cont // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfBrowsePaths) + // Implicit Field (noOfBrowsePaths) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) GetLengthInBytes(ctx context.Con return m.GetLengthInBits(ctx) / 8 } -func (m *_TranslateBrowsePathsToNodeIdsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__translateBrowsePathsToNodeIdsRequest TranslateBrowsePathsToNodeIdsRequest, err error) { +func (m *_TranslateBrowsePathsToNodeIdsRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__translateBrowsePathsToNodeIdsRequest TranslateBrowsePathsToNodeIdsRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) parse(ctx context.Context, readB currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfBrowsePaths, err := ReadSimpleField(ctx, "noOfBrowsePaths", ReadSignedInt(readBuffer, uint8(32))) + noOfBrowsePaths, err := ReadImplicitField[int32](ctx, "noOfBrowsePaths", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfBrowsePaths' field")) } - m.NoOfBrowsePaths = noOfBrowsePaths + _ = noOfBrowsePaths - browsePaths, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "browsePaths", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("545")), readBuffer), uint64(noOfBrowsePaths)) + browsePaths, err := ReadCountArrayField[BrowsePath](ctx, "browsePaths", ReadComplex[BrowsePath](ExtensionObjectDefinitionParseWithBufferProducer[BrowsePath]((int32)(int32(545))), readBuffer), uint64(noOfBrowsePaths)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'browsePaths' field")) } @@ -339,11 +324,11 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) SerializeWithWriteBuffer(ctx con return errors.Wrap(pushErr, "Error pushing for TranslateBrowsePathsToNodeIdsRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfBrowsePaths", m.GetNoOfBrowsePaths(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfBrowsePaths := int32(utils.InlineIf(bool((m.GetBrowsePaths()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetBrowsePaths()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfBrowsePaths", noOfBrowsePaths, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfBrowsePaths' field") } @@ -371,9 +356,8 @@ func (m *_TranslateBrowsePathsToNodeIdsRequest) deepCopy() *_TranslateBrowsePath } _TranslateBrowsePathsToNodeIdsRequestCopy := &_TranslateBrowsePathsToNodeIdsRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfBrowsePaths, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.BrowsePaths), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[BrowsePath, BrowsePath](m.BrowsePaths), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _TranslateBrowsePathsToNodeIdsRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsResponse.go b/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsResponse.go index 1f8df26c93a..cb96ca4bb1c 100644 --- a/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/TranslateBrowsePathsToNodeIdsResponse.go @@ -41,13 +41,9 @@ type TranslateBrowsePathsToNodeIdsResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) - GetResults() []ExtensionObjectDefinition - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 + GetResults() []BrowsePathResult // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsTranslateBrowsePathsToNodeIdsResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type TranslateBrowsePathsToNodeIdsResponse interface { // _TranslateBrowsePathsToNodeIdsResponse is the data-structure of this message type _TranslateBrowsePathsToNodeIdsResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []ExtensionObjectDefinition - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []BrowsePathResult + DiagnosticInfos []DiagnosticInfo } var _ TranslateBrowsePathsToNodeIdsResponse = (*_TranslateBrowsePathsToNodeIdsResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TranslateBrowsePathsToNodeIdsResponse)(nil) // NewTranslateBrowsePathsToNodeIdsResponse factory function for _TranslateBrowsePathsToNodeIdsResponse -func NewTranslateBrowsePathsToNodeIdsResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_TranslateBrowsePathsToNodeIdsResponse { +func NewTranslateBrowsePathsToNodeIdsResponse(responseHeader ResponseHeader, results []BrowsePathResult, diagnosticInfos []DiagnosticInfo) *_TranslateBrowsePathsToNodeIdsResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for TranslateBrowsePathsToNodeIdsResponse must not be nil") + panic("responseHeader of type ResponseHeader for TranslateBrowsePathsToNodeIdsResponse must not be nil") } _result := &_TranslateBrowsePathsToNodeIdsResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewTranslateBrowsePathsToNodeIdsResponse(responseHeader ExtensionObjectDefi type TranslateBrowsePathsToNodeIdsResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []BrowsePathResult, diagnosticInfos []DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsResponseBuilder + WithResponseHeader(ResponseHeader) TranslateBrowsePathsToNodeIdsResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TranslateBrowsePathsToNodeIdsResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) TranslateBrowsePathsToNodeIdsResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) TranslateBrowsePathsToNodeIdsResponseBuilder // WithResults adds Results (property field) - WithResults(...ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) TranslateBrowsePathsToNodeIdsResponseBuilder + WithResults(...BrowsePathResult) TranslateBrowsePathsToNodeIdsResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder // Build builds the TranslateBrowsePathsToNodeIdsResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) setParent(contract Exten b.ExtensionObjectDefinitionContract = contract } -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []ExtensionObjectDefinition, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []BrowsePathResult, diagnosticInfos []DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsResponseBuilder { +func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) TranslateBrowsePathsToNodeIdsResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) TranslateBrowsePathsToNodeIdsResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) TranslateBrowsePathsToNodeIdsResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithNoOfResults(noOfResults int32) TranslateBrowsePathsToNodeIdsResponseBuilder { - b.NoOfResults = noOfResults - return b -} - -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResults(results ...ExtensionObjectDefinition) TranslateBrowsePathsToNodeIdsResponseBuilder { +func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithResults(results ...BrowsePathResult) TranslateBrowsePathsToNodeIdsResponseBuilder { b.Results = results return b } -func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) TranslateBrowsePathsToNodeIdsResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_TranslateBrowsePathsToNodeIdsResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) TranslateBrowsePathsToNodeIdsResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_TranslateBrowsePathsToNodeIdsResponse) CreateTranslateBrowsePathsToNod /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TranslateBrowsePathsToNodeIdsResponse) GetIdentifier() string { - return "557" +func (m *_TranslateBrowsePathsToNodeIdsResponse) GetExtensionId() int32 { + return int32(557) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) GetParent() ExtensionObjectDefi /////////////////////// Accessors for property fields. /////////////////////// -func (m *_TranslateBrowsePathsToNodeIdsResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_TranslateBrowsePathsToNodeIdsResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_TranslateBrowsePathsToNodeIdsResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - -func (m *_TranslateBrowsePathsToNodeIdsResponse) GetResults() []ExtensionObjectDefinition { +func (m *_TranslateBrowsePathsToNodeIdsResponse) GetResults() []BrowsePathResult { return m.Results } -func (m *_TranslateBrowsePathsToNodeIdsResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_TranslateBrowsePathsToNodeIdsResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) GetLengthInBits(ctx context.Con // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) GetLengthInBits(ctx context.Con } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) GetLengthInBytes(ctx context.Co return m.GetLengthInBits(ctx) / 8 } -func (m *_TranslateBrowsePathsToNodeIdsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__translateBrowsePathsToNodeIdsResponse TranslateBrowsePathsToNodeIdsResponse, err error) { +func (m *_TranslateBrowsePathsToNodeIdsResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__translateBrowsePathsToNodeIdsResponse TranslateBrowsePathsToNodeIdsResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,29 +309,29 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) parse(ctx context.Context, read currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults - results, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "results", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("551")), readBuffer), uint64(noOfResults)) + results, err := ReadCountArrayField[BrowsePathResult](ctx, "results", ReadComplex[BrowsePathResult](ExtensionObjectDefinitionParseWithBufferProducer[BrowsePathResult]((int32)(int32(551))), readBuffer), uint64(noOfResults)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'results' field")) } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) SerializeWithWriteBuffer(ctx co return errors.Wrap(pushErr, "Error pushing for TranslateBrowsePathsToNodeIdsResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_TranslateBrowsePathsToNodeIdsResponse) deepCopy() *_TranslateBrowsePat } _TranslateBrowsePathsToNodeIdsResponseCopy := &_TranslateBrowsePathsToNodeIdsResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.Results), - m.NoOfDiagnosticInfos, + m.ResponseHeader.DeepCopy().(ResponseHeader), + utils.DeepCopySlice[BrowsePathResult, BrowsePathResult](m.Results), utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/TransmitQosDataType.go b/plc4go/protocols/opcua/readwrite/model/TransmitQosDataType.go new file mode 100644 index 00000000000..56680285a0a --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/TransmitQosDataType.go @@ -0,0 +1,265 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// TransmitQosDataType is the corresponding interface of TransmitQosDataType +type TransmitQosDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // IsTransmitQosDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsTransmitQosDataType() + // CreateBuilder creates a TransmitQosDataTypeBuilder + CreateTransmitQosDataTypeBuilder() TransmitQosDataTypeBuilder +} + +// _TransmitQosDataType is the data-structure of this message +type _TransmitQosDataType struct { + ExtensionObjectDefinitionContract +} + +var _ TransmitQosDataType = (*_TransmitQosDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_TransmitQosDataType)(nil) + +// NewTransmitQosDataType factory function for _TransmitQosDataType +func NewTransmitQosDataType() *_TransmitQosDataType { + _result := &_TransmitQosDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// TransmitQosDataTypeBuilder is a builder for TransmitQosDataType +type TransmitQosDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields() TransmitQosDataTypeBuilder + // Build builds the TransmitQosDataType or returns an error if something is wrong + Build() (TransmitQosDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() TransmitQosDataType +} + +// NewTransmitQosDataTypeBuilder() creates a TransmitQosDataTypeBuilder +func NewTransmitQosDataTypeBuilder() TransmitQosDataTypeBuilder { + return &_TransmitQosDataTypeBuilder{_TransmitQosDataType: new(_TransmitQosDataType)} +} + +type _TransmitQosDataTypeBuilder struct { + *_TransmitQosDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (TransmitQosDataTypeBuilder) = (*_TransmitQosDataTypeBuilder)(nil) + +func (b *_TransmitQosDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_TransmitQosDataTypeBuilder) WithMandatoryFields() TransmitQosDataTypeBuilder { + return b +} + +func (b *_TransmitQosDataTypeBuilder) Build() (TransmitQosDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._TransmitQosDataType.deepCopy(), nil +} + +func (b *_TransmitQosDataTypeBuilder) MustBuild() TransmitQosDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_TransmitQosDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_TransmitQosDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_TransmitQosDataTypeBuilder) DeepCopy() any { + _copy := b.CreateTransmitQosDataTypeBuilder().(*_TransmitQosDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateTransmitQosDataTypeBuilder creates a TransmitQosDataTypeBuilder +func (b *_TransmitQosDataType) CreateTransmitQosDataTypeBuilder() TransmitQosDataTypeBuilder { + if b == nil { + return NewTransmitQosDataTypeBuilder() + } + return &_TransmitQosDataTypeBuilder{_TransmitQosDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_TransmitQosDataType) GetExtensionId() int32 { + return int32(23606) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_TransmitQosDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +// Deprecated: use the interface for direct cast +func CastTransmitQosDataType(structType any) TransmitQosDataType { + if casted, ok := structType.(TransmitQosDataType); ok { + return casted + } + if casted, ok := structType.(*TransmitQosDataType); ok { + return *casted + } + return nil +} + +func (m *_TransmitQosDataType) GetTypeName() string { + return "TransmitQosDataType" +} + +func (m *_TransmitQosDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + return lengthInBits +} + +func (m *_TransmitQosDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_TransmitQosDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transmitQosDataType TransmitQosDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("TransmitQosDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for TransmitQosDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("TransmitQosDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for TransmitQosDataType") + } + + return m, nil +} + +func (m *_TransmitQosDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_TransmitQosDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("TransmitQosDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for TransmitQosDataType") + } + + if popErr := writeBuffer.PopContext("TransmitQosDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for TransmitQosDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_TransmitQosDataType) IsTransmitQosDataType() {} + +func (m *_TransmitQosDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_TransmitQosDataType) deepCopy() *_TransmitQosDataType { + if m == nil { + return nil + } + _TransmitQosDataTypeCopy := &_TransmitQosDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _TransmitQosDataTypeCopy +} + +func (m *_TransmitQosDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/TransmitQosPriorityDataType.go b/plc4go/protocols/opcua/readwrite/model/TransmitQosPriorityDataType.go new file mode 100644 index 00000000000..f6887b4d3b2 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/TransmitQosPriorityDataType.go @@ -0,0 +1,330 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// TransmitQosPriorityDataType is the corresponding interface of TransmitQosPriorityDataType +type TransmitQosPriorityDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetPriorityLabel returns PriorityLabel (property field) + GetPriorityLabel() PascalString + // IsTransmitQosPriorityDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsTransmitQosPriorityDataType() + // CreateBuilder creates a TransmitQosPriorityDataTypeBuilder + CreateTransmitQosPriorityDataTypeBuilder() TransmitQosPriorityDataTypeBuilder +} + +// _TransmitQosPriorityDataType is the data-structure of this message +type _TransmitQosPriorityDataType struct { + ExtensionObjectDefinitionContract + PriorityLabel PascalString +} + +var _ TransmitQosPriorityDataType = (*_TransmitQosPriorityDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_TransmitQosPriorityDataType)(nil) + +// NewTransmitQosPriorityDataType factory function for _TransmitQosPriorityDataType +func NewTransmitQosPriorityDataType(priorityLabel PascalString) *_TransmitQosPriorityDataType { + if priorityLabel == nil { + panic("priorityLabel of type PascalString for TransmitQosPriorityDataType must not be nil") + } + _result := &_TransmitQosPriorityDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PriorityLabel: priorityLabel, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// TransmitQosPriorityDataTypeBuilder is a builder for TransmitQosPriorityDataType +type TransmitQosPriorityDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(priorityLabel PascalString) TransmitQosPriorityDataTypeBuilder + // WithPriorityLabel adds PriorityLabel (property field) + WithPriorityLabel(PascalString) TransmitQosPriorityDataTypeBuilder + // WithPriorityLabelBuilder adds PriorityLabel (property field) which is build by the builder + WithPriorityLabelBuilder(func(PascalStringBuilder) PascalStringBuilder) TransmitQosPriorityDataTypeBuilder + // Build builds the TransmitQosPriorityDataType or returns an error if something is wrong + Build() (TransmitQosPriorityDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() TransmitQosPriorityDataType +} + +// NewTransmitQosPriorityDataTypeBuilder() creates a TransmitQosPriorityDataTypeBuilder +func NewTransmitQosPriorityDataTypeBuilder() TransmitQosPriorityDataTypeBuilder { + return &_TransmitQosPriorityDataTypeBuilder{_TransmitQosPriorityDataType: new(_TransmitQosPriorityDataType)} +} + +type _TransmitQosPriorityDataTypeBuilder struct { + *_TransmitQosPriorityDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (TransmitQosPriorityDataTypeBuilder) = (*_TransmitQosPriorityDataTypeBuilder)(nil) + +func (b *_TransmitQosPriorityDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_TransmitQosPriorityDataTypeBuilder) WithMandatoryFields(priorityLabel PascalString) TransmitQosPriorityDataTypeBuilder { + return b.WithPriorityLabel(priorityLabel) +} + +func (b *_TransmitQosPriorityDataTypeBuilder) WithPriorityLabel(priorityLabel PascalString) TransmitQosPriorityDataTypeBuilder { + b.PriorityLabel = priorityLabel + return b +} + +func (b *_TransmitQosPriorityDataTypeBuilder) WithPriorityLabelBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) TransmitQosPriorityDataTypeBuilder { + builder := builderSupplier(b.PriorityLabel.CreatePascalStringBuilder()) + var err error + b.PriorityLabel, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_TransmitQosPriorityDataTypeBuilder) Build() (TransmitQosPriorityDataType, error) { + if b.PriorityLabel == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'priorityLabel' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._TransmitQosPriorityDataType.deepCopy(), nil +} + +func (b *_TransmitQosPriorityDataTypeBuilder) MustBuild() TransmitQosPriorityDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_TransmitQosPriorityDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_TransmitQosPriorityDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_TransmitQosPriorityDataTypeBuilder) DeepCopy() any { + _copy := b.CreateTransmitQosPriorityDataTypeBuilder().(*_TransmitQosPriorityDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateTransmitQosPriorityDataTypeBuilder creates a TransmitQosPriorityDataTypeBuilder +func (b *_TransmitQosPriorityDataType) CreateTransmitQosPriorityDataTypeBuilder() TransmitQosPriorityDataTypeBuilder { + if b == nil { + return NewTransmitQosPriorityDataTypeBuilder() + } + return &_TransmitQosPriorityDataTypeBuilder{_TransmitQosPriorityDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_TransmitQosPriorityDataType) GetExtensionId() int32 { + return int32(23607) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_TransmitQosPriorityDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_TransmitQosPriorityDataType) GetPriorityLabel() PascalString { + return m.PriorityLabel +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastTransmitQosPriorityDataType(structType any) TransmitQosPriorityDataType { + if casted, ok := structType.(TransmitQosPriorityDataType); ok { + return casted + } + if casted, ok := structType.(*TransmitQosPriorityDataType); ok { + return *casted + } + return nil +} + +func (m *_TransmitQosPriorityDataType) GetTypeName() string { + return "TransmitQosPriorityDataType" +} + +func (m *_TransmitQosPriorityDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (priorityLabel) + lengthInBits += m.PriorityLabel.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_TransmitQosPriorityDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_TransmitQosPriorityDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__transmitQosPriorityDataType TransmitQosPriorityDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("TransmitQosPriorityDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for TransmitQosPriorityDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + priorityLabel, err := ReadSimpleField[PascalString](ctx, "priorityLabel", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'priorityLabel' field")) + } + m.PriorityLabel = priorityLabel + + if closeErr := readBuffer.CloseContext("TransmitQosPriorityDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for TransmitQosPriorityDataType") + } + + return m, nil +} + +func (m *_TransmitQosPriorityDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_TransmitQosPriorityDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("TransmitQosPriorityDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for TransmitQosPriorityDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "priorityLabel", m.GetPriorityLabel(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'priorityLabel' field") + } + + if popErr := writeBuffer.PopContext("TransmitQosPriorityDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for TransmitQosPriorityDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_TransmitQosPriorityDataType) IsTransmitQosPriorityDataType() {} + +func (m *_TransmitQosPriorityDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_TransmitQosPriorityDataType) deepCopy() *_TransmitQosPriorityDataType { + if m == nil { + return nil + } + _TransmitQosPriorityDataTypeCopy := &_TransmitQosPriorityDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PriorityLabel.DeepCopy().(PascalString), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _TransmitQosPriorityDataTypeCopy +} + +func (m *_TransmitQosPriorityDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/TrustListDataType.go b/plc4go/protocols/opcua/readwrite/model/TrustListDataType.go index 7a515e11e39..a3fc1770833 100644 --- a/plc4go/protocols/opcua/readwrite/model/TrustListDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/TrustListDataType.go @@ -42,20 +42,12 @@ type TrustListDataType interface { ExtensionObjectDefinition // GetSpecifiedLists returns SpecifiedLists (property field) GetSpecifiedLists() uint32 - // GetNoOfTrustedCertificates returns NoOfTrustedCertificates (property field) - GetNoOfTrustedCertificates() int32 // GetTrustedCertificates returns TrustedCertificates (property field) GetTrustedCertificates() []PascalByteString - // GetNoOfTrustedCrls returns NoOfTrustedCrls (property field) - GetNoOfTrustedCrls() int32 // GetTrustedCrls returns TrustedCrls (property field) GetTrustedCrls() []PascalByteString - // GetNoOfIssuerCertificates returns NoOfIssuerCertificates (property field) - GetNoOfIssuerCertificates() int32 // GetIssuerCertificates returns IssuerCertificates (property field) GetIssuerCertificates() []PascalByteString - // GetNoOfIssuerCrls returns NoOfIssuerCrls (property field) - GetNoOfIssuerCrls() int32 // GetIssuerCrls returns IssuerCrls (property field) GetIssuerCrls() []PascalByteString // IsTrustListDataType is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -67,32 +59,24 @@ type TrustListDataType interface { // _TrustListDataType is the data-structure of this message type _TrustListDataType struct { ExtensionObjectDefinitionContract - SpecifiedLists uint32 - NoOfTrustedCertificates int32 - TrustedCertificates []PascalByteString - NoOfTrustedCrls int32 - TrustedCrls []PascalByteString - NoOfIssuerCertificates int32 - IssuerCertificates []PascalByteString - NoOfIssuerCrls int32 - IssuerCrls []PascalByteString + SpecifiedLists uint32 + TrustedCertificates []PascalByteString + TrustedCrls []PascalByteString + IssuerCertificates []PascalByteString + IssuerCrls []PascalByteString } var _ TrustListDataType = (*_TrustListDataType)(nil) var _ ExtensionObjectDefinitionRequirements = (*_TrustListDataType)(nil) // NewTrustListDataType factory function for _TrustListDataType -func NewTrustListDataType(specifiedLists uint32, noOfTrustedCertificates int32, trustedCertificates []PascalByteString, noOfTrustedCrls int32, trustedCrls []PascalByteString, noOfIssuerCertificates int32, issuerCertificates []PascalByteString, noOfIssuerCrls int32, issuerCrls []PascalByteString) *_TrustListDataType { +func NewTrustListDataType(specifiedLists uint32, trustedCertificates []PascalByteString, trustedCrls []PascalByteString, issuerCertificates []PascalByteString, issuerCrls []PascalByteString) *_TrustListDataType { _result := &_TrustListDataType{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), SpecifiedLists: specifiedLists, - NoOfTrustedCertificates: noOfTrustedCertificates, TrustedCertificates: trustedCertificates, - NoOfTrustedCrls: noOfTrustedCrls, TrustedCrls: trustedCrls, - NoOfIssuerCertificates: noOfIssuerCertificates, IssuerCertificates: issuerCertificates, - NoOfIssuerCrls: noOfIssuerCrls, IssuerCrls: issuerCrls, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -108,23 +92,15 @@ func NewTrustListDataType(specifiedLists uint32, noOfTrustedCertificates int32, type TrustListDataTypeBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(specifiedLists uint32, noOfTrustedCertificates int32, trustedCertificates []PascalByteString, noOfTrustedCrls int32, trustedCrls []PascalByteString, noOfIssuerCertificates int32, issuerCertificates []PascalByteString, noOfIssuerCrls int32, issuerCrls []PascalByteString) TrustListDataTypeBuilder + WithMandatoryFields(specifiedLists uint32, trustedCertificates []PascalByteString, trustedCrls []PascalByteString, issuerCertificates []PascalByteString, issuerCrls []PascalByteString) TrustListDataTypeBuilder // WithSpecifiedLists adds SpecifiedLists (property field) WithSpecifiedLists(uint32) TrustListDataTypeBuilder - // WithNoOfTrustedCertificates adds NoOfTrustedCertificates (property field) - WithNoOfTrustedCertificates(int32) TrustListDataTypeBuilder // WithTrustedCertificates adds TrustedCertificates (property field) WithTrustedCertificates(...PascalByteString) TrustListDataTypeBuilder - // WithNoOfTrustedCrls adds NoOfTrustedCrls (property field) - WithNoOfTrustedCrls(int32) TrustListDataTypeBuilder // WithTrustedCrls adds TrustedCrls (property field) WithTrustedCrls(...PascalByteString) TrustListDataTypeBuilder - // WithNoOfIssuerCertificates adds NoOfIssuerCertificates (property field) - WithNoOfIssuerCertificates(int32) TrustListDataTypeBuilder // WithIssuerCertificates adds IssuerCertificates (property field) WithIssuerCertificates(...PascalByteString) TrustListDataTypeBuilder - // WithNoOfIssuerCrls adds NoOfIssuerCrls (property field) - WithNoOfIssuerCrls(int32) TrustListDataTypeBuilder // WithIssuerCrls adds IssuerCrls (property field) WithIssuerCrls(...PascalByteString) TrustListDataTypeBuilder // Build builds the TrustListDataType or returns an error if something is wrong @@ -152,8 +128,8 @@ func (b *_TrustListDataTypeBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_TrustListDataTypeBuilder) WithMandatoryFields(specifiedLists uint32, noOfTrustedCertificates int32, trustedCertificates []PascalByteString, noOfTrustedCrls int32, trustedCrls []PascalByteString, noOfIssuerCertificates int32, issuerCertificates []PascalByteString, noOfIssuerCrls int32, issuerCrls []PascalByteString) TrustListDataTypeBuilder { - return b.WithSpecifiedLists(specifiedLists).WithNoOfTrustedCertificates(noOfTrustedCertificates).WithTrustedCertificates(trustedCertificates...).WithNoOfTrustedCrls(noOfTrustedCrls).WithTrustedCrls(trustedCrls...).WithNoOfIssuerCertificates(noOfIssuerCertificates).WithIssuerCertificates(issuerCertificates...).WithNoOfIssuerCrls(noOfIssuerCrls).WithIssuerCrls(issuerCrls...) +func (b *_TrustListDataTypeBuilder) WithMandatoryFields(specifiedLists uint32, trustedCertificates []PascalByteString, trustedCrls []PascalByteString, issuerCertificates []PascalByteString, issuerCrls []PascalByteString) TrustListDataTypeBuilder { + return b.WithSpecifiedLists(specifiedLists).WithTrustedCertificates(trustedCertificates...).WithTrustedCrls(trustedCrls...).WithIssuerCertificates(issuerCertificates...).WithIssuerCrls(issuerCrls...) } func (b *_TrustListDataTypeBuilder) WithSpecifiedLists(specifiedLists uint32) TrustListDataTypeBuilder { @@ -161,41 +137,21 @@ func (b *_TrustListDataTypeBuilder) WithSpecifiedLists(specifiedLists uint32) Tr return b } -func (b *_TrustListDataTypeBuilder) WithNoOfTrustedCertificates(noOfTrustedCertificates int32) TrustListDataTypeBuilder { - b.NoOfTrustedCertificates = noOfTrustedCertificates - return b -} - func (b *_TrustListDataTypeBuilder) WithTrustedCertificates(trustedCertificates ...PascalByteString) TrustListDataTypeBuilder { b.TrustedCertificates = trustedCertificates return b } -func (b *_TrustListDataTypeBuilder) WithNoOfTrustedCrls(noOfTrustedCrls int32) TrustListDataTypeBuilder { - b.NoOfTrustedCrls = noOfTrustedCrls - return b -} - func (b *_TrustListDataTypeBuilder) WithTrustedCrls(trustedCrls ...PascalByteString) TrustListDataTypeBuilder { b.TrustedCrls = trustedCrls return b } -func (b *_TrustListDataTypeBuilder) WithNoOfIssuerCertificates(noOfIssuerCertificates int32) TrustListDataTypeBuilder { - b.NoOfIssuerCertificates = noOfIssuerCertificates - return b -} - func (b *_TrustListDataTypeBuilder) WithIssuerCertificates(issuerCertificates ...PascalByteString) TrustListDataTypeBuilder { b.IssuerCertificates = issuerCertificates return b } -func (b *_TrustListDataTypeBuilder) WithNoOfIssuerCrls(noOfIssuerCrls int32) TrustListDataTypeBuilder { - b.NoOfIssuerCrls = noOfIssuerCrls - return b -} - func (b *_TrustListDataTypeBuilder) WithIssuerCrls(issuerCrls ...PascalByteString) TrustListDataTypeBuilder { b.IssuerCrls = issuerCrls return b @@ -251,8 +207,8 @@ func (b *_TrustListDataType) CreateTrustListDataTypeBuilder() TrustListDataTypeB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_TrustListDataType) GetIdentifier() string { - return "12556" +func (m *_TrustListDataType) GetExtensionId() int32 { + return int32(12556) } /////////////////////// @@ -273,34 +229,18 @@ func (m *_TrustListDataType) GetSpecifiedLists() uint32 { return m.SpecifiedLists } -func (m *_TrustListDataType) GetNoOfTrustedCertificates() int32 { - return m.NoOfTrustedCertificates -} - func (m *_TrustListDataType) GetTrustedCertificates() []PascalByteString { return m.TrustedCertificates } -func (m *_TrustListDataType) GetNoOfTrustedCrls() int32 { - return m.NoOfTrustedCrls -} - func (m *_TrustListDataType) GetTrustedCrls() []PascalByteString { return m.TrustedCrls } -func (m *_TrustListDataType) GetNoOfIssuerCertificates() int32 { - return m.NoOfIssuerCertificates -} - func (m *_TrustListDataType) GetIssuerCertificates() []PascalByteString { return m.IssuerCertificates } -func (m *_TrustListDataType) GetNoOfIssuerCrls() int32 { - return m.NoOfIssuerCrls -} - func (m *_TrustListDataType) GetIssuerCrls() []PascalByteString { return m.IssuerCrls } @@ -331,7 +271,7 @@ func (m *_TrustListDataType) GetLengthInBits(ctx context.Context) uint16 { // Simple field (specifiedLists) lengthInBits += 32 - // Simple field (noOfTrustedCertificates) + // Implicit Field (noOfTrustedCertificates) lengthInBits += 32 // Array field @@ -344,7 +284,7 @@ func (m *_TrustListDataType) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfTrustedCrls) + // Implicit Field (noOfTrustedCrls) lengthInBits += 32 // Array field @@ -357,7 +297,7 @@ func (m *_TrustListDataType) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfIssuerCertificates) + // Implicit Field (noOfIssuerCertificates) lengthInBits += 32 // Array field @@ -370,7 +310,7 @@ func (m *_TrustListDataType) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfIssuerCrls) + // Implicit Field (noOfIssuerCrls) lengthInBits += 32 // Array field @@ -390,7 +330,7 @@ func (m *_TrustListDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__trustListDataType TrustListDataType, err error) { +func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__trustListDataType TrustListDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -407,11 +347,11 @@ func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuf } m.SpecifiedLists = specifiedLists - noOfTrustedCertificates, err := ReadSimpleField(ctx, "noOfTrustedCertificates", ReadSignedInt(readBuffer, uint8(32))) + noOfTrustedCertificates, err := ReadImplicitField[int32](ctx, "noOfTrustedCertificates", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfTrustedCertificates' field")) } - m.NoOfTrustedCertificates = noOfTrustedCertificates + _ = noOfTrustedCertificates trustedCertificates, err := ReadCountArrayField[PascalByteString](ctx, "trustedCertificates", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfTrustedCertificates)) if err != nil { @@ -419,11 +359,11 @@ func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuf } m.TrustedCertificates = trustedCertificates - noOfTrustedCrls, err := ReadSimpleField(ctx, "noOfTrustedCrls", ReadSignedInt(readBuffer, uint8(32))) + noOfTrustedCrls, err := ReadImplicitField[int32](ctx, "noOfTrustedCrls", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfTrustedCrls' field")) } - m.NoOfTrustedCrls = noOfTrustedCrls + _ = noOfTrustedCrls trustedCrls, err := ReadCountArrayField[PascalByteString](ctx, "trustedCrls", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfTrustedCrls)) if err != nil { @@ -431,11 +371,11 @@ func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuf } m.TrustedCrls = trustedCrls - noOfIssuerCertificates, err := ReadSimpleField(ctx, "noOfIssuerCertificates", ReadSignedInt(readBuffer, uint8(32))) + noOfIssuerCertificates, err := ReadImplicitField[int32](ctx, "noOfIssuerCertificates", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfIssuerCertificates' field")) } - m.NoOfIssuerCertificates = noOfIssuerCertificates + _ = noOfIssuerCertificates issuerCertificates, err := ReadCountArrayField[PascalByteString](ctx, "issuerCertificates", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfIssuerCertificates)) if err != nil { @@ -443,11 +383,11 @@ func (m *_TrustListDataType) parse(ctx context.Context, readBuffer utils.ReadBuf } m.IssuerCertificates = issuerCertificates - noOfIssuerCrls, err := ReadSimpleField(ctx, "noOfIssuerCrls", ReadSignedInt(readBuffer, uint8(32))) + noOfIssuerCrls, err := ReadImplicitField[int32](ctx, "noOfIssuerCrls", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfIssuerCrls' field")) } - m.NoOfIssuerCrls = noOfIssuerCrls + _ = noOfIssuerCrls issuerCrls, err := ReadCountArrayField[PascalByteString](ctx, "issuerCrls", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer), uint64(noOfIssuerCrls)) if err != nil { @@ -483,32 +423,32 @@ func (m *_TrustListDataType) SerializeWithWriteBuffer(ctx context.Context, write if err := WriteSimpleField[uint32](ctx, "specifiedLists", m.GetSpecifiedLists(), WriteUnsignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'specifiedLists' field") } - - if err := WriteSimpleField[int32](ctx, "noOfTrustedCertificates", m.GetNoOfTrustedCertificates(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfTrustedCertificates := int32(utils.InlineIf(bool((m.GetTrustedCertificates()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetTrustedCertificates()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfTrustedCertificates", noOfTrustedCertificates, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfTrustedCertificates' field") } if err := WriteComplexTypeArrayField(ctx, "trustedCertificates", m.GetTrustedCertificates(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'trustedCertificates' field") } - - if err := WriteSimpleField[int32](ctx, "noOfTrustedCrls", m.GetNoOfTrustedCrls(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfTrustedCrls := int32(utils.InlineIf(bool((m.GetTrustedCrls()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetTrustedCrls()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfTrustedCrls", noOfTrustedCrls, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfTrustedCrls' field") } if err := WriteComplexTypeArrayField(ctx, "trustedCrls", m.GetTrustedCrls(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'trustedCrls' field") } - - if err := WriteSimpleField[int32](ctx, "noOfIssuerCertificates", m.GetNoOfIssuerCertificates(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfIssuerCertificates := int32(utils.InlineIf(bool((m.GetIssuerCertificates()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetIssuerCertificates()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfIssuerCertificates", noOfIssuerCertificates, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfIssuerCertificates' field") } if err := WriteComplexTypeArrayField(ctx, "issuerCertificates", m.GetIssuerCertificates(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'issuerCertificates' field") } - - if err := WriteSimpleField[int32](ctx, "noOfIssuerCrls", m.GetNoOfIssuerCrls(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfIssuerCrls := int32(utils.InlineIf(bool((m.GetIssuerCrls()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetIssuerCrls()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfIssuerCrls", noOfIssuerCrls, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfIssuerCrls' field") } @@ -537,13 +477,9 @@ func (m *_TrustListDataType) deepCopy() *_TrustListDataType { _TrustListDataTypeCopy := &_TrustListDataType{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.SpecifiedLists, - m.NoOfTrustedCertificates, utils.DeepCopySlice[PascalByteString, PascalByteString](m.TrustedCertificates), - m.NoOfTrustedCrls, utils.DeepCopySlice[PascalByteString, PascalByteString](m.TrustedCrls), - m.NoOfIssuerCertificates, utils.DeepCopySlice[PascalByteString, PascalByteString](m.IssuerCertificates), - m.NoOfIssuerCrls, utils.DeepCopySlice[PascalByteString, PascalByteString](m.IssuerCrls), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/UABinaryFileDataType.go b/plc4go/protocols/opcua/readwrite/model/UABinaryFileDataType.go new file mode 100644 index 00000000000..e838454b56f --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UABinaryFileDataType.go @@ -0,0 +1,628 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UABinaryFileDataType is the corresponding interface of UABinaryFileDataType +type UABinaryFileDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNamespaces returns Namespaces (property field) + GetNamespaces() []PascalString + // GetStructureDataTypes returns StructureDataTypes (property field) + GetStructureDataTypes() []StructureDescription + // GetEnumDataTypes returns EnumDataTypes (property field) + GetEnumDataTypes() []EnumDescription + // GetSimpleDataTypes returns SimpleDataTypes (property field) + GetSimpleDataTypes() []SimpleTypeDescription + // GetSchemaLocation returns SchemaLocation (property field) + GetSchemaLocation() PascalString + // GetFileHeader returns FileHeader (property field) + GetFileHeader() []KeyValuePair + // GetBody returns Body (property field) + GetBody() Variant + // IsUABinaryFileDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUABinaryFileDataType() + // CreateBuilder creates a UABinaryFileDataTypeBuilder + CreateUABinaryFileDataTypeBuilder() UABinaryFileDataTypeBuilder +} + +// _UABinaryFileDataType is the data-structure of this message +type _UABinaryFileDataType struct { + ExtensionObjectDefinitionContract + Namespaces []PascalString + StructureDataTypes []StructureDescription + EnumDataTypes []EnumDescription + SimpleDataTypes []SimpleTypeDescription + SchemaLocation PascalString + FileHeader []KeyValuePair + Body Variant +} + +var _ UABinaryFileDataType = (*_UABinaryFileDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UABinaryFileDataType)(nil) + +// NewUABinaryFileDataType factory function for _UABinaryFileDataType +func NewUABinaryFileDataType(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, schemaLocation PascalString, fileHeader []KeyValuePair, body Variant) *_UABinaryFileDataType { + if schemaLocation == nil { + panic("schemaLocation of type PascalString for UABinaryFileDataType must not be nil") + } + if body == nil { + panic("body of type Variant for UABinaryFileDataType must not be nil") + } + _result := &_UABinaryFileDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Namespaces: namespaces, + StructureDataTypes: structureDataTypes, + EnumDataTypes: enumDataTypes, + SimpleDataTypes: simpleDataTypes, + SchemaLocation: schemaLocation, + FileHeader: fileHeader, + Body: body, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UABinaryFileDataTypeBuilder is a builder for UABinaryFileDataType +type UABinaryFileDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, schemaLocation PascalString, fileHeader []KeyValuePair, body Variant) UABinaryFileDataTypeBuilder + // WithNamespaces adds Namespaces (property field) + WithNamespaces(...PascalString) UABinaryFileDataTypeBuilder + // WithStructureDataTypes adds StructureDataTypes (property field) + WithStructureDataTypes(...StructureDescription) UABinaryFileDataTypeBuilder + // WithEnumDataTypes adds EnumDataTypes (property field) + WithEnumDataTypes(...EnumDescription) UABinaryFileDataTypeBuilder + // WithSimpleDataTypes adds SimpleDataTypes (property field) + WithSimpleDataTypes(...SimpleTypeDescription) UABinaryFileDataTypeBuilder + // WithSchemaLocation adds SchemaLocation (property field) + WithSchemaLocation(PascalString) UABinaryFileDataTypeBuilder + // WithSchemaLocationBuilder adds SchemaLocation (property field) which is build by the builder + WithSchemaLocationBuilder(func(PascalStringBuilder) PascalStringBuilder) UABinaryFileDataTypeBuilder + // WithFileHeader adds FileHeader (property field) + WithFileHeader(...KeyValuePair) UABinaryFileDataTypeBuilder + // WithBody adds Body (property field) + WithBody(Variant) UABinaryFileDataTypeBuilder + // WithBodyBuilder adds Body (property field) which is build by the builder + WithBodyBuilder(func(VariantBuilder) VariantBuilder) UABinaryFileDataTypeBuilder + // Build builds the UABinaryFileDataType or returns an error if something is wrong + Build() (UABinaryFileDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() UABinaryFileDataType +} + +// NewUABinaryFileDataTypeBuilder() creates a UABinaryFileDataTypeBuilder +func NewUABinaryFileDataTypeBuilder() UABinaryFileDataTypeBuilder { + return &_UABinaryFileDataTypeBuilder{_UABinaryFileDataType: new(_UABinaryFileDataType)} +} + +type _UABinaryFileDataTypeBuilder struct { + *_UABinaryFileDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UABinaryFileDataTypeBuilder) = (*_UABinaryFileDataTypeBuilder)(nil) + +func (b *_UABinaryFileDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UABinaryFileDataTypeBuilder) WithMandatoryFields(namespaces []PascalString, structureDataTypes []StructureDescription, enumDataTypes []EnumDescription, simpleDataTypes []SimpleTypeDescription, schemaLocation PascalString, fileHeader []KeyValuePair, body Variant) UABinaryFileDataTypeBuilder { + return b.WithNamespaces(namespaces...).WithStructureDataTypes(structureDataTypes...).WithEnumDataTypes(enumDataTypes...).WithSimpleDataTypes(simpleDataTypes...).WithSchemaLocation(schemaLocation).WithFileHeader(fileHeader...).WithBody(body) +} + +func (b *_UABinaryFileDataTypeBuilder) WithNamespaces(namespaces ...PascalString) UABinaryFileDataTypeBuilder { + b.Namespaces = namespaces + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithStructureDataTypes(structureDataTypes ...StructureDescription) UABinaryFileDataTypeBuilder { + b.StructureDataTypes = structureDataTypes + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithEnumDataTypes(enumDataTypes ...EnumDescription) UABinaryFileDataTypeBuilder { + b.EnumDataTypes = enumDataTypes + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithSimpleDataTypes(simpleDataTypes ...SimpleTypeDescription) UABinaryFileDataTypeBuilder { + b.SimpleDataTypes = simpleDataTypes + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithSchemaLocation(schemaLocation PascalString) UABinaryFileDataTypeBuilder { + b.SchemaLocation = schemaLocation + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithSchemaLocationBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) UABinaryFileDataTypeBuilder { + builder := builderSupplier(b.SchemaLocation.CreatePascalStringBuilder()) + var err error + b.SchemaLocation, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithFileHeader(fileHeader ...KeyValuePair) UABinaryFileDataTypeBuilder { + b.FileHeader = fileHeader + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithBody(body Variant) UABinaryFileDataTypeBuilder { + b.Body = body + return b +} + +func (b *_UABinaryFileDataTypeBuilder) WithBodyBuilder(builderSupplier func(VariantBuilder) VariantBuilder) UABinaryFileDataTypeBuilder { + builder := builderSupplier(b.Body.CreateVariantBuilder()) + var err error + b.Body, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_UABinaryFileDataTypeBuilder) Build() (UABinaryFileDataType, error) { + if b.SchemaLocation == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'schemaLocation' not set")) + } + if b.Body == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'body' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UABinaryFileDataType.deepCopy(), nil +} + +func (b *_UABinaryFileDataTypeBuilder) MustBuild() UABinaryFileDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UABinaryFileDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UABinaryFileDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UABinaryFileDataTypeBuilder) DeepCopy() any { + _copy := b.CreateUABinaryFileDataTypeBuilder().(*_UABinaryFileDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUABinaryFileDataTypeBuilder creates a UABinaryFileDataTypeBuilder +func (b *_UABinaryFileDataType) CreateUABinaryFileDataTypeBuilder() UABinaryFileDataTypeBuilder { + if b == nil { + return NewUABinaryFileDataTypeBuilder() + } + return &_UABinaryFileDataTypeBuilder{_UABinaryFileDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UABinaryFileDataType) GetExtensionId() int32 { + return int32(15008) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UABinaryFileDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UABinaryFileDataType) GetNamespaces() []PascalString { + return m.Namespaces +} + +func (m *_UABinaryFileDataType) GetStructureDataTypes() []StructureDescription { + return m.StructureDataTypes +} + +func (m *_UABinaryFileDataType) GetEnumDataTypes() []EnumDescription { + return m.EnumDataTypes +} + +func (m *_UABinaryFileDataType) GetSimpleDataTypes() []SimpleTypeDescription { + return m.SimpleDataTypes +} + +func (m *_UABinaryFileDataType) GetSchemaLocation() PascalString { + return m.SchemaLocation +} + +func (m *_UABinaryFileDataType) GetFileHeader() []KeyValuePair { + return m.FileHeader +} + +func (m *_UABinaryFileDataType) GetBody() Variant { + return m.Body +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUABinaryFileDataType(structType any) UABinaryFileDataType { + if casted, ok := structType.(UABinaryFileDataType); ok { + return casted + } + if casted, ok := structType.(*UABinaryFileDataType); ok { + return *casted + } + return nil +} + +func (m *_UABinaryFileDataType) GetTypeName() string { + return "UABinaryFileDataType" +} + +func (m *_UABinaryFileDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Implicit Field (noOfNamespaces) + lengthInBits += 32 + + // Array field + if len(m.Namespaces) > 0 { + for _curItem, element := range m.Namespaces { + arrayCtx := utils.CreateArrayContext(ctx, len(m.Namespaces), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfStructureDataTypes) + lengthInBits += 32 + + // Array field + if len(m.StructureDataTypes) > 0 { + for _curItem, element := range m.StructureDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.StructureDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfEnumDataTypes) + lengthInBits += 32 + + // Array field + if len(m.EnumDataTypes) > 0 { + for _curItem, element := range m.EnumDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.EnumDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Implicit Field (noOfSimpleDataTypes) + lengthInBits += 32 + + // Array field + if len(m.SimpleDataTypes) > 0 { + for _curItem, element := range m.SimpleDataTypes { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SimpleDataTypes), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (schemaLocation) + lengthInBits += m.SchemaLocation.GetLengthInBits(ctx) + + // Implicit Field (noOfFileHeader) + lengthInBits += 32 + + // Array field + if len(m.FileHeader) > 0 { + for _curItem, element := range m.FileHeader { + arrayCtx := utils.CreateArrayContext(ctx, len(m.FileHeader), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (body) + lengthInBits += m.Body.GetLengthInBits(ctx) + + return lengthInBits +} + +func (m *_UABinaryFileDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UABinaryFileDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__uABinaryFileDataType UABinaryFileDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UABinaryFileDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UABinaryFileDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + noOfNamespaces, err := ReadImplicitField[int32](ctx, "noOfNamespaces", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNamespaces' field")) + } + _ = noOfNamespaces + + namespaces, err := ReadCountArrayField[PascalString](ctx, "namespaces", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfNamespaces)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'namespaces' field")) + } + m.Namespaces = namespaces + + noOfStructureDataTypes, err := ReadImplicitField[int32](ctx, "noOfStructureDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfStructureDataTypes' field")) + } + _ = noOfStructureDataTypes + + structureDataTypes, err := ReadCountArrayField[StructureDescription](ctx, "structureDataTypes", ReadComplex[StructureDescription](ExtensionObjectDefinitionParseWithBufferProducer[StructureDescription]((int32)(int32(15489))), readBuffer), uint64(noOfStructureDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'structureDataTypes' field")) + } + m.StructureDataTypes = structureDataTypes + + noOfEnumDataTypes, err := ReadImplicitField[int32](ctx, "noOfEnumDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEnumDataTypes' field")) + } + _ = noOfEnumDataTypes + + enumDataTypes, err := ReadCountArrayField[EnumDescription](ctx, "enumDataTypes", ReadComplex[EnumDescription](ExtensionObjectDefinitionParseWithBufferProducer[EnumDescription]((int32)(int32(15490))), readBuffer), uint64(noOfEnumDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enumDataTypes' field")) + } + m.EnumDataTypes = enumDataTypes + + noOfSimpleDataTypes, err := ReadImplicitField[int32](ctx, "noOfSimpleDataTypes", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSimpleDataTypes' field")) + } + _ = noOfSimpleDataTypes + + simpleDataTypes, err := ReadCountArrayField[SimpleTypeDescription](ctx, "simpleDataTypes", ReadComplex[SimpleTypeDescription](ExtensionObjectDefinitionParseWithBufferProducer[SimpleTypeDescription]((int32)(int32(15007))), readBuffer), uint64(noOfSimpleDataTypes)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'simpleDataTypes' field")) + } + m.SimpleDataTypes = simpleDataTypes + + schemaLocation, err := ReadSimpleField[PascalString](ctx, "schemaLocation", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'schemaLocation' field")) + } + m.SchemaLocation = schemaLocation + + noOfFileHeader, err := ReadImplicitField[int32](ctx, "noOfFileHeader", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfFileHeader' field")) + } + _ = noOfFileHeader + + fileHeader, err := ReadCountArrayField[KeyValuePair](ctx, "fileHeader", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfFileHeader)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'fileHeader' field")) + } + m.FileHeader = fileHeader + + body, err := ReadSimpleField[Variant](ctx, "body", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'body' field")) + } + m.Body = body + + if closeErr := readBuffer.CloseContext("UABinaryFileDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UABinaryFileDataType") + } + + return m, nil +} + +func (m *_UABinaryFileDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UABinaryFileDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UABinaryFileDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UABinaryFileDataType") + } + noOfNamespaces := int32(utils.InlineIf(bool((m.GetNamespaces()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNamespaces()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNamespaces", noOfNamespaces, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfNamespaces' field") + } + + if err := WriteComplexTypeArrayField(ctx, "namespaces", m.GetNamespaces(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'namespaces' field") + } + noOfStructureDataTypes := int32(utils.InlineIf(bool((m.GetStructureDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetStructureDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfStructureDataTypes", noOfStructureDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfStructureDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "structureDataTypes", m.GetStructureDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'structureDataTypes' field") + } + noOfEnumDataTypes := int32(utils.InlineIf(bool((m.GetEnumDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEnumDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEnumDataTypes", noOfEnumDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfEnumDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "enumDataTypes", m.GetEnumDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'enumDataTypes' field") + } + noOfSimpleDataTypes := int32(utils.InlineIf(bool((m.GetSimpleDataTypes()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSimpleDataTypes()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSimpleDataTypes", noOfSimpleDataTypes, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSimpleDataTypes' field") + } + + if err := WriteComplexTypeArrayField(ctx, "simpleDataTypes", m.GetSimpleDataTypes(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'simpleDataTypes' field") + } + + if err := WriteSimpleField[PascalString](ctx, "schemaLocation", m.GetSchemaLocation(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'schemaLocation' field") + } + noOfFileHeader := int32(utils.InlineIf(bool((m.GetFileHeader()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetFileHeader()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfFileHeader", noOfFileHeader, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfFileHeader' field") + } + + if err := WriteComplexTypeArrayField(ctx, "fileHeader", m.GetFileHeader(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'fileHeader' field") + } + + if err := WriteSimpleField[Variant](ctx, "body", m.GetBody(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'body' field") + } + + if popErr := writeBuffer.PopContext("UABinaryFileDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UABinaryFileDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UABinaryFileDataType) IsUABinaryFileDataType() {} + +func (m *_UABinaryFileDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UABinaryFileDataType) deepCopy() *_UABinaryFileDataType { + if m == nil { + return nil + } + _UABinaryFileDataTypeCopy := &_UABinaryFileDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + utils.DeepCopySlice[PascalString, PascalString](m.Namespaces), + utils.DeepCopySlice[StructureDescription, StructureDescription](m.StructureDataTypes), + utils.DeepCopySlice[EnumDescription, EnumDescription](m.EnumDataTypes), + utils.DeepCopySlice[SimpleTypeDescription, SimpleTypeDescription](m.SimpleDataTypes), + m.SchemaLocation.DeepCopy().(PascalString), + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.FileHeader), + m.Body.DeepCopy().(Variant), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UABinaryFileDataTypeCopy +} + +func (m *_UABinaryFileDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UadpDataSetReaderMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/UadpDataSetReaderMessageDataType.go new file mode 100644 index 00000000000..88e9b1ea461 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UadpDataSetReaderMessageDataType.go @@ -0,0 +1,562 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UadpDataSetReaderMessageDataType is the corresponding interface of UadpDataSetReaderMessageDataType +type UadpDataSetReaderMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetGroupVersion returns GroupVersion (property field) + GetGroupVersion() uint32 + // GetNetworkMessageNumber returns NetworkMessageNumber (property field) + GetNetworkMessageNumber() uint16 + // GetDataSetOffset returns DataSetOffset (property field) + GetDataSetOffset() uint16 + // GetDataSetClassId returns DataSetClassId (property field) + GetDataSetClassId() GuidValue + // GetNetworkMessageContentMask returns NetworkMessageContentMask (property field) + GetNetworkMessageContentMask() UadpNetworkMessageContentMask + // GetDataSetMessageContentMask returns DataSetMessageContentMask (property field) + GetDataSetMessageContentMask() UadpDataSetMessageContentMask + // GetPublishingInterval returns PublishingInterval (property field) + GetPublishingInterval() float64 + // GetReceiveOffset returns ReceiveOffset (property field) + GetReceiveOffset() float64 + // GetProcessingOffset returns ProcessingOffset (property field) + GetProcessingOffset() float64 + // IsUadpDataSetReaderMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUadpDataSetReaderMessageDataType() + // CreateBuilder creates a UadpDataSetReaderMessageDataTypeBuilder + CreateUadpDataSetReaderMessageDataTypeBuilder() UadpDataSetReaderMessageDataTypeBuilder +} + +// _UadpDataSetReaderMessageDataType is the data-structure of this message +type _UadpDataSetReaderMessageDataType struct { + ExtensionObjectDefinitionContract + GroupVersion uint32 + NetworkMessageNumber uint16 + DataSetOffset uint16 + DataSetClassId GuidValue + NetworkMessageContentMask UadpNetworkMessageContentMask + DataSetMessageContentMask UadpDataSetMessageContentMask + PublishingInterval float64 + ReceiveOffset float64 + ProcessingOffset float64 +} + +var _ UadpDataSetReaderMessageDataType = (*_UadpDataSetReaderMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UadpDataSetReaderMessageDataType)(nil) + +// NewUadpDataSetReaderMessageDataType factory function for _UadpDataSetReaderMessageDataType +func NewUadpDataSetReaderMessageDataType(groupVersion uint32, networkMessageNumber uint16, dataSetOffset uint16, dataSetClassId GuidValue, networkMessageContentMask UadpNetworkMessageContentMask, dataSetMessageContentMask UadpDataSetMessageContentMask, publishingInterval float64, receiveOffset float64, processingOffset float64) *_UadpDataSetReaderMessageDataType { + if dataSetClassId == nil { + panic("dataSetClassId of type GuidValue for UadpDataSetReaderMessageDataType must not be nil") + } + _result := &_UadpDataSetReaderMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + GroupVersion: groupVersion, + NetworkMessageNumber: networkMessageNumber, + DataSetOffset: dataSetOffset, + DataSetClassId: dataSetClassId, + NetworkMessageContentMask: networkMessageContentMask, + DataSetMessageContentMask: dataSetMessageContentMask, + PublishingInterval: publishingInterval, + ReceiveOffset: receiveOffset, + ProcessingOffset: processingOffset, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UadpDataSetReaderMessageDataTypeBuilder is a builder for UadpDataSetReaderMessageDataType +type UadpDataSetReaderMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(groupVersion uint32, networkMessageNumber uint16, dataSetOffset uint16, dataSetClassId GuidValue, networkMessageContentMask UadpNetworkMessageContentMask, dataSetMessageContentMask UadpDataSetMessageContentMask, publishingInterval float64, receiveOffset float64, processingOffset float64) UadpDataSetReaderMessageDataTypeBuilder + // WithGroupVersion adds GroupVersion (property field) + WithGroupVersion(uint32) UadpDataSetReaderMessageDataTypeBuilder + // WithNetworkMessageNumber adds NetworkMessageNumber (property field) + WithNetworkMessageNumber(uint16) UadpDataSetReaderMessageDataTypeBuilder + // WithDataSetOffset adds DataSetOffset (property field) + WithDataSetOffset(uint16) UadpDataSetReaderMessageDataTypeBuilder + // WithDataSetClassId adds DataSetClassId (property field) + WithDataSetClassId(GuidValue) UadpDataSetReaderMessageDataTypeBuilder + // WithDataSetClassIdBuilder adds DataSetClassId (property field) which is build by the builder + WithDataSetClassIdBuilder(func(GuidValueBuilder) GuidValueBuilder) UadpDataSetReaderMessageDataTypeBuilder + // WithNetworkMessageContentMask adds NetworkMessageContentMask (property field) + WithNetworkMessageContentMask(UadpNetworkMessageContentMask) UadpDataSetReaderMessageDataTypeBuilder + // WithDataSetMessageContentMask adds DataSetMessageContentMask (property field) + WithDataSetMessageContentMask(UadpDataSetMessageContentMask) UadpDataSetReaderMessageDataTypeBuilder + // WithPublishingInterval adds PublishingInterval (property field) + WithPublishingInterval(float64) UadpDataSetReaderMessageDataTypeBuilder + // WithReceiveOffset adds ReceiveOffset (property field) + WithReceiveOffset(float64) UadpDataSetReaderMessageDataTypeBuilder + // WithProcessingOffset adds ProcessingOffset (property field) + WithProcessingOffset(float64) UadpDataSetReaderMessageDataTypeBuilder + // Build builds the UadpDataSetReaderMessageDataType or returns an error if something is wrong + Build() (UadpDataSetReaderMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() UadpDataSetReaderMessageDataType +} + +// NewUadpDataSetReaderMessageDataTypeBuilder() creates a UadpDataSetReaderMessageDataTypeBuilder +func NewUadpDataSetReaderMessageDataTypeBuilder() UadpDataSetReaderMessageDataTypeBuilder { + return &_UadpDataSetReaderMessageDataTypeBuilder{_UadpDataSetReaderMessageDataType: new(_UadpDataSetReaderMessageDataType)} +} + +type _UadpDataSetReaderMessageDataTypeBuilder struct { + *_UadpDataSetReaderMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UadpDataSetReaderMessageDataTypeBuilder) = (*_UadpDataSetReaderMessageDataTypeBuilder)(nil) + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithMandatoryFields(groupVersion uint32, networkMessageNumber uint16, dataSetOffset uint16, dataSetClassId GuidValue, networkMessageContentMask UadpNetworkMessageContentMask, dataSetMessageContentMask UadpDataSetMessageContentMask, publishingInterval float64, receiveOffset float64, processingOffset float64) UadpDataSetReaderMessageDataTypeBuilder { + return b.WithGroupVersion(groupVersion).WithNetworkMessageNumber(networkMessageNumber).WithDataSetOffset(dataSetOffset).WithDataSetClassId(dataSetClassId).WithNetworkMessageContentMask(networkMessageContentMask).WithDataSetMessageContentMask(dataSetMessageContentMask).WithPublishingInterval(publishingInterval).WithReceiveOffset(receiveOffset).WithProcessingOffset(processingOffset) +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithGroupVersion(groupVersion uint32) UadpDataSetReaderMessageDataTypeBuilder { + b.GroupVersion = groupVersion + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithNetworkMessageNumber(networkMessageNumber uint16) UadpDataSetReaderMessageDataTypeBuilder { + b.NetworkMessageNumber = networkMessageNumber + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithDataSetOffset(dataSetOffset uint16) UadpDataSetReaderMessageDataTypeBuilder { + b.DataSetOffset = dataSetOffset + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithDataSetClassId(dataSetClassId GuidValue) UadpDataSetReaderMessageDataTypeBuilder { + b.DataSetClassId = dataSetClassId + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithDataSetClassIdBuilder(builderSupplier func(GuidValueBuilder) GuidValueBuilder) UadpDataSetReaderMessageDataTypeBuilder { + builder := builderSupplier(b.DataSetClassId.CreateGuidValueBuilder()) + var err error + b.DataSetClassId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "GuidValueBuilder failed")) + } + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithNetworkMessageContentMask(networkMessageContentMask UadpNetworkMessageContentMask) UadpDataSetReaderMessageDataTypeBuilder { + b.NetworkMessageContentMask = networkMessageContentMask + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithDataSetMessageContentMask(dataSetMessageContentMask UadpDataSetMessageContentMask) UadpDataSetReaderMessageDataTypeBuilder { + b.DataSetMessageContentMask = dataSetMessageContentMask + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithPublishingInterval(publishingInterval float64) UadpDataSetReaderMessageDataTypeBuilder { + b.PublishingInterval = publishingInterval + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithReceiveOffset(receiveOffset float64) UadpDataSetReaderMessageDataTypeBuilder { + b.ReceiveOffset = receiveOffset + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) WithProcessingOffset(processingOffset float64) UadpDataSetReaderMessageDataTypeBuilder { + b.ProcessingOffset = processingOffset + return b +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) Build() (UadpDataSetReaderMessageDataType, error) { + if b.DataSetClassId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataSetClassId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UadpDataSetReaderMessageDataType.deepCopy(), nil +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) MustBuild() UadpDataSetReaderMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UadpDataSetReaderMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UadpDataSetReaderMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateUadpDataSetReaderMessageDataTypeBuilder().(*_UadpDataSetReaderMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUadpDataSetReaderMessageDataTypeBuilder creates a UadpDataSetReaderMessageDataTypeBuilder +func (b *_UadpDataSetReaderMessageDataType) CreateUadpDataSetReaderMessageDataTypeBuilder() UadpDataSetReaderMessageDataTypeBuilder { + if b == nil { + return NewUadpDataSetReaderMessageDataTypeBuilder() + } + return &_UadpDataSetReaderMessageDataTypeBuilder{_UadpDataSetReaderMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UadpDataSetReaderMessageDataType) GetExtensionId() int32 { + return int32(15655) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UadpDataSetReaderMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UadpDataSetReaderMessageDataType) GetGroupVersion() uint32 { + return m.GroupVersion +} + +func (m *_UadpDataSetReaderMessageDataType) GetNetworkMessageNumber() uint16 { + return m.NetworkMessageNumber +} + +func (m *_UadpDataSetReaderMessageDataType) GetDataSetOffset() uint16 { + return m.DataSetOffset +} + +func (m *_UadpDataSetReaderMessageDataType) GetDataSetClassId() GuidValue { + return m.DataSetClassId +} + +func (m *_UadpDataSetReaderMessageDataType) GetNetworkMessageContentMask() UadpNetworkMessageContentMask { + return m.NetworkMessageContentMask +} + +func (m *_UadpDataSetReaderMessageDataType) GetDataSetMessageContentMask() UadpDataSetMessageContentMask { + return m.DataSetMessageContentMask +} + +func (m *_UadpDataSetReaderMessageDataType) GetPublishingInterval() float64 { + return m.PublishingInterval +} + +func (m *_UadpDataSetReaderMessageDataType) GetReceiveOffset() float64 { + return m.ReceiveOffset +} + +func (m *_UadpDataSetReaderMessageDataType) GetProcessingOffset() float64 { + return m.ProcessingOffset +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUadpDataSetReaderMessageDataType(structType any) UadpDataSetReaderMessageDataType { + if casted, ok := structType.(UadpDataSetReaderMessageDataType); ok { + return casted + } + if casted, ok := structType.(*UadpDataSetReaderMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_UadpDataSetReaderMessageDataType) GetTypeName() string { + return "UadpDataSetReaderMessageDataType" +} + +func (m *_UadpDataSetReaderMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (groupVersion) + lengthInBits += 32 + + // Simple field (networkMessageNumber) + lengthInBits += 16 + + // Simple field (dataSetOffset) + lengthInBits += 16 + + // Simple field (dataSetClassId) + lengthInBits += m.DataSetClassId.GetLengthInBits(ctx) + + // Simple field (networkMessageContentMask) + lengthInBits += 32 + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32 + + // Simple field (publishingInterval) + lengthInBits += 64 + + // Simple field (receiveOffset) + lengthInBits += 64 + + // Simple field (processingOffset) + lengthInBits += 64 + + return lengthInBits +} + +func (m *_UadpDataSetReaderMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UadpDataSetReaderMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__uadpDataSetReaderMessageDataType UadpDataSetReaderMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UadpDataSetReaderMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UadpDataSetReaderMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + groupVersion, err := ReadSimpleField(ctx, "groupVersion", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupVersion' field")) + } + m.GroupVersion = groupVersion + + networkMessageNumber, err := ReadSimpleField(ctx, "networkMessageNumber", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageNumber' field")) + } + m.NetworkMessageNumber = networkMessageNumber + + dataSetOffset, err := ReadSimpleField(ctx, "dataSetOffset", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetOffset' field")) + } + m.DataSetOffset = dataSetOffset + + dataSetClassId, err := ReadSimpleField[GuidValue](ctx, "dataSetClassId", ReadComplex[GuidValue](GuidValueParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetClassId' field")) + } + m.DataSetClassId = dataSetClassId + + networkMessageContentMask, err := ReadEnumField[UadpNetworkMessageContentMask](ctx, "networkMessageContentMask", "UadpNetworkMessageContentMask", ReadEnum(UadpNetworkMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageContentMask' field")) + } + m.NetworkMessageContentMask = networkMessageContentMask + + dataSetMessageContentMask, err := ReadEnumField[UadpDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "UadpDataSetMessageContentMask", ReadEnum(UadpDataSetMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMessageContentMask' field")) + } + m.DataSetMessageContentMask = dataSetMessageContentMask + + publishingInterval, err := ReadSimpleField(ctx, "publishingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishingInterval' field")) + } + m.PublishingInterval = publishingInterval + + receiveOffset, err := ReadSimpleField(ctx, "receiveOffset", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'receiveOffset' field")) + } + m.ReceiveOffset = receiveOffset + + processingOffset, err := ReadSimpleField(ctx, "processingOffset", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'processingOffset' field")) + } + m.ProcessingOffset = processingOffset + + if closeErr := readBuffer.CloseContext("UadpDataSetReaderMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UadpDataSetReaderMessageDataType") + } + + return m, nil +} + +func (m *_UadpDataSetReaderMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UadpDataSetReaderMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UadpDataSetReaderMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UadpDataSetReaderMessageDataType") + } + + if err := WriteSimpleField[uint32](ctx, "groupVersion", m.GetGroupVersion(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'groupVersion' field") + } + + if err := WriteSimpleField[uint16](ctx, "networkMessageNumber", m.GetNetworkMessageNumber(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageNumber' field") + } + + if err := WriteSimpleField[uint16](ctx, "dataSetOffset", m.GetDataSetOffset(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetOffset' field") + } + + if err := WriteSimpleField[GuidValue](ctx, "dataSetClassId", m.GetDataSetClassId(), WriteComplex[GuidValue](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetClassId' field") + } + + if err := WriteSimpleEnumField[UadpNetworkMessageContentMask](ctx, "networkMessageContentMask", "UadpNetworkMessageContentMask", m.GetNetworkMessageContentMask(), WriteEnum[UadpNetworkMessageContentMask, uint32](UadpNetworkMessageContentMask.GetValue, UadpNetworkMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageContentMask' field") + } + + if err := WriteSimpleEnumField[UadpDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "UadpDataSetMessageContentMask", m.GetDataSetMessageContentMask(), WriteEnum[UadpDataSetMessageContentMask, uint32](UadpDataSetMessageContentMask.GetValue, UadpDataSetMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMessageContentMask' field") + } + + if err := WriteSimpleField[float64](ctx, "publishingInterval", m.GetPublishingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'publishingInterval' field") + } + + if err := WriteSimpleField[float64](ctx, "receiveOffset", m.GetReceiveOffset(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'receiveOffset' field") + } + + if err := WriteSimpleField[float64](ctx, "processingOffset", m.GetProcessingOffset(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'processingOffset' field") + } + + if popErr := writeBuffer.PopContext("UadpDataSetReaderMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UadpDataSetReaderMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UadpDataSetReaderMessageDataType) IsUadpDataSetReaderMessageDataType() {} + +func (m *_UadpDataSetReaderMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UadpDataSetReaderMessageDataType) deepCopy() *_UadpDataSetReaderMessageDataType { + if m == nil { + return nil + } + _UadpDataSetReaderMessageDataTypeCopy := &_UadpDataSetReaderMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.GroupVersion, + m.NetworkMessageNumber, + m.DataSetOffset, + m.DataSetClassId.DeepCopy().(GuidValue), + m.NetworkMessageContentMask, + m.DataSetMessageContentMask, + m.PublishingInterval, + m.ReceiveOffset, + m.ProcessingOffset, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UadpDataSetReaderMessageDataTypeCopy +} + +func (m *_UadpDataSetReaderMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UadpDataSetWriterMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/UadpDataSetWriterMessageDataType.go new file mode 100644 index 00000000000..c23d242f828 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UadpDataSetWriterMessageDataType.go @@ -0,0 +1,393 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UadpDataSetWriterMessageDataType is the corresponding interface of UadpDataSetWriterMessageDataType +type UadpDataSetWriterMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetDataSetMessageContentMask returns DataSetMessageContentMask (property field) + GetDataSetMessageContentMask() UadpDataSetMessageContentMask + // GetConfiguredSize returns ConfiguredSize (property field) + GetConfiguredSize() uint16 + // GetNetworkMessageNumber returns NetworkMessageNumber (property field) + GetNetworkMessageNumber() uint16 + // GetDataSetOffset returns DataSetOffset (property field) + GetDataSetOffset() uint16 + // IsUadpDataSetWriterMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUadpDataSetWriterMessageDataType() + // CreateBuilder creates a UadpDataSetWriterMessageDataTypeBuilder + CreateUadpDataSetWriterMessageDataTypeBuilder() UadpDataSetWriterMessageDataTypeBuilder +} + +// _UadpDataSetWriterMessageDataType is the data-structure of this message +type _UadpDataSetWriterMessageDataType struct { + ExtensionObjectDefinitionContract + DataSetMessageContentMask UadpDataSetMessageContentMask + ConfiguredSize uint16 + NetworkMessageNumber uint16 + DataSetOffset uint16 +} + +var _ UadpDataSetWriterMessageDataType = (*_UadpDataSetWriterMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UadpDataSetWriterMessageDataType)(nil) + +// NewUadpDataSetWriterMessageDataType factory function for _UadpDataSetWriterMessageDataType +func NewUadpDataSetWriterMessageDataType(dataSetMessageContentMask UadpDataSetMessageContentMask, configuredSize uint16, networkMessageNumber uint16, dataSetOffset uint16) *_UadpDataSetWriterMessageDataType { + _result := &_UadpDataSetWriterMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + DataSetMessageContentMask: dataSetMessageContentMask, + ConfiguredSize: configuredSize, + NetworkMessageNumber: networkMessageNumber, + DataSetOffset: dataSetOffset, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UadpDataSetWriterMessageDataTypeBuilder is a builder for UadpDataSetWriterMessageDataType +type UadpDataSetWriterMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(dataSetMessageContentMask UadpDataSetMessageContentMask, configuredSize uint16, networkMessageNumber uint16, dataSetOffset uint16) UadpDataSetWriterMessageDataTypeBuilder + // WithDataSetMessageContentMask adds DataSetMessageContentMask (property field) + WithDataSetMessageContentMask(UadpDataSetMessageContentMask) UadpDataSetWriterMessageDataTypeBuilder + // WithConfiguredSize adds ConfiguredSize (property field) + WithConfiguredSize(uint16) UadpDataSetWriterMessageDataTypeBuilder + // WithNetworkMessageNumber adds NetworkMessageNumber (property field) + WithNetworkMessageNumber(uint16) UadpDataSetWriterMessageDataTypeBuilder + // WithDataSetOffset adds DataSetOffset (property field) + WithDataSetOffset(uint16) UadpDataSetWriterMessageDataTypeBuilder + // Build builds the UadpDataSetWriterMessageDataType or returns an error if something is wrong + Build() (UadpDataSetWriterMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() UadpDataSetWriterMessageDataType +} + +// NewUadpDataSetWriterMessageDataTypeBuilder() creates a UadpDataSetWriterMessageDataTypeBuilder +func NewUadpDataSetWriterMessageDataTypeBuilder() UadpDataSetWriterMessageDataTypeBuilder { + return &_UadpDataSetWriterMessageDataTypeBuilder{_UadpDataSetWriterMessageDataType: new(_UadpDataSetWriterMessageDataType)} +} + +type _UadpDataSetWriterMessageDataTypeBuilder struct { + *_UadpDataSetWriterMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UadpDataSetWriterMessageDataTypeBuilder) = (*_UadpDataSetWriterMessageDataTypeBuilder)(nil) + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) WithMandatoryFields(dataSetMessageContentMask UadpDataSetMessageContentMask, configuredSize uint16, networkMessageNumber uint16, dataSetOffset uint16) UadpDataSetWriterMessageDataTypeBuilder { + return b.WithDataSetMessageContentMask(dataSetMessageContentMask).WithConfiguredSize(configuredSize).WithNetworkMessageNumber(networkMessageNumber).WithDataSetOffset(dataSetOffset) +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) WithDataSetMessageContentMask(dataSetMessageContentMask UadpDataSetMessageContentMask) UadpDataSetWriterMessageDataTypeBuilder { + b.DataSetMessageContentMask = dataSetMessageContentMask + return b +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) WithConfiguredSize(configuredSize uint16) UadpDataSetWriterMessageDataTypeBuilder { + b.ConfiguredSize = configuredSize + return b +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) WithNetworkMessageNumber(networkMessageNumber uint16) UadpDataSetWriterMessageDataTypeBuilder { + b.NetworkMessageNumber = networkMessageNumber + return b +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) WithDataSetOffset(dataSetOffset uint16) UadpDataSetWriterMessageDataTypeBuilder { + b.DataSetOffset = dataSetOffset + return b +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) Build() (UadpDataSetWriterMessageDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UadpDataSetWriterMessageDataType.deepCopy(), nil +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) MustBuild() UadpDataSetWriterMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UadpDataSetWriterMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UadpDataSetWriterMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateUadpDataSetWriterMessageDataTypeBuilder().(*_UadpDataSetWriterMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUadpDataSetWriterMessageDataTypeBuilder creates a UadpDataSetWriterMessageDataTypeBuilder +func (b *_UadpDataSetWriterMessageDataType) CreateUadpDataSetWriterMessageDataTypeBuilder() UadpDataSetWriterMessageDataTypeBuilder { + if b == nil { + return NewUadpDataSetWriterMessageDataTypeBuilder() + } + return &_UadpDataSetWriterMessageDataTypeBuilder{_UadpDataSetWriterMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UadpDataSetWriterMessageDataType) GetExtensionId() int32 { + return int32(15654) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UadpDataSetWriterMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UadpDataSetWriterMessageDataType) GetDataSetMessageContentMask() UadpDataSetMessageContentMask { + return m.DataSetMessageContentMask +} + +func (m *_UadpDataSetWriterMessageDataType) GetConfiguredSize() uint16 { + return m.ConfiguredSize +} + +func (m *_UadpDataSetWriterMessageDataType) GetNetworkMessageNumber() uint16 { + return m.NetworkMessageNumber +} + +func (m *_UadpDataSetWriterMessageDataType) GetDataSetOffset() uint16 { + return m.DataSetOffset +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUadpDataSetWriterMessageDataType(structType any) UadpDataSetWriterMessageDataType { + if casted, ok := structType.(UadpDataSetWriterMessageDataType); ok { + return casted + } + if casted, ok := structType.(*UadpDataSetWriterMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_UadpDataSetWriterMessageDataType) GetTypeName() string { + return "UadpDataSetWriterMessageDataType" +} + +func (m *_UadpDataSetWriterMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32 + + // Simple field (configuredSize) + lengthInBits += 16 + + // Simple field (networkMessageNumber) + lengthInBits += 16 + + // Simple field (dataSetOffset) + lengthInBits += 16 + + return lengthInBits +} + +func (m *_UadpDataSetWriterMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UadpDataSetWriterMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__uadpDataSetWriterMessageDataType UadpDataSetWriterMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UadpDataSetWriterMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UadpDataSetWriterMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + dataSetMessageContentMask, err := ReadEnumField[UadpDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "UadpDataSetMessageContentMask", ReadEnum(UadpDataSetMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetMessageContentMask' field")) + } + m.DataSetMessageContentMask = dataSetMessageContentMask + + configuredSize, err := ReadSimpleField(ctx, "configuredSize", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'configuredSize' field")) + } + m.ConfiguredSize = configuredSize + + networkMessageNumber, err := ReadSimpleField(ctx, "networkMessageNumber", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageNumber' field")) + } + m.NetworkMessageNumber = networkMessageNumber + + dataSetOffset, err := ReadSimpleField(ctx, "dataSetOffset", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetOffset' field")) + } + m.DataSetOffset = dataSetOffset + + if closeErr := readBuffer.CloseContext("UadpDataSetWriterMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UadpDataSetWriterMessageDataType") + } + + return m, nil +} + +func (m *_UadpDataSetWriterMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UadpDataSetWriterMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UadpDataSetWriterMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UadpDataSetWriterMessageDataType") + } + + if err := WriteSimpleEnumField[UadpDataSetMessageContentMask](ctx, "dataSetMessageContentMask", "UadpDataSetMessageContentMask", m.GetDataSetMessageContentMask(), WriteEnum[UadpDataSetMessageContentMask, uint32](UadpDataSetMessageContentMask.GetValue, UadpDataSetMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetMessageContentMask' field") + } + + if err := WriteSimpleField[uint16](ctx, "configuredSize", m.GetConfiguredSize(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'configuredSize' field") + } + + if err := WriteSimpleField[uint16](ctx, "networkMessageNumber", m.GetNetworkMessageNumber(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageNumber' field") + } + + if err := WriteSimpleField[uint16](ctx, "dataSetOffset", m.GetDataSetOffset(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetOffset' field") + } + + if popErr := writeBuffer.PopContext("UadpDataSetWriterMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UadpDataSetWriterMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UadpDataSetWriterMessageDataType) IsUadpDataSetWriterMessageDataType() {} + +func (m *_UadpDataSetWriterMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UadpDataSetWriterMessageDataType) deepCopy() *_UadpDataSetWriterMessageDataType { + if m == nil { + return nil + } + _UadpDataSetWriterMessageDataTypeCopy := &_UadpDataSetWriterMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.DataSetMessageContentMask, + m.ConfiguredSize, + m.NetworkMessageNumber, + m.DataSetOffset, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UadpDataSetWriterMessageDataTypeCopy +} + +func (m *_UadpDataSetWriterMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UadpWriterGroupMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/UadpWriterGroupMessageDataType.go new file mode 100644 index 00000000000..28993cb0d3d --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UadpWriterGroupMessageDataType.go @@ -0,0 +1,437 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UadpWriterGroupMessageDataType is the corresponding interface of UadpWriterGroupMessageDataType +type UadpWriterGroupMessageDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetGroupVersion returns GroupVersion (property field) + GetGroupVersion() uint32 + // GetDataSetOrdering returns DataSetOrdering (property field) + GetDataSetOrdering() DataSetOrderingType + // GetNetworkMessageContentMask returns NetworkMessageContentMask (property field) + GetNetworkMessageContentMask() UadpNetworkMessageContentMask + // GetSamplingOffset returns SamplingOffset (property field) + GetSamplingOffset() float64 + // GetPublishingOffset returns PublishingOffset (property field) + GetPublishingOffset() []float64 + // IsUadpWriterGroupMessageDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUadpWriterGroupMessageDataType() + // CreateBuilder creates a UadpWriterGroupMessageDataTypeBuilder + CreateUadpWriterGroupMessageDataTypeBuilder() UadpWriterGroupMessageDataTypeBuilder +} + +// _UadpWriterGroupMessageDataType is the data-structure of this message +type _UadpWriterGroupMessageDataType struct { + ExtensionObjectDefinitionContract + GroupVersion uint32 + DataSetOrdering DataSetOrderingType + NetworkMessageContentMask UadpNetworkMessageContentMask + SamplingOffset float64 + PublishingOffset []float64 +} + +var _ UadpWriterGroupMessageDataType = (*_UadpWriterGroupMessageDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UadpWriterGroupMessageDataType)(nil) + +// NewUadpWriterGroupMessageDataType factory function for _UadpWriterGroupMessageDataType +func NewUadpWriterGroupMessageDataType(groupVersion uint32, dataSetOrdering DataSetOrderingType, networkMessageContentMask UadpNetworkMessageContentMask, samplingOffset float64, publishingOffset []float64) *_UadpWriterGroupMessageDataType { + _result := &_UadpWriterGroupMessageDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + GroupVersion: groupVersion, + DataSetOrdering: dataSetOrdering, + NetworkMessageContentMask: networkMessageContentMask, + SamplingOffset: samplingOffset, + PublishingOffset: publishingOffset, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UadpWriterGroupMessageDataTypeBuilder is a builder for UadpWriterGroupMessageDataType +type UadpWriterGroupMessageDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(groupVersion uint32, dataSetOrdering DataSetOrderingType, networkMessageContentMask UadpNetworkMessageContentMask, samplingOffset float64, publishingOffset []float64) UadpWriterGroupMessageDataTypeBuilder + // WithGroupVersion adds GroupVersion (property field) + WithGroupVersion(uint32) UadpWriterGroupMessageDataTypeBuilder + // WithDataSetOrdering adds DataSetOrdering (property field) + WithDataSetOrdering(DataSetOrderingType) UadpWriterGroupMessageDataTypeBuilder + // WithNetworkMessageContentMask adds NetworkMessageContentMask (property field) + WithNetworkMessageContentMask(UadpNetworkMessageContentMask) UadpWriterGroupMessageDataTypeBuilder + // WithSamplingOffset adds SamplingOffset (property field) + WithSamplingOffset(float64) UadpWriterGroupMessageDataTypeBuilder + // WithPublishingOffset adds PublishingOffset (property field) + WithPublishingOffset(...float64) UadpWriterGroupMessageDataTypeBuilder + // Build builds the UadpWriterGroupMessageDataType or returns an error if something is wrong + Build() (UadpWriterGroupMessageDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() UadpWriterGroupMessageDataType +} + +// NewUadpWriterGroupMessageDataTypeBuilder() creates a UadpWriterGroupMessageDataTypeBuilder +func NewUadpWriterGroupMessageDataTypeBuilder() UadpWriterGroupMessageDataTypeBuilder { + return &_UadpWriterGroupMessageDataTypeBuilder{_UadpWriterGroupMessageDataType: new(_UadpWriterGroupMessageDataType)} +} + +type _UadpWriterGroupMessageDataTypeBuilder struct { + *_UadpWriterGroupMessageDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UadpWriterGroupMessageDataTypeBuilder) = (*_UadpWriterGroupMessageDataTypeBuilder)(nil) + +func (b *_UadpWriterGroupMessageDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithMandatoryFields(groupVersion uint32, dataSetOrdering DataSetOrderingType, networkMessageContentMask UadpNetworkMessageContentMask, samplingOffset float64, publishingOffset []float64) UadpWriterGroupMessageDataTypeBuilder { + return b.WithGroupVersion(groupVersion).WithDataSetOrdering(dataSetOrdering).WithNetworkMessageContentMask(networkMessageContentMask).WithSamplingOffset(samplingOffset).WithPublishingOffset(publishingOffset...) +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithGroupVersion(groupVersion uint32) UadpWriterGroupMessageDataTypeBuilder { + b.GroupVersion = groupVersion + return b +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithDataSetOrdering(dataSetOrdering DataSetOrderingType) UadpWriterGroupMessageDataTypeBuilder { + b.DataSetOrdering = dataSetOrdering + return b +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithNetworkMessageContentMask(networkMessageContentMask UadpNetworkMessageContentMask) UadpWriterGroupMessageDataTypeBuilder { + b.NetworkMessageContentMask = networkMessageContentMask + return b +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithSamplingOffset(samplingOffset float64) UadpWriterGroupMessageDataTypeBuilder { + b.SamplingOffset = samplingOffset + return b +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) WithPublishingOffset(publishingOffset ...float64) UadpWriterGroupMessageDataTypeBuilder { + b.PublishingOffset = publishingOffset + return b +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) Build() (UadpWriterGroupMessageDataType, error) { + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UadpWriterGroupMessageDataType.deepCopy(), nil +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) MustBuild() UadpWriterGroupMessageDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UadpWriterGroupMessageDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UadpWriterGroupMessageDataTypeBuilder) DeepCopy() any { + _copy := b.CreateUadpWriterGroupMessageDataTypeBuilder().(*_UadpWriterGroupMessageDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUadpWriterGroupMessageDataTypeBuilder creates a UadpWriterGroupMessageDataTypeBuilder +func (b *_UadpWriterGroupMessageDataType) CreateUadpWriterGroupMessageDataTypeBuilder() UadpWriterGroupMessageDataTypeBuilder { + if b == nil { + return NewUadpWriterGroupMessageDataTypeBuilder() + } + return &_UadpWriterGroupMessageDataTypeBuilder{_UadpWriterGroupMessageDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UadpWriterGroupMessageDataType) GetExtensionId() int32 { + return int32(15647) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UadpWriterGroupMessageDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UadpWriterGroupMessageDataType) GetGroupVersion() uint32 { + return m.GroupVersion +} + +func (m *_UadpWriterGroupMessageDataType) GetDataSetOrdering() DataSetOrderingType { + return m.DataSetOrdering +} + +func (m *_UadpWriterGroupMessageDataType) GetNetworkMessageContentMask() UadpNetworkMessageContentMask { + return m.NetworkMessageContentMask +} + +func (m *_UadpWriterGroupMessageDataType) GetSamplingOffset() float64 { + return m.SamplingOffset +} + +func (m *_UadpWriterGroupMessageDataType) GetPublishingOffset() []float64 { + return m.PublishingOffset +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUadpWriterGroupMessageDataType(structType any) UadpWriterGroupMessageDataType { + if casted, ok := structType.(UadpWriterGroupMessageDataType); ok { + return casted + } + if casted, ok := structType.(*UadpWriterGroupMessageDataType); ok { + return *casted + } + return nil +} + +func (m *_UadpWriterGroupMessageDataType) GetTypeName() string { + return "UadpWriterGroupMessageDataType" +} + +func (m *_UadpWriterGroupMessageDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (groupVersion) + lengthInBits += 32 + + // Simple field (dataSetOrdering) + lengthInBits += 32 + + // Simple field (networkMessageContentMask) + lengthInBits += 32 + + // Simple field (samplingOffset) + lengthInBits += 64 + + // Implicit Field (noOfPublishingOffset) + lengthInBits += 32 + + // Array field + if len(m.PublishingOffset) > 0 { + lengthInBits += 64 * uint16(len(m.PublishingOffset)) + } + + return lengthInBits +} + +func (m *_UadpWriterGroupMessageDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UadpWriterGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__uadpWriterGroupMessageDataType UadpWriterGroupMessageDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UadpWriterGroupMessageDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UadpWriterGroupMessageDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + groupVersion, err := ReadSimpleField(ctx, "groupVersion", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupVersion' field")) + } + m.GroupVersion = groupVersion + + dataSetOrdering, err := ReadEnumField[DataSetOrderingType](ctx, "dataSetOrdering", "DataSetOrderingType", ReadEnum(DataSetOrderingTypeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetOrdering' field")) + } + m.DataSetOrdering = dataSetOrdering + + networkMessageContentMask, err := ReadEnumField[UadpNetworkMessageContentMask](ctx, "networkMessageContentMask", "UadpNetworkMessageContentMask", ReadEnum(UadpNetworkMessageContentMaskByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'networkMessageContentMask' field")) + } + m.NetworkMessageContentMask = networkMessageContentMask + + samplingOffset, err := ReadSimpleField(ctx, "samplingOffset", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'samplingOffset' field")) + } + m.SamplingOffset = samplingOffset + + noOfPublishingOffset, err := ReadImplicitField[int32](ctx, "noOfPublishingOffset", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfPublishingOffset' field")) + } + _ = noOfPublishingOffset + + publishingOffset, err := ReadCountArrayField[float64](ctx, "publishingOffset", ReadDouble(readBuffer, uint8(64)), uint64(noOfPublishingOffset)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishingOffset' field")) + } + m.PublishingOffset = publishingOffset + + if closeErr := readBuffer.CloseContext("UadpWriterGroupMessageDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UadpWriterGroupMessageDataType") + } + + return m, nil +} + +func (m *_UadpWriterGroupMessageDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UadpWriterGroupMessageDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UadpWriterGroupMessageDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UadpWriterGroupMessageDataType") + } + + if err := WriteSimpleField[uint32](ctx, "groupVersion", m.GetGroupVersion(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'groupVersion' field") + } + + if err := WriteSimpleEnumField[DataSetOrderingType](ctx, "dataSetOrdering", "DataSetOrderingType", m.GetDataSetOrdering(), WriteEnum[DataSetOrderingType, uint32](DataSetOrderingType.GetValue, DataSetOrderingType.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetOrdering' field") + } + + if err := WriteSimpleEnumField[UadpNetworkMessageContentMask](ctx, "networkMessageContentMask", "UadpNetworkMessageContentMask", m.GetNetworkMessageContentMask(), WriteEnum[UadpNetworkMessageContentMask, uint32](UadpNetworkMessageContentMask.GetValue, UadpNetworkMessageContentMask.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'networkMessageContentMask' field") + } + + if err := WriteSimpleField[float64](ctx, "samplingOffset", m.GetSamplingOffset(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'samplingOffset' field") + } + noOfPublishingOffset := int32(utils.InlineIf(bool((m.GetPublishingOffset()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetPublishingOffset()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfPublishingOffset", noOfPublishingOffset, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfPublishingOffset' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "publishingOffset", m.GetPublishingOffset(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'publishingOffset' field") + } + + if popErr := writeBuffer.PopContext("UadpWriterGroupMessageDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UadpWriterGroupMessageDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UadpWriterGroupMessageDataType) IsUadpWriterGroupMessageDataType() {} + +func (m *_UadpWriterGroupMessageDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UadpWriterGroupMessageDataType) deepCopy() *_UadpWriterGroupMessageDataType { + if m == nil { + return nil + } + _UadpWriterGroupMessageDataTypeCopy := &_UadpWriterGroupMessageDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.GroupVersion, + m.DataSetOrdering, + m.NetworkMessageContentMask, + m.SamplingOffset, + utils.DeepCopySlice[float64, float64](m.PublishingOffset), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UadpWriterGroupMessageDataTypeCopy +} + +func (m *_UadpWriterGroupMessageDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/Union.go b/plc4go/protocols/opcua/readwrite/model/Union.go index 11ca4b5e79b..4bca44f948b 100644 --- a/plc4go/protocols/opcua/readwrite/model/Union.go +++ b/plc4go/protocols/opcua/readwrite/model/Union.go @@ -150,8 +150,8 @@ func (b *_Union) CreateUnionBuilder() UnionBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_Union) GetIdentifier() string { - return "12758" +func (m *_Union) GetExtensionId() int32 { + return int32(12758) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_Union) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_Union) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__union Union, err error) { +func (m *_Union) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__union Union, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/UnregisterNodesRequest.go b/plc4go/protocols/opcua/readwrite/model/UnregisterNodesRequest.go index f53e2bb6c54..ecadbe087ca 100644 --- a/plc4go/protocols/opcua/readwrite/model/UnregisterNodesRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/UnregisterNodesRequest.go @@ -41,9 +41,7 @@ type UnregisterNodesRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfNodesToUnregister returns NoOfNodesToUnregister (property field) - GetNoOfNodesToUnregister() int32 + GetRequestHeader() RequestHeader // GetNodesToUnregister returns NodesToUnregister (property field) GetNodesToUnregister() []NodeId // IsUnregisterNodesRequest is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -55,23 +53,21 @@ type UnregisterNodesRequest interface { // _UnregisterNodesRequest is the data-structure of this message type _UnregisterNodesRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfNodesToUnregister int32 - NodesToUnregister []NodeId + RequestHeader RequestHeader + NodesToUnregister []NodeId } var _ UnregisterNodesRequest = (*_UnregisterNodesRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_UnregisterNodesRequest)(nil) // NewUnregisterNodesRequest factory function for _UnregisterNodesRequest -func NewUnregisterNodesRequest(requestHeader ExtensionObjectDefinition, noOfNodesToUnregister int32, nodesToUnregister []NodeId) *_UnregisterNodesRequest { +func NewUnregisterNodesRequest(requestHeader RequestHeader, nodesToUnregister []NodeId) *_UnregisterNodesRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for UnregisterNodesRequest must not be nil") + panic("requestHeader of type RequestHeader for UnregisterNodesRequest must not be nil") } _result := &_UnregisterNodesRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfNodesToUnregister: noOfNodesToUnregister, NodesToUnregister: nodesToUnregister, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,13 +83,11 @@ func NewUnregisterNodesRequest(requestHeader ExtensionObjectDefinition, noOfNode type UnregisterNodesRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToUnregister int32, nodesToUnregister []NodeId) UnregisterNodesRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, nodesToUnregister []NodeId) UnregisterNodesRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) UnregisterNodesRequestBuilder + WithRequestHeader(RequestHeader) UnregisterNodesRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) UnregisterNodesRequestBuilder - // WithNoOfNodesToUnregister adds NoOfNodesToUnregister (property field) - WithNoOfNodesToUnregister(int32) UnregisterNodesRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) UnregisterNodesRequestBuilder // WithNodesToUnregister adds NodesToUnregister (property field) WithNodesToUnregister(...NodeId) UnregisterNodesRequestBuilder // Build builds the UnregisterNodesRequest or returns an error if something is wrong @@ -121,33 +115,28 @@ func (b *_UnregisterNodesRequestBuilder) setParent(contract ExtensionObjectDefin b.ExtensionObjectDefinitionContract = contract } -func (b *_UnregisterNodesRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToUnregister int32, nodesToUnregister []NodeId) UnregisterNodesRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfNodesToUnregister(noOfNodesToUnregister).WithNodesToUnregister(nodesToUnregister...) +func (b *_UnregisterNodesRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, nodesToUnregister []NodeId) UnregisterNodesRequestBuilder { + return b.WithRequestHeader(requestHeader).WithNodesToUnregister(nodesToUnregister...) } -func (b *_UnregisterNodesRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) UnregisterNodesRequestBuilder { +func (b *_UnregisterNodesRequestBuilder) WithRequestHeader(requestHeader RequestHeader) UnregisterNodesRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_UnregisterNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) UnregisterNodesRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_UnregisterNodesRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) UnregisterNodesRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_UnregisterNodesRequestBuilder) WithNoOfNodesToUnregister(noOfNodesToUnregister int32) UnregisterNodesRequestBuilder { - b.NoOfNodesToUnregister = noOfNodesToUnregister - return b -} - func (b *_UnregisterNodesRequestBuilder) WithNodesToUnregister(nodesToUnregister ...NodeId) UnregisterNodesRequestBuilder { b.NodesToUnregister = nodesToUnregister return b @@ -209,8 +198,8 @@ func (b *_UnregisterNodesRequest) CreateUnregisterNodesRequestBuilder() Unregist /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UnregisterNodesRequest) GetIdentifier() string { - return "566" +func (m *_UnregisterNodesRequest) GetExtensionId() int32 { + return int32(566) } /////////////////////// @@ -227,14 +216,10 @@ func (m *_UnregisterNodesRequest) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_UnregisterNodesRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_UnregisterNodesRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_UnregisterNodesRequest) GetNoOfNodesToUnregister() int32 { - return m.NoOfNodesToUnregister -} - func (m *_UnregisterNodesRequest) GetNodesToUnregister() []NodeId { return m.NodesToUnregister } @@ -265,7 +250,7 @@ func (m *_UnregisterNodesRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfNodesToUnregister) + // Implicit Field (noOfNodesToUnregister) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_UnregisterNodesRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UnregisterNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__unregisterNodesRequest UnregisterNodesRequest, err error) { +func (m *_UnregisterNodesRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__unregisterNodesRequest UnregisterNodesRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,17 +281,17 @@ func (m *_UnregisterNodesRequest) parse(ctx context.Context, readBuffer utils.Re currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfNodesToUnregister, err := ReadSimpleField(ctx, "noOfNodesToUnregister", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToUnregister, err := ReadImplicitField[int32](ctx, "noOfNodesToUnregister", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToUnregister' field")) } - m.NoOfNodesToUnregister = noOfNodesToUnregister + _ = noOfNodesToUnregister nodesToUnregister, err := ReadCountArrayField[NodeId](ctx, "nodesToUnregister", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer), uint64(noOfNodesToUnregister)) if err != nil { @@ -339,11 +324,11 @@ func (m *_UnregisterNodesRequest) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for UnregisterNodesRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToUnregister", m.GetNoOfNodesToUnregister(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToUnregister := int32(utils.InlineIf(bool((m.GetNodesToUnregister()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToUnregister()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToUnregister", noOfNodesToUnregister, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToUnregister' field") } @@ -371,8 +356,7 @@ func (m *_UnregisterNodesRequest) deepCopy() *_UnregisterNodesRequest { } _UnregisterNodesRequestCopy := &_UnregisterNodesRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodesToUnregister, + m.RequestHeader.DeepCopy().(RequestHeader), utils.DeepCopySlice[NodeId, NodeId](m.NodesToUnregister), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/UnregisterNodesResponse.go b/plc4go/protocols/opcua/readwrite/model/UnregisterNodesResponse.go index 43c21191b40..20028592747 100644 --- a/plc4go/protocols/opcua/readwrite/model/UnregisterNodesResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/UnregisterNodesResponse.go @@ -41,7 +41,7 @@ type UnregisterNodesResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition + GetResponseHeader() ResponseHeader // IsUnregisterNodesResponse is a marker method to prevent unintentional type checks (interfaces of same signature) IsUnregisterNodesResponse() // CreateBuilder creates a UnregisterNodesResponseBuilder @@ -51,16 +51,16 @@ type UnregisterNodesResponse interface { // _UnregisterNodesResponse is the data-structure of this message type _UnregisterNodesResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition + ResponseHeader ResponseHeader } var _ UnregisterNodesResponse = (*_UnregisterNodesResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_UnregisterNodesResponse)(nil) // NewUnregisterNodesResponse factory function for _UnregisterNodesResponse -func NewUnregisterNodesResponse(responseHeader ExtensionObjectDefinition) *_UnregisterNodesResponse { +func NewUnregisterNodesResponse(responseHeader ResponseHeader) *_UnregisterNodesResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for UnregisterNodesResponse must not be nil") + panic("responseHeader of type ResponseHeader for UnregisterNodesResponse must not be nil") } _result := &_UnregisterNodesResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), @@ -79,11 +79,11 @@ func NewUnregisterNodesResponse(responseHeader ExtensionObjectDefinition) *_Unre type UnregisterNodesResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition) UnregisterNodesResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader) UnregisterNodesResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) UnregisterNodesResponseBuilder + WithResponseHeader(ResponseHeader) UnregisterNodesResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) UnregisterNodesResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) UnregisterNodesResponseBuilder // Build builds the UnregisterNodesResponse or returns an error if something is wrong Build() (UnregisterNodesResponse, error) // MustBuild does the same as Build but panics on error @@ -109,24 +109,24 @@ func (b *_UnregisterNodesResponseBuilder) setParent(contract ExtensionObjectDefi b.ExtensionObjectDefinitionContract = contract } -func (b *_UnregisterNodesResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition) UnregisterNodesResponseBuilder { +func (b *_UnregisterNodesResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader) UnregisterNodesResponseBuilder { return b.WithResponseHeader(responseHeader) } -func (b *_UnregisterNodesResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) UnregisterNodesResponseBuilder { +func (b *_UnregisterNodesResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) UnregisterNodesResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_UnregisterNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) UnregisterNodesResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_UnregisterNodesResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) UnregisterNodesResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } @@ -187,8 +187,8 @@ func (b *_UnregisterNodesResponse) CreateUnregisterNodesResponseBuilder() Unregi /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UnregisterNodesResponse) GetIdentifier() string { - return "569" +func (m *_UnregisterNodesResponse) GetExtensionId() int32 { + return int32(569) } /////////////////////// @@ -205,7 +205,7 @@ func (m *_UnregisterNodesResponse) GetParent() ExtensionObjectDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// -func (m *_UnregisterNodesResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_UnregisterNodesResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } @@ -242,7 +242,7 @@ func (m *_UnregisterNodesResponse) GetLengthInBytes(ctx context.Context) uint16 return m.GetLengthInBits(ctx) / 8 } -func (m *_UnregisterNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__unregisterNodesResponse UnregisterNodesResponse, err error) { +func (m *_UnregisterNodesResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__unregisterNodesResponse UnregisterNodesResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -253,7 +253,7 @@ func (m *_UnregisterNodesResponse) parse(ctx context.Context, readBuffer utils.R currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } @@ -284,7 +284,7 @@ func (m *_UnregisterNodesResponse) SerializeWithWriteBuffer(ctx context.Context, return errors.Wrap(pushErr, "Error pushing for UnregisterNodesResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } @@ -308,7 +308,7 @@ func (m *_UnregisterNodesResponse) deepCopy() *_UnregisterNodesResponse { } _UnregisterNodesResponseCopy := &_UnregisterNodesResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), + m.ResponseHeader.DeepCopy().(ResponseHeader), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _UnregisterNodesResponseCopy diff --git a/plc4go/protocols/opcua/readwrite/model/UnsignedRationalNumber.go b/plc4go/protocols/opcua/readwrite/model/UnsignedRationalNumber.go index d21b53423bc..3580692513b 100644 --- a/plc4go/protocols/opcua/readwrite/model/UnsignedRationalNumber.go +++ b/plc4go/protocols/opcua/readwrite/model/UnsignedRationalNumber.go @@ -174,8 +174,8 @@ func (b *_UnsignedRationalNumber) CreateUnsignedRationalNumberBuilder() Unsigned /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UnsignedRationalNumber) GetIdentifier() string { - return "24109" +func (m *_UnsignedRationalNumber) GetExtensionId() int32 { + return int32(24109) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_UnsignedRationalNumber) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UnsignedRationalNumber) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__unsignedRationalNumber UnsignedRationalNumber, err error) { +func (m *_UnsignedRationalNumber) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__unsignedRationalNumber UnsignedRationalNumber, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/UpdateDataDetails.go b/plc4go/protocols/opcua/readwrite/model/UpdateDataDetails.go new file mode 100644 index 00000000000..636e07dc937 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UpdateDataDetails.go @@ -0,0 +1,408 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UpdateDataDetails is the corresponding interface of UpdateDataDetails +type UpdateDataDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetPerformInsertReplace returns PerformInsertReplace (property field) + GetPerformInsertReplace() PerformUpdateType + // GetUpdateValues returns UpdateValues (property field) + GetUpdateValues() []DataValue + // IsUpdateDataDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUpdateDataDetails() + // CreateBuilder creates a UpdateDataDetailsBuilder + CreateUpdateDataDetailsBuilder() UpdateDataDetailsBuilder +} + +// _UpdateDataDetails is the data-structure of this message +type _UpdateDataDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + PerformInsertReplace PerformUpdateType + UpdateValues []DataValue +} + +var _ UpdateDataDetails = (*_UpdateDataDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UpdateDataDetails)(nil) + +// NewUpdateDataDetails factory function for _UpdateDataDetails +func NewUpdateDataDetails(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) *_UpdateDataDetails { + if nodeId == nil { + panic("nodeId of type NodeId for UpdateDataDetails must not be nil") + } + _result := &_UpdateDataDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + PerformInsertReplace: performInsertReplace, + UpdateValues: updateValues, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UpdateDataDetailsBuilder is a builder for UpdateDataDetails +type UpdateDataDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) UpdateDataDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) UpdateDataDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) UpdateDataDetailsBuilder + // WithPerformInsertReplace adds PerformInsertReplace (property field) + WithPerformInsertReplace(PerformUpdateType) UpdateDataDetailsBuilder + // WithUpdateValues adds UpdateValues (property field) + WithUpdateValues(...DataValue) UpdateDataDetailsBuilder + // Build builds the UpdateDataDetails or returns an error if something is wrong + Build() (UpdateDataDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() UpdateDataDetails +} + +// NewUpdateDataDetailsBuilder() creates a UpdateDataDetailsBuilder +func NewUpdateDataDetailsBuilder() UpdateDataDetailsBuilder { + return &_UpdateDataDetailsBuilder{_UpdateDataDetails: new(_UpdateDataDetails)} +} + +type _UpdateDataDetailsBuilder struct { + *_UpdateDataDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UpdateDataDetailsBuilder) = (*_UpdateDataDetailsBuilder)(nil) + +func (b *_UpdateDataDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UpdateDataDetailsBuilder) WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) UpdateDataDetailsBuilder { + return b.WithNodeId(nodeId).WithPerformInsertReplace(performInsertReplace).WithUpdateValues(updateValues...) +} + +func (b *_UpdateDataDetailsBuilder) WithNodeId(nodeId NodeId) UpdateDataDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_UpdateDataDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) UpdateDataDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_UpdateDataDetailsBuilder) WithPerformInsertReplace(performInsertReplace PerformUpdateType) UpdateDataDetailsBuilder { + b.PerformInsertReplace = performInsertReplace + return b +} + +func (b *_UpdateDataDetailsBuilder) WithUpdateValues(updateValues ...DataValue) UpdateDataDetailsBuilder { + b.UpdateValues = updateValues + return b +} + +func (b *_UpdateDataDetailsBuilder) Build() (UpdateDataDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UpdateDataDetails.deepCopy(), nil +} + +func (b *_UpdateDataDetailsBuilder) MustBuild() UpdateDataDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UpdateDataDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UpdateDataDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UpdateDataDetailsBuilder) DeepCopy() any { + _copy := b.CreateUpdateDataDetailsBuilder().(*_UpdateDataDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUpdateDataDetailsBuilder creates a UpdateDataDetailsBuilder +func (b *_UpdateDataDetails) CreateUpdateDataDetailsBuilder() UpdateDataDetailsBuilder { + if b == nil { + return NewUpdateDataDetailsBuilder() + } + return &_UpdateDataDetailsBuilder{_UpdateDataDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UpdateDataDetails) GetExtensionId() int32 { + return int32(682) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UpdateDataDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UpdateDataDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_UpdateDataDetails) GetPerformInsertReplace() PerformUpdateType { + return m.PerformInsertReplace +} + +func (m *_UpdateDataDetails) GetUpdateValues() []DataValue { + return m.UpdateValues +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUpdateDataDetails(structType any) UpdateDataDetails { + if casted, ok := structType.(UpdateDataDetails); ok { + return casted + } + if casted, ok := structType.(*UpdateDataDetails); ok { + return *casted + } + return nil +} + +func (m *_UpdateDataDetails) GetTypeName() string { + return "UpdateDataDetails" +} + +func (m *_UpdateDataDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Simple field (performInsertReplace) + lengthInBits += 32 + + // Implicit Field (noOfUpdateValues) + lengthInBits += 32 + + // Array field + if len(m.UpdateValues) > 0 { + for _curItem, element := range m.UpdateValues { + arrayCtx := utils.CreateArrayContext(ctx, len(m.UpdateValues), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_UpdateDataDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UpdateDataDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__updateDataDetails UpdateDataDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UpdateDataDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UpdateDataDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + performInsertReplace, err := ReadEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", ReadEnum(PerformUpdateTypeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'performInsertReplace' field")) + } + m.PerformInsertReplace = performInsertReplace + + noOfUpdateValues, err := ReadImplicitField[int32](ctx, "noOfUpdateValues", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfUpdateValues' field")) + } + _ = noOfUpdateValues + + updateValues, err := ReadCountArrayField[DataValue](ctx, "updateValues", ReadComplex[DataValue](DataValueParseWithBuffer, readBuffer), uint64(noOfUpdateValues)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'updateValues' field")) + } + m.UpdateValues = updateValues + + if closeErr := readBuffer.CloseContext("UpdateDataDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UpdateDataDetails") + } + + return m, nil +} + +func (m *_UpdateDataDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UpdateDataDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UpdateDataDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UpdateDataDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + + if err := WriteSimpleEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", m.GetPerformInsertReplace(), WriteEnum[PerformUpdateType, uint32](PerformUpdateType.GetValue, PerformUpdateType.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'performInsertReplace' field") + } + noOfUpdateValues := int32(utils.InlineIf(bool((m.GetUpdateValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetUpdateValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfUpdateValues", noOfUpdateValues, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfUpdateValues' field") + } + + if err := WriteComplexTypeArrayField(ctx, "updateValues", m.GetUpdateValues(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'updateValues' field") + } + + if popErr := writeBuffer.PopContext("UpdateDataDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UpdateDataDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UpdateDataDetails) IsUpdateDataDetails() {} + +func (m *_UpdateDataDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UpdateDataDetails) deepCopy() *_UpdateDataDetails { + if m == nil { + return nil + } + _UpdateDataDetailsCopy := &_UpdateDataDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + m.PerformInsertReplace, + utils.DeepCopySlice[DataValue, DataValue](m.UpdateValues), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UpdateDataDetailsCopy +} + +func (m *_UpdateDataDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UpdateEventDetails.go b/plc4go/protocols/opcua/readwrite/model/UpdateEventDetails.go new file mode 100644 index 00000000000..b3a445d1e33 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UpdateEventDetails.go @@ -0,0 +1,461 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UpdateEventDetails is the corresponding interface of UpdateEventDetails +type UpdateEventDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetPerformInsertReplace returns PerformInsertReplace (property field) + GetPerformInsertReplace() PerformUpdateType + // GetFilter returns Filter (property field) + GetFilter() EventFilter + // GetEventData returns EventData (property field) + GetEventData() []HistoryEventFieldList + // IsUpdateEventDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUpdateEventDetails() + // CreateBuilder creates a UpdateEventDetailsBuilder + CreateUpdateEventDetailsBuilder() UpdateEventDetailsBuilder +} + +// _UpdateEventDetails is the data-structure of this message +type _UpdateEventDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + PerformInsertReplace PerformUpdateType + Filter EventFilter + EventData []HistoryEventFieldList +} + +var _ UpdateEventDetails = (*_UpdateEventDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UpdateEventDetails)(nil) + +// NewUpdateEventDetails factory function for _UpdateEventDetails +func NewUpdateEventDetails(nodeId NodeId, performInsertReplace PerformUpdateType, filter EventFilter, eventData []HistoryEventFieldList) *_UpdateEventDetails { + if nodeId == nil { + panic("nodeId of type NodeId for UpdateEventDetails must not be nil") + } + if filter == nil { + panic("filter of type EventFilter for UpdateEventDetails must not be nil") + } + _result := &_UpdateEventDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + PerformInsertReplace: performInsertReplace, + Filter: filter, + EventData: eventData, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UpdateEventDetailsBuilder is a builder for UpdateEventDetails +type UpdateEventDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, filter EventFilter, eventData []HistoryEventFieldList) UpdateEventDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) UpdateEventDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) UpdateEventDetailsBuilder + // WithPerformInsertReplace adds PerformInsertReplace (property field) + WithPerformInsertReplace(PerformUpdateType) UpdateEventDetailsBuilder + // WithFilter adds Filter (property field) + WithFilter(EventFilter) UpdateEventDetailsBuilder + // WithFilterBuilder adds Filter (property field) which is build by the builder + WithFilterBuilder(func(EventFilterBuilder) EventFilterBuilder) UpdateEventDetailsBuilder + // WithEventData adds EventData (property field) + WithEventData(...HistoryEventFieldList) UpdateEventDetailsBuilder + // Build builds the UpdateEventDetails or returns an error if something is wrong + Build() (UpdateEventDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() UpdateEventDetails +} + +// NewUpdateEventDetailsBuilder() creates a UpdateEventDetailsBuilder +func NewUpdateEventDetailsBuilder() UpdateEventDetailsBuilder { + return &_UpdateEventDetailsBuilder{_UpdateEventDetails: new(_UpdateEventDetails)} +} + +type _UpdateEventDetailsBuilder struct { + *_UpdateEventDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UpdateEventDetailsBuilder) = (*_UpdateEventDetailsBuilder)(nil) + +func (b *_UpdateEventDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UpdateEventDetailsBuilder) WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, filter EventFilter, eventData []HistoryEventFieldList) UpdateEventDetailsBuilder { + return b.WithNodeId(nodeId).WithPerformInsertReplace(performInsertReplace).WithFilter(filter).WithEventData(eventData...) +} + +func (b *_UpdateEventDetailsBuilder) WithNodeId(nodeId NodeId) UpdateEventDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_UpdateEventDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) UpdateEventDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_UpdateEventDetailsBuilder) WithPerformInsertReplace(performInsertReplace PerformUpdateType) UpdateEventDetailsBuilder { + b.PerformInsertReplace = performInsertReplace + return b +} + +func (b *_UpdateEventDetailsBuilder) WithFilter(filter EventFilter) UpdateEventDetailsBuilder { + b.Filter = filter + return b +} + +func (b *_UpdateEventDetailsBuilder) WithFilterBuilder(builderSupplier func(EventFilterBuilder) EventFilterBuilder) UpdateEventDetailsBuilder { + builder := builderSupplier(b.Filter.CreateEventFilterBuilder()) + var err error + b.Filter, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "EventFilterBuilder failed")) + } + return b +} + +func (b *_UpdateEventDetailsBuilder) WithEventData(eventData ...HistoryEventFieldList) UpdateEventDetailsBuilder { + b.EventData = eventData + return b +} + +func (b *_UpdateEventDetailsBuilder) Build() (UpdateEventDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.Filter == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'filter' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UpdateEventDetails.deepCopy(), nil +} + +func (b *_UpdateEventDetailsBuilder) MustBuild() UpdateEventDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UpdateEventDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UpdateEventDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UpdateEventDetailsBuilder) DeepCopy() any { + _copy := b.CreateUpdateEventDetailsBuilder().(*_UpdateEventDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUpdateEventDetailsBuilder creates a UpdateEventDetailsBuilder +func (b *_UpdateEventDetails) CreateUpdateEventDetailsBuilder() UpdateEventDetailsBuilder { + if b == nil { + return NewUpdateEventDetailsBuilder() + } + return &_UpdateEventDetailsBuilder{_UpdateEventDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UpdateEventDetails) GetExtensionId() int32 { + return int32(685) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UpdateEventDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UpdateEventDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_UpdateEventDetails) GetPerformInsertReplace() PerformUpdateType { + return m.PerformInsertReplace +} + +func (m *_UpdateEventDetails) GetFilter() EventFilter { + return m.Filter +} + +func (m *_UpdateEventDetails) GetEventData() []HistoryEventFieldList { + return m.EventData +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUpdateEventDetails(structType any) UpdateEventDetails { + if casted, ok := structType.(UpdateEventDetails); ok { + return casted + } + if casted, ok := structType.(*UpdateEventDetails); ok { + return *casted + } + return nil +} + +func (m *_UpdateEventDetails) GetTypeName() string { + return "UpdateEventDetails" +} + +func (m *_UpdateEventDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Simple field (performInsertReplace) + lengthInBits += 32 + + // Simple field (filter) + lengthInBits += m.Filter.GetLengthInBits(ctx) + + // Implicit Field (noOfEventData) + lengthInBits += 32 + + // Array field + if len(m.EventData) > 0 { + for _curItem, element := range m.EventData { + arrayCtx := utils.CreateArrayContext(ctx, len(m.EventData), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_UpdateEventDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UpdateEventDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__updateEventDetails UpdateEventDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UpdateEventDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UpdateEventDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + performInsertReplace, err := ReadEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", ReadEnum(PerformUpdateTypeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'performInsertReplace' field")) + } + m.PerformInsertReplace = performInsertReplace + + filter, err := ReadSimpleField[EventFilter](ctx, "filter", ReadComplex[EventFilter](ExtensionObjectDefinitionParseWithBufferProducer[EventFilter]((int32)(int32(727))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'filter' field")) + } + m.Filter = filter + + noOfEventData, err := ReadImplicitField[int32](ctx, "noOfEventData", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfEventData' field")) + } + _ = noOfEventData + + eventData, err := ReadCountArrayField[HistoryEventFieldList](ctx, "eventData", ReadComplex[HistoryEventFieldList](ExtensionObjectDefinitionParseWithBufferProducer[HistoryEventFieldList]((int32)(int32(922))), readBuffer), uint64(noOfEventData)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eventData' field")) + } + m.EventData = eventData + + if closeErr := readBuffer.CloseContext("UpdateEventDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UpdateEventDetails") + } + + return m, nil +} + +func (m *_UpdateEventDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UpdateEventDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UpdateEventDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UpdateEventDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + + if err := WriteSimpleEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", m.GetPerformInsertReplace(), WriteEnum[PerformUpdateType, uint32](PerformUpdateType.GetValue, PerformUpdateType.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'performInsertReplace' field") + } + + if err := WriteSimpleField[EventFilter](ctx, "filter", m.GetFilter(), WriteComplex[EventFilter](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'filter' field") + } + noOfEventData := int32(utils.InlineIf(bool((m.GetEventData()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetEventData()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfEventData", noOfEventData, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfEventData' field") + } + + if err := WriteComplexTypeArrayField(ctx, "eventData", m.GetEventData(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'eventData' field") + } + + if popErr := writeBuffer.PopContext("UpdateEventDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UpdateEventDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UpdateEventDetails) IsUpdateEventDetails() {} + +func (m *_UpdateEventDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UpdateEventDetails) deepCopy() *_UpdateEventDetails { + if m == nil { + return nil + } + _UpdateEventDetailsCopy := &_UpdateEventDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + m.PerformInsertReplace, + m.Filter.DeepCopy().(EventFilter), + utils.DeepCopySlice[HistoryEventFieldList, HistoryEventFieldList](m.EventData), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UpdateEventDetailsCopy +} + +func (m *_UpdateEventDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UpdateStructureDataDetails.go b/plc4go/protocols/opcua/readwrite/model/UpdateStructureDataDetails.go new file mode 100644 index 00000000000..e7cd78573f5 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/UpdateStructureDataDetails.go @@ -0,0 +1,408 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// UpdateStructureDataDetails is the corresponding interface of UpdateStructureDataDetails +type UpdateStructureDataDetails interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetNodeId returns NodeId (property field) + GetNodeId() NodeId + // GetPerformInsertReplace returns PerformInsertReplace (property field) + GetPerformInsertReplace() PerformUpdateType + // GetUpdateValues returns UpdateValues (property field) + GetUpdateValues() []DataValue + // IsUpdateStructureDataDetails is a marker method to prevent unintentional type checks (interfaces of same signature) + IsUpdateStructureDataDetails() + // CreateBuilder creates a UpdateStructureDataDetailsBuilder + CreateUpdateStructureDataDetailsBuilder() UpdateStructureDataDetailsBuilder +} + +// _UpdateStructureDataDetails is the data-structure of this message +type _UpdateStructureDataDetails struct { + ExtensionObjectDefinitionContract + NodeId NodeId + PerformInsertReplace PerformUpdateType + UpdateValues []DataValue +} + +var _ UpdateStructureDataDetails = (*_UpdateStructureDataDetails)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UpdateStructureDataDetails)(nil) + +// NewUpdateStructureDataDetails factory function for _UpdateStructureDataDetails +func NewUpdateStructureDataDetails(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) *_UpdateStructureDataDetails { + if nodeId == nil { + panic("nodeId of type NodeId for UpdateStructureDataDetails must not be nil") + } + _result := &_UpdateStructureDataDetails{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + NodeId: nodeId, + PerformInsertReplace: performInsertReplace, + UpdateValues: updateValues, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// UpdateStructureDataDetailsBuilder is a builder for UpdateStructureDataDetails +type UpdateStructureDataDetailsBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) UpdateStructureDataDetailsBuilder + // WithNodeId adds NodeId (property field) + WithNodeId(NodeId) UpdateStructureDataDetailsBuilder + // WithNodeIdBuilder adds NodeId (property field) which is build by the builder + WithNodeIdBuilder(func(NodeIdBuilder) NodeIdBuilder) UpdateStructureDataDetailsBuilder + // WithPerformInsertReplace adds PerformInsertReplace (property field) + WithPerformInsertReplace(PerformUpdateType) UpdateStructureDataDetailsBuilder + // WithUpdateValues adds UpdateValues (property field) + WithUpdateValues(...DataValue) UpdateStructureDataDetailsBuilder + // Build builds the UpdateStructureDataDetails or returns an error if something is wrong + Build() (UpdateStructureDataDetails, error) + // MustBuild does the same as Build but panics on error + MustBuild() UpdateStructureDataDetails +} + +// NewUpdateStructureDataDetailsBuilder() creates a UpdateStructureDataDetailsBuilder +func NewUpdateStructureDataDetailsBuilder() UpdateStructureDataDetailsBuilder { + return &_UpdateStructureDataDetailsBuilder{_UpdateStructureDataDetails: new(_UpdateStructureDataDetails)} +} + +type _UpdateStructureDataDetailsBuilder struct { + *_UpdateStructureDataDetails + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (UpdateStructureDataDetailsBuilder) = (*_UpdateStructureDataDetailsBuilder)(nil) + +func (b *_UpdateStructureDataDetailsBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UpdateStructureDataDetailsBuilder) WithMandatoryFields(nodeId NodeId, performInsertReplace PerformUpdateType, updateValues []DataValue) UpdateStructureDataDetailsBuilder { + return b.WithNodeId(nodeId).WithPerformInsertReplace(performInsertReplace).WithUpdateValues(updateValues...) +} + +func (b *_UpdateStructureDataDetailsBuilder) WithNodeId(nodeId NodeId) UpdateStructureDataDetailsBuilder { + b.NodeId = nodeId + return b +} + +func (b *_UpdateStructureDataDetailsBuilder) WithNodeIdBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) UpdateStructureDataDetailsBuilder { + builder := builderSupplier(b.NodeId.CreateNodeIdBuilder()) + var err error + b.NodeId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_UpdateStructureDataDetailsBuilder) WithPerformInsertReplace(performInsertReplace PerformUpdateType) UpdateStructureDataDetailsBuilder { + b.PerformInsertReplace = performInsertReplace + return b +} + +func (b *_UpdateStructureDataDetailsBuilder) WithUpdateValues(updateValues ...DataValue) UpdateStructureDataDetailsBuilder { + b.UpdateValues = updateValues + return b +} + +func (b *_UpdateStructureDataDetailsBuilder) Build() (UpdateStructureDataDetails, error) { + if b.NodeId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'nodeId' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._UpdateStructureDataDetails.deepCopy(), nil +} + +func (b *_UpdateStructureDataDetailsBuilder) MustBuild() UpdateStructureDataDetails { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_UpdateStructureDataDetailsBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_UpdateStructureDataDetailsBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_UpdateStructureDataDetailsBuilder) DeepCopy() any { + _copy := b.CreateUpdateStructureDataDetailsBuilder().(*_UpdateStructureDataDetailsBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateUpdateStructureDataDetailsBuilder creates a UpdateStructureDataDetailsBuilder +func (b *_UpdateStructureDataDetails) CreateUpdateStructureDataDetailsBuilder() UpdateStructureDataDetailsBuilder { + if b == nil { + return NewUpdateStructureDataDetailsBuilder() + } + return &_UpdateStructureDataDetailsBuilder{_UpdateStructureDataDetails: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_UpdateStructureDataDetails) GetExtensionId() int32 { + return int32(11297) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_UpdateStructureDataDetails) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_UpdateStructureDataDetails) GetNodeId() NodeId { + return m.NodeId +} + +func (m *_UpdateStructureDataDetails) GetPerformInsertReplace() PerformUpdateType { + return m.PerformInsertReplace +} + +func (m *_UpdateStructureDataDetails) GetUpdateValues() []DataValue { + return m.UpdateValues +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastUpdateStructureDataDetails(structType any) UpdateStructureDataDetails { + if casted, ok := structType.(UpdateStructureDataDetails); ok { + return casted + } + if casted, ok := structType.(*UpdateStructureDataDetails); ok { + return *casted + } + return nil +} + +func (m *_UpdateStructureDataDetails) GetTypeName() string { + return "UpdateStructureDataDetails" +} + +func (m *_UpdateStructureDataDetails) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (nodeId) + lengthInBits += m.NodeId.GetLengthInBits(ctx) + + // Simple field (performInsertReplace) + lengthInBits += 32 + + // Implicit Field (noOfUpdateValues) + lengthInBits += 32 + + // Array field + if len(m.UpdateValues) > 0 { + for _curItem, element := range m.UpdateValues { + arrayCtx := utils.CreateArrayContext(ctx, len(m.UpdateValues), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_UpdateStructureDataDetails) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_UpdateStructureDataDetails) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__updateStructureDataDetails UpdateStructureDataDetails, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("UpdateStructureDataDetails"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for UpdateStructureDataDetails") + } + currentPos := positionAware.GetPos() + _ = currentPos + + nodeId, err := ReadSimpleField[NodeId](ctx, "nodeId", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodeId' field")) + } + m.NodeId = nodeId + + performInsertReplace, err := ReadEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", ReadEnum(PerformUpdateTypeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'performInsertReplace' field")) + } + m.PerformInsertReplace = performInsertReplace + + noOfUpdateValues, err := ReadImplicitField[int32](ctx, "noOfUpdateValues", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfUpdateValues' field")) + } + _ = noOfUpdateValues + + updateValues, err := ReadCountArrayField[DataValue](ctx, "updateValues", ReadComplex[DataValue](DataValueParseWithBuffer, readBuffer), uint64(noOfUpdateValues)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'updateValues' field")) + } + m.UpdateValues = updateValues + + if closeErr := readBuffer.CloseContext("UpdateStructureDataDetails"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for UpdateStructureDataDetails") + } + + return m, nil +} + +func (m *_UpdateStructureDataDetails) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_UpdateStructureDataDetails) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("UpdateStructureDataDetails"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for UpdateStructureDataDetails") + } + + if err := WriteSimpleField[NodeId](ctx, "nodeId", m.GetNodeId(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'nodeId' field") + } + + if err := WriteSimpleEnumField[PerformUpdateType](ctx, "performInsertReplace", "PerformUpdateType", m.GetPerformInsertReplace(), WriteEnum[PerformUpdateType, uint32](PerformUpdateType.GetValue, PerformUpdateType.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'performInsertReplace' field") + } + noOfUpdateValues := int32(utils.InlineIf(bool((m.GetUpdateValues()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetUpdateValues()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfUpdateValues", noOfUpdateValues, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfUpdateValues' field") + } + + if err := WriteComplexTypeArrayField(ctx, "updateValues", m.GetUpdateValues(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'updateValues' field") + } + + if popErr := writeBuffer.PopContext("UpdateStructureDataDetails"); popErr != nil { + return errors.Wrap(popErr, "Error popping for UpdateStructureDataDetails") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_UpdateStructureDataDetails) IsUpdateStructureDataDetails() {} + +func (m *_UpdateStructureDataDetails) DeepCopy() any { + return m.deepCopy() +} + +func (m *_UpdateStructureDataDetails) deepCopy() *_UpdateStructureDataDetails { + if m == nil { + return nil + } + _UpdateStructureDataDetailsCopy := &_UpdateStructureDataDetails{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.NodeId.DeepCopy().(NodeId), + m.PerformInsertReplace, + utils.DeepCopySlice[DataValue, DataValue](m.UpdateValues), + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _UpdateStructureDataDetailsCopy +} + +func (m *_UpdateStructureDataDetails) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/UserIdentityToken.go b/plc4go/protocols/opcua/readwrite/model/UserIdentityToken.go index 6edbc7c3d2c..fb089c1d896 100644 --- a/plc4go/protocols/opcua/readwrite/model/UserIdentityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/UserIdentityToken.go @@ -42,8 +42,6 @@ type UserIdentityToken interface { ExtensionObjectDefinition // GetPolicyId returns PolicyId (property field) GetPolicyId() PascalString - // GetUserIdentityTokenDefinition returns UserIdentityTokenDefinition (property field) - GetUserIdentityTokenDefinition() UserIdentityTokenDefinition // IsUserIdentityToken is a marker method to prevent unintentional type checks (interfaces of same signature) IsUserIdentityToken() // CreateBuilder creates a UserIdentityTokenBuilder @@ -53,25 +51,20 @@ type UserIdentityToken interface { // _UserIdentityToken is the data-structure of this message type _UserIdentityToken struct { ExtensionObjectDefinitionContract - PolicyId PascalString - UserIdentityTokenDefinition UserIdentityTokenDefinition + PolicyId PascalString } var _ UserIdentityToken = (*_UserIdentityToken)(nil) var _ ExtensionObjectDefinitionRequirements = (*_UserIdentityToken)(nil) // NewUserIdentityToken factory function for _UserIdentityToken -func NewUserIdentityToken(policyId PascalString, userIdentityTokenDefinition UserIdentityTokenDefinition) *_UserIdentityToken { +func NewUserIdentityToken(policyId PascalString) *_UserIdentityToken { if policyId == nil { panic("policyId of type PascalString for UserIdentityToken must not be nil") } - if userIdentityTokenDefinition == nil { - panic("userIdentityTokenDefinition of type UserIdentityTokenDefinition for UserIdentityToken must not be nil") - } _result := &_UserIdentityToken{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), PolicyId: policyId, - UserIdentityTokenDefinition: userIdentityTokenDefinition, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result return _result @@ -86,15 +79,11 @@ func NewUserIdentityToken(policyId PascalString, userIdentityTokenDefinition Use type UserIdentityTokenBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(policyId PascalString, userIdentityTokenDefinition UserIdentityTokenDefinition) UserIdentityTokenBuilder + WithMandatoryFields(policyId PascalString) UserIdentityTokenBuilder // WithPolicyId adds PolicyId (property field) WithPolicyId(PascalString) UserIdentityTokenBuilder // WithPolicyIdBuilder adds PolicyId (property field) which is build by the builder WithPolicyIdBuilder(func(PascalStringBuilder) PascalStringBuilder) UserIdentityTokenBuilder - // WithUserIdentityTokenDefinition adds UserIdentityTokenDefinition (property field) - WithUserIdentityTokenDefinition(UserIdentityTokenDefinition) UserIdentityTokenBuilder - // WithUserIdentityTokenDefinitionBuilder adds UserIdentityTokenDefinition (property field) which is build by the builder - WithUserIdentityTokenDefinitionBuilder(func(UserIdentityTokenDefinitionBuilder) UserIdentityTokenDefinitionBuilder) UserIdentityTokenBuilder // Build builds the UserIdentityToken or returns an error if something is wrong Build() (UserIdentityToken, error) // MustBuild does the same as Build but panics on error @@ -120,8 +109,8 @@ func (b *_UserIdentityTokenBuilder) setParent(contract ExtensionObjectDefinition b.ExtensionObjectDefinitionContract = contract } -func (b *_UserIdentityTokenBuilder) WithMandatoryFields(policyId PascalString, userIdentityTokenDefinition UserIdentityTokenDefinition) UserIdentityTokenBuilder { - return b.WithPolicyId(policyId).WithUserIdentityTokenDefinition(userIdentityTokenDefinition) +func (b *_UserIdentityTokenBuilder) WithMandatoryFields(policyId PascalString) UserIdentityTokenBuilder { + return b.WithPolicyId(policyId) } func (b *_UserIdentityTokenBuilder) WithPolicyId(policyId PascalString) UserIdentityTokenBuilder { @@ -142,24 +131,6 @@ func (b *_UserIdentityTokenBuilder) WithPolicyIdBuilder(builderSupplier func(Pas return b } -func (b *_UserIdentityTokenBuilder) WithUserIdentityTokenDefinition(userIdentityTokenDefinition UserIdentityTokenDefinition) UserIdentityTokenBuilder { - b.UserIdentityTokenDefinition = userIdentityTokenDefinition - return b -} - -func (b *_UserIdentityTokenBuilder) WithUserIdentityTokenDefinitionBuilder(builderSupplier func(UserIdentityTokenDefinitionBuilder) UserIdentityTokenDefinitionBuilder) UserIdentityTokenBuilder { - builder := builderSupplier(b.UserIdentityTokenDefinition.CreateUserIdentityTokenDefinitionBuilder()) - var err error - b.UserIdentityTokenDefinition, err = builder.Build() - if err != nil { - if b.err == nil { - b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} - } - b.err.Append(errors.Wrap(err, "UserIdentityTokenDefinitionBuilder failed")) - } - return b -} - func (b *_UserIdentityTokenBuilder) Build() (UserIdentityToken, error) { if b.PolicyId == nil { if b.err == nil { @@ -167,12 +138,6 @@ func (b *_UserIdentityTokenBuilder) Build() (UserIdentityToken, error) { } b.err.Append(errors.New("mandatory field 'policyId' not set")) } - if b.UserIdentityTokenDefinition == nil { - if b.err == nil { - b.err = new(utils.MultiError) - } - b.err.Append(errors.New("mandatory field 'userIdentityTokenDefinition' not set")) - } if b.err != nil { return nil, errors.Wrap(b.err, "error occurred during build") } @@ -222,8 +187,8 @@ func (b *_UserIdentityToken) CreateUserIdentityTokenBuilder() UserIdentityTokenB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UserIdentityToken) GetIdentifier() string { - return "316" +func (m *_UserIdentityToken) GetExtensionId() int32 { + return int32(318) } /////////////////////// @@ -244,10 +209,6 @@ func (m *_UserIdentityToken) GetPolicyId() PascalString { return m.PolicyId } -func (m *_UserIdentityToken) GetUserIdentityTokenDefinition() UserIdentityTokenDefinition { - return m.UserIdentityTokenDefinition -} - /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -271,15 +232,9 @@ func (m *_UserIdentityToken) GetTypeName() string { func (m *_UserIdentityToken) GetLengthInBits(ctx context.Context) uint16 { lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) - // Implicit Field (policyLength) - lengthInBits += 32 - // Simple field (policyId) lengthInBits += m.PolicyId.GetLengthInBits(ctx) - // Simple field (userIdentityTokenDefinition) - lengthInBits += m.UserIdentityTokenDefinition.GetLengthInBits(ctx) - return lengthInBits } @@ -287,7 +242,7 @@ func (m *_UserIdentityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UserIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__userIdentityToken UserIdentityToken, err error) { +func (m *_UserIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__userIdentityToken UserIdentityToken, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -298,24 +253,12 @@ func (m *_UserIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos - policyLength, err := ReadImplicitField[int32](ctx, "policyLength", ReadSignedInt(readBuffer, uint8(32))) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyLength' field")) - } - _ = policyLength - policyId, err := ReadSimpleField[PascalString](ctx, "policyId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyId' field")) } m.PolicyId = policyId - userIdentityTokenDefinition, err := ReadSimpleField[UserIdentityTokenDefinition](ctx, "userIdentityTokenDefinition", ReadComplex[UserIdentityTokenDefinition](UserIdentityTokenDefinitionParseWithBufferProducer[UserIdentityTokenDefinition]((string)(policyId.GetStringValue())), readBuffer)) - if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userIdentityTokenDefinition' field")) - } - m.UserIdentityTokenDefinition = userIdentityTokenDefinition - if closeErr := readBuffer.CloseContext("UserIdentityToken"); closeErr != nil { return nil, errors.Wrap(closeErr, "Error closing for UserIdentityToken") } @@ -340,19 +283,11 @@ func (m *_UserIdentityToken) SerializeWithWriteBuffer(ctx context.Context, write if pushErr := writeBuffer.PushContext("UserIdentityToken"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for UserIdentityToken") } - policyLength := int32(int32(m.GetPolicyId().GetLengthInBytes(ctx)) + int32(m.GetUserIdentityTokenDefinition().GetLengthInBytes(ctx))) - if err := WriteImplicitField(ctx, "policyLength", policyLength, WriteSignedInt(writeBuffer, 32)); err != nil { - return errors.Wrap(err, "Error serializing 'policyLength' field") - } if err := WriteSimpleField[PascalString](ctx, "policyId", m.GetPolicyId(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'policyId' field") } - if err := WriteSimpleField[UserIdentityTokenDefinition](ctx, "userIdentityTokenDefinition", m.GetUserIdentityTokenDefinition(), WriteComplex[UserIdentityTokenDefinition](writeBuffer)); err != nil { - return errors.Wrap(err, "Error serializing 'userIdentityTokenDefinition' field") - } - if popErr := writeBuffer.PopContext("UserIdentityToken"); popErr != nil { return errors.Wrap(popErr, "Error popping for UserIdentityToken") } @@ -374,7 +309,6 @@ func (m *_UserIdentityToken) deepCopy() *_UserIdentityToken { _UserIdentityTokenCopy := &_UserIdentityToken{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), m.PolicyId.DeepCopy().(PascalString), - m.UserIdentityTokenDefinition.DeepCopy().(UserIdentityTokenDefinition), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _UserIdentityTokenCopy diff --git a/plc4go/protocols/opcua/readwrite/model/UserIdentityTokenDefinition.go b/plc4go/protocols/opcua/readwrite/model/UserIdentityTokenDefinition.go deleted file mode 100644 index 17d14aaa044..00000000000 --- a/plc4go/protocols/opcua/readwrite/model/UserIdentityTokenDefinition.go +++ /dev/null @@ -1,400 +0,0 @@ -/* - * 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 - * - * https://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 ( - "context" - "fmt" - - "github.com/pkg/errors" - "github.com/rs/zerolog" - - "github.com/apache/plc4x/plc4go/spi/utils" -) - -// Code generated by code-generation. DO NOT EDIT. - -// UserIdentityTokenDefinition is the corresponding interface of UserIdentityTokenDefinition -type UserIdentityTokenDefinition interface { - UserIdentityTokenDefinitionContract - UserIdentityTokenDefinitionRequirements - fmt.Stringer - utils.LengthAware - utils.Serializable - utils.Copyable - // IsUserIdentityTokenDefinition is a marker method to prevent unintentional type checks (interfaces of same signature) - IsUserIdentityTokenDefinition() - // CreateBuilder creates a UserIdentityTokenDefinitionBuilder - CreateUserIdentityTokenDefinitionBuilder() UserIdentityTokenDefinitionBuilder -} - -// UserIdentityTokenDefinitionContract provides a set of functions which can be overwritten by a sub struct -type UserIdentityTokenDefinitionContract interface { - // IsUserIdentityTokenDefinition is a marker method to prevent unintentional type checks (interfaces of same signature) - IsUserIdentityTokenDefinition() - // CreateBuilder creates a UserIdentityTokenDefinitionBuilder - CreateUserIdentityTokenDefinitionBuilder() UserIdentityTokenDefinitionBuilder -} - -// UserIdentityTokenDefinitionRequirements provides a set of functions which need to be implemented by a sub struct -type UserIdentityTokenDefinitionRequirements interface { - GetLengthInBits(ctx context.Context) uint16 - GetLengthInBytes(ctx context.Context) uint16 - // GetIdentifier returns Identifier (discriminator field) - GetIdentifier() string -} - -// _UserIdentityTokenDefinition is the data-structure of this message -type _UserIdentityTokenDefinition struct { - _SubType interface { - UserIdentityTokenDefinitionContract - UserIdentityTokenDefinitionRequirements - } -} - -var _ UserIdentityTokenDefinitionContract = (*_UserIdentityTokenDefinition)(nil) - -// NewUserIdentityTokenDefinition factory function for _UserIdentityTokenDefinition -func NewUserIdentityTokenDefinition() *_UserIdentityTokenDefinition { - return &_UserIdentityTokenDefinition{} -} - -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Builder -/////////////////////// - -// UserIdentityTokenDefinitionBuilder is a builder for UserIdentityTokenDefinition -type UserIdentityTokenDefinitionBuilder interface { - utils.Copyable - // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields() UserIdentityTokenDefinitionBuilder - // AsAnonymousIdentityToken converts this build to a subType of UserIdentityTokenDefinition. It is always possible to return to current builder using Done() - AsAnonymousIdentityToken() interface { - AnonymousIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - } - // AsUserNameIdentityToken converts this build to a subType of UserIdentityTokenDefinition. It is always possible to return to current builder using Done() - AsUserNameIdentityToken() interface { - UserNameIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - } - // AsX509IdentityToken converts this build to a subType of UserIdentityTokenDefinition. It is always possible to return to current builder using Done() - AsX509IdentityToken() interface { - X509IdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - } - // AsIssuedIdentityToken converts this build to a subType of UserIdentityTokenDefinition. It is always possible to return to current builder using Done() - AsIssuedIdentityToken() interface { - IssuedIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - } - // Build builds the UserIdentityTokenDefinition or returns an error if something is wrong - PartialBuild() (UserIdentityTokenDefinitionContract, error) - // MustBuild does the same as Build but panics on error - PartialMustBuild() UserIdentityTokenDefinitionContract - // Build builds the UserIdentityTokenDefinition or returns an error if something is wrong - Build() (UserIdentityTokenDefinition, error) - // MustBuild does the same as Build but panics on error - MustBuild() UserIdentityTokenDefinition -} - -// NewUserIdentityTokenDefinitionBuilder() creates a UserIdentityTokenDefinitionBuilder -func NewUserIdentityTokenDefinitionBuilder() UserIdentityTokenDefinitionBuilder { - return &_UserIdentityTokenDefinitionBuilder{_UserIdentityTokenDefinition: new(_UserIdentityTokenDefinition)} -} - -type _UserIdentityTokenDefinitionChildBuilder interface { - utils.Copyable - setParent(UserIdentityTokenDefinitionContract) - buildForUserIdentityTokenDefinition() (UserIdentityTokenDefinition, error) -} - -type _UserIdentityTokenDefinitionBuilder struct { - *_UserIdentityTokenDefinition - - childBuilder _UserIdentityTokenDefinitionChildBuilder - - err *utils.MultiError -} - -var _ (UserIdentityTokenDefinitionBuilder) = (*_UserIdentityTokenDefinitionBuilder)(nil) - -func (b *_UserIdentityTokenDefinitionBuilder) WithMandatoryFields() UserIdentityTokenDefinitionBuilder { - return b -} - -func (b *_UserIdentityTokenDefinitionBuilder) PartialBuild() (UserIdentityTokenDefinitionContract, error) { - if b.err != nil { - return nil, errors.Wrap(b.err, "error occurred during build") - } - return b._UserIdentityTokenDefinition.deepCopy(), nil -} - -func (b *_UserIdentityTokenDefinitionBuilder) PartialMustBuild() UserIdentityTokenDefinitionContract { - build, err := b.PartialBuild() - if err != nil { - panic(err) - } - return build -} - -func (b *_UserIdentityTokenDefinitionBuilder) AsAnonymousIdentityToken() interface { - AnonymousIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - AnonymousIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - }); ok { - return cb - } - cb := NewAnonymousIdentityTokenBuilder().(*_AnonymousIdentityTokenBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_UserIdentityTokenDefinitionBuilder) AsUserNameIdentityToken() interface { - UserNameIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - UserNameIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - }); ok { - return cb - } - cb := NewUserNameIdentityTokenBuilder().(*_UserNameIdentityTokenBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_UserIdentityTokenDefinitionBuilder) AsX509IdentityToken() interface { - X509IdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - X509IdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - }); ok { - return cb - } - cb := NewX509IdentityTokenBuilder().(*_X509IdentityTokenBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_UserIdentityTokenDefinitionBuilder) AsIssuedIdentityToken() interface { - IssuedIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder -} { - if cb, ok := b.childBuilder.(interface { - IssuedIdentityTokenBuilder - Done() UserIdentityTokenDefinitionBuilder - }); ok { - return cb - } - cb := NewIssuedIdentityTokenBuilder().(*_IssuedIdentityTokenBuilder) - cb.parentBuilder = b - b.childBuilder = cb - return cb -} - -func (b *_UserIdentityTokenDefinitionBuilder) Build() (UserIdentityTokenDefinition, error) { - v, err := b.PartialBuild() - if err != nil { - return nil, errors.Wrap(err, "error occurred during partial build") - } - if b.childBuilder == nil { - return nil, errors.New("no child builder present") - } - b.childBuilder.setParent(v) - return b.childBuilder.buildForUserIdentityTokenDefinition() -} - -func (b *_UserIdentityTokenDefinitionBuilder) MustBuild() UserIdentityTokenDefinition { - build, err := b.Build() - if err != nil { - panic(err) - } - return build -} - -func (b *_UserIdentityTokenDefinitionBuilder) DeepCopy() any { - _copy := b.CreateUserIdentityTokenDefinitionBuilder().(*_UserIdentityTokenDefinitionBuilder) - _copy.childBuilder = b.childBuilder.DeepCopy().(_UserIdentityTokenDefinitionChildBuilder) - _copy.childBuilder.setParent(_copy) - if b.err != nil { - _copy.err = b.err.DeepCopy().(*utils.MultiError) - } - return _copy -} - -// CreateUserIdentityTokenDefinitionBuilder creates a UserIdentityTokenDefinitionBuilder -func (b *_UserIdentityTokenDefinition) CreateUserIdentityTokenDefinitionBuilder() UserIdentityTokenDefinitionBuilder { - if b == nil { - return NewUserIdentityTokenDefinitionBuilder() - } - return &_UserIdentityTokenDefinitionBuilder{_UserIdentityTokenDefinition: b.deepCopy()} -} - -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// - -// Deprecated: use the interface for direct cast -func CastUserIdentityTokenDefinition(structType any) UserIdentityTokenDefinition { - if casted, ok := structType.(UserIdentityTokenDefinition); ok { - return casted - } - if casted, ok := structType.(*UserIdentityTokenDefinition); ok { - return *casted - } - return nil -} - -func (m *_UserIdentityTokenDefinition) GetTypeName() string { - return "UserIdentityTokenDefinition" -} - -func (m *_UserIdentityTokenDefinition) getLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(0) - - return lengthInBits -} - -func (m *_UserIdentityTokenDefinition) GetLengthInBits(ctx context.Context) uint16 { - return m._SubType.GetLengthInBits(ctx) -} - -func (m *_UserIdentityTokenDefinition) GetLengthInBytes(ctx context.Context) uint16 { - return m._SubType.GetLengthInBits(ctx) / 8 -} - -func UserIdentityTokenDefinitionParse[T UserIdentityTokenDefinition](ctx context.Context, theBytes []byte, identifier string) (T, error) { - return UserIdentityTokenDefinitionParseWithBuffer[T](ctx, utils.NewReadBufferByteBased(theBytes), identifier) -} - -func UserIdentityTokenDefinitionParseWithBufferProducer[T UserIdentityTokenDefinition](identifier string) func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { - return func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error) { - v, err := UserIdentityTokenDefinitionParseWithBuffer[T](ctx, readBuffer, identifier) - if err != nil { - var zero T - return zero, err - } - return v, nil - } -} - -func UserIdentityTokenDefinitionParseWithBuffer[T UserIdentityTokenDefinition](ctx context.Context, readBuffer utils.ReadBuffer, identifier string) (T, error) { - v, err := (&_UserIdentityTokenDefinition{}).parse(ctx, readBuffer, identifier) - if err != nil { - var zero T - return zero, err - } - vc, ok := v.(T) - if !ok { - var zero T - return zero, errors.Errorf("Unexpected type %T. Expected type %T", v, *new(T)) - } - return vc, nil -} - -func (m *_UserIdentityTokenDefinition) parse(ctx context.Context, readBuffer utils.ReadBuffer, identifier string) (__userIdentityTokenDefinition UserIdentityTokenDefinition, err error) { - positionAware := readBuffer - _ = positionAware - if pullErr := readBuffer.PullContext("UserIdentityTokenDefinition"); pullErr != nil { - return nil, errors.Wrap(pullErr, "Error pulling for UserIdentityTokenDefinition") - } - currentPos := positionAware.GetPos() - _ = currentPos - - // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) - var _child UserIdentityTokenDefinition - switch { - case identifier == "anonymous": // AnonymousIdentityToken - if _child, err = new(_AnonymousIdentityToken).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type AnonymousIdentityToken for type-switch of UserIdentityTokenDefinition") - } - case identifier == "username": // UserNameIdentityToken - if _child, err = new(_UserNameIdentityToken).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type UserNameIdentityToken for type-switch of UserIdentityTokenDefinition") - } - case identifier == "certificate": // X509IdentityToken - if _child, err = new(_X509IdentityToken).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type X509IdentityToken for type-switch of UserIdentityTokenDefinition") - } - case identifier == "identity": // IssuedIdentityToken - if _child, err = new(_IssuedIdentityToken).parse(ctx, readBuffer, m, identifier); err != nil { - return nil, errors.Wrap(err, "Error parsing sub-type IssuedIdentityToken for type-switch of UserIdentityTokenDefinition") - } - default: - return nil, errors.Errorf("Unmapped type for parameters [identifier=%v]", identifier) - } - - if closeErr := readBuffer.CloseContext("UserIdentityTokenDefinition"); closeErr != nil { - return nil, errors.Wrap(closeErr, "Error closing for UserIdentityTokenDefinition") - } - - return _child, nil -} - -func (pm *_UserIdentityTokenDefinition) serializeParent(ctx context.Context, writeBuffer utils.WriteBuffer, child UserIdentityTokenDefinition, serializeChildFunction func() error) error { - // We redirect all calls through client as some methods are only implemented there - m := child - _ = m - positionAware := writeBuffer - _ = positionAware - log := zerolog.Ctx(ctx) - _ = log - if pushErr := writeBuffer.PushContext("UserIdentityTokenDefinition"); pushErr != nil { - return errors.Wrap(pushErr, "Error pushing for UserIdentityTokenDefinition") - } - - // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) - if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { - return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") - } - - if popErr := writeBuffer.PopContext("UserIdentityTokenDefinition"); popErr != nil { - return errors.Wrap(popErr, "Error popping for UserIdentityTokenDefinition") - } - return nil -} - -func (m *_UserIdentityTokenDefinition) IsUserIdentityTokenDefinition() {} - -func (m *_UserIdentityTokenDefinition) DeepCopy() any { - return m.deepCopy() -} - -func (m *_UserIdentityTokenDefinition) deepCopy() *_UserIdentityTokenDefinition { - if m == nil { - return nil - } - _UserIdentityTokenDefinitionCopy := &_UserIdentityTokenDefinition{ - nil, // will be set by child - } - return _UserIdentityTokenDefinitionCopy -} diff --git a/plc4go/protocols/opcua/readwrite/model/UserManagementDataType.go b/plc4go/protocols/opcua/readwrite/model/UserManagementDataType.go index d91e9f9f1e4..068b8bd0559 100644 --- a/plc4go/protocols/opcua/readwrite/model/UserManagementDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/UserManagementDataType.go @@ -233,8 +233,8 @@ func (b *_UserManagementDataType) CreateUserManagementDataTypeBuilder() UserMana /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UserManagementDataType) GetIdentifier() string { - return "24283" +func (m *_UserManagementDataType) GetExtensionId() int32 { + return int32(24283) } /////////////////////// @@ -302,7 +302,7 @@ func (m *_UserManagementDataType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UserManagementDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__userManagementDataType UserManagementDataType, err error) { +func (m *_UserManagementDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__userManagementDataType UserManagementDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/UserNameIdentityToken.go b/plc4go/protocols/opcua/readwrite/model/UserNameIdentityToken.go index 7bb2012d47e..6795cb9f198 100644 --- a/plc4go/protocols/opcua/readwrite/model/UserNameIdentityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/UserNameIdentityToken.go @@ -39,7 +39,9 @@ type UserNameIdentityToken interface { utils.LengthAware utils.Serializable utils.Copyable - UserIdentityTokenDefinition + ExtensionObjectDefinition + // GetPolicyId returns PolicyId (property field) + GetPolicyId() PascalString // GetUserName returns UserName (property field) GetUserName() PascalString // GetPassword returns Password (property field) @@ -54,17 +56,21 @@ type UserNameIdentityToken interface { // _UserNameIdentityToken is the data-structure of this message type _UserNameIdentityToken struct { - UserIdentityTokenDefinitionContract + ExtensionObjectDefinitionContract + PolicyId PascalString UserName PascalString Password PascalByteString EncryptionAlgorithm PascalString } var _ UserNameIdentityToken = (*_UserNameIdentityToken)(nil) -var _ UserIdentityTokenDefinitionRequirements = (*_UserNameIdentityToken)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_UserNameIdentityToken)(nil) // NewUserNameIdentityToken factory function for _UserNameIdentityToken -func NewUserNameIdentityToken(userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) *_UserNameIdentityToken { +func NewUserNameIdentityToken(policyId PascalString, userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) *_UserNameIdentityToken { + if policyId == nil { + panic("policyId of type PascalString for UserNameIdentityToken must not be nil") + } if userName == nil { panic("userName of type PascalString for UserNameIdentityToken must not be nil") } @@ -75,12 +81,13 @@ func NewUserNameIdentityToken(userName PascalString, password PascalByteString, panic("encryptionAlgorithm of type PascalString for UserNameIdentityToken must not be nil") } _result := &_UserNameIdentityToken{ - UserIdentityTokenDefinitionContract: NewUserIdentityTokenDefinition(), - UserName: userName, - Password: password, - EncryptionAlgorithm: encryptionAlgorithm, + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PolicyId: policyId, + UserName: userName, + Password: password, + EncryptionAlgorithm: encryptionAlgorithm, } - _result.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = _result + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result return _result } @@ -93,7 +100,11 @@ func NewUserNameIdentityToken(userName PascalString, password PascalByteString, type UserNameIdentityTokenBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) UserNameIdentityTokenBuilder + WithMandatoryFields(policyId PascalString, userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) UserNameIdentityTokenBuilder + // WithPolicyId adds PolicyId (property field) + WithPolicyId(PascalString) UserNameIdentityTokenBuilder + // WithPolicyIdBuilder adds PolicyId (property field) which is build by the builder + WithPolicyIdBuilder(func(PascalStringBuilder) PascalStringBuilder) UserNameIdentityTokenBuilder // WithUserName adds UserName (property field) WithUserName(PascalString) UserNameIdentityTokenBuilder // WithUserNameBuilder adds UserName (property field) which is build by the builder @@ -120,19 +131,37 @@ func NewUserNameIdentityTokenBuilder() UserNameIdentityTokenBuilder { type _UserNameIdentityTokenBuilder struct { *_UserNameIdentityToken - parentBuilder *_UserIdentityTokenDefinitionBuilder + parentBuilder *_ExtensionObjectDefinitionBuilder err *utils.MultiError } var _ (UserNameIdentityTokenBuilder) = (*_UserNameIdentityTokenBuilder)(nil) -func (b *_UserNameIdentityTokenBuilder) setParent(contract UserIdentityTokenDefinitionContract) { - b.UserIdentityTokenDefinitionContract = contract +func (b *_UserNameIdentityTokenBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_UserNameIdentityTokenBuilder) WithMandatoryFields(policyId PascalString, userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) UserNameIdentityTokenBuilder { + return b.WithPolicyId(policyId).WithUserName(userName).WithPassword(password).WithEncryptionAlgorithm(encryptionAlgorithm) } -func (b *_UserNameIdentityTokenBuilder) WithMandatoryFields(userName PascalString, password PascalByteString, encryptionAlgorithm PascalString) UserNameIdentityTokenBuilder { - return b.WithUserName(userName).WithPassword(password).WithEncryptionAlgorithm(encryptionAlgorithm) +func (b *_UserNameIdentityTokenBuilder) WithPolicyId(policyId PascalString) UserNameIdentityTokenBuilder { + b.PolicyId = policyId + return b +} + +func (b *_UserNameIdentityTokenBuilder) WithPolicyIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) UserNameIdentityTokenBuilder { + builder := builderSupplier(b.PolicyId.CreatePascalStringBuilder()) + var err error + b.PolicyId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b } func (b *_UserNameIdentityTokenBuilder) WithUserName(userName PascalString) UserNameIdentityTokenBuilder { @@ -190,6 +219,12 @@ func (b *_UserNameIdentityTokenBuilder) WithEncryptionAlgorithmBuilder(builderSu } func (b *_UserNameIdentityTokenBuilder) Build() (UserNameIdentityToken, error) { + if b.PolicyId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'policyId' not set")) + } if b.UserName == nil { if b.err == nil { b.err = new(utils.MultiError) @@ -223,11 +258,11 @@ func (b *_UserNameIdentityTokenBuilder) MustBuild() UserNameIdentityToken { } // Done is used to finish work on this child and return to the parent builder -func (b *_UserNameIdentityTokenBuilder) Done() UserIdentityTokenDefinitionBuilder { +func (b *_UserNameIdentityTokenBuilder) Done() ExtensionObjectDefinitionBuilder { return b.parentBuilder } -func (b *_UserNameIdentityTokenBuilder) buildForUserIdentityTokenDefinition() (UserIdentityTokenDefinition, error) { +func (b *_UserNameIdentityTokenBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { return b.Build() } @@ -257,8 +292,8 @@ func (b *_UserNameIdentityToken) CreateUserNameIdentityTokenBuilder() UserNameId /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UserNameIdentityToken) GetIdentifier() string { - return "username" +func (m *_UserNameIdentityToken) GetExtensionId() int32 { + return int32(324) } /////////////////////// @@ -266,8 +301,8 @@ func (m *_UserNameIdentityToken) GetIdentifier() string { /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// -func (m *_UserNameIdentityToken) GetParent() UserIdentityTokenDefinitionContract { - return m.UserIdentityTokenDefinitionContract +func (m *_UserNameIdentityToken) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract } /////////////////////////////////////////////////////////// @@ -275,6 +310,10 @@ func (m *_UserNameIdentityToken) GetParent() UserIdentityTokenDefinitionContract /////////////////////// Accessors for property fields. /////////////////////// +func (m *_UserNameIdentityToken) GetPolicyId() PascalString { + return m.PolicyId +} + func (m *_UserNameIdentityToken) GetUserName() PascalString { return m.UserName } @@ -308,7 +347,10 @@ func (m *_UserNameIdentityToken) GetTypeName() string { } func (m *_UserNameIdentityToken) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).getLengthInBits(ctx)) + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (policyId) + lengthInBits += m.PolicyId.GetLengthInBits(ctx) // Simple field (userName) lengthInBits += m.UserName.GetLengthInBits(ctx) @@ -326,8 +368,8 @@ func (m *_UserNameIdentityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UserNameIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_UserIdentityTokenDefinition, identifier string) (__userNameIdentityToken UserNameIdentityToken, err error) { - m.UserIdentityTokenDefinitionContract = parent +func (m *_UserNameIdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__userNameIdentityToken UserNameIdentityToken, err error) { + m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer _ = positionAware @@ -337,6 +379,12 @@ func (m *_UserNameIdentityToken) parse(ctx context.Context, readBuffer utils.Rea currentPos := positionAware.GetPos() _ = currentPos + policyId, err := ReadSimpleField[PascalString](ctx, "policyId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyId' field")) + } + m.PolicyId = policyId + userName, err := ReadSimpleField[PascalString](ctx, "userName", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userName' field")) @@ -380,6 +428,10 @@ func (m *_UserNameIdentityToken) SerializeWithWriteBuffer(ctx context.Context, w return errors.Wrap(pushErr, "Error pushing for UserNameIdentityToken") } + if err := WriteSimpleField[PascalString](ctx, "policyId", m.GetPolicyId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'policyId' field") + } + if err := WriteSimpleField[PascalString](ctx, "userName", m.GetUserName(), WriteComplex[PascalString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'userName' field") } @@ -397,7 +449,7 @@ func (m *_UserNameIdentityToken) SerializeWithWriteBuffer(ctx context.Context, w } return nil } - return m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).serializeParent(ctx, writeBuffer, m, ser) + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) } func (m *_UserNameIdentityToken) IsUserNameIdentityToken() {} @@ -411,12 +463,13 @@ func (m *_UserNameIdentityToken) deepCopy() *_UserNameIdentityToken { return nil } _UserNameIdentityTokenCopy := &_UserNameIdentityToken{ - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).deepCopy(), + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PolicyId.DeepCopy().(PascalString), m.UserName.DeepCopy().(PascalString), m.Password.DeepCopy().(PascalByteString), m.EncryptionAlgorithm.DeepCopy().(PascalString), } - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = m + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _UserNameIdentityTokenCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/UserTokenPolicy.go b/plc4go/protocols/opcua/readwrite/model/UserTokenPolicy.go index b594f2a5bd0..8504269d2ce 100644 --- a/plc4go/protocols/opcua/readwrite/model/UserTokenPolicy.go +++ b/plc4go/protocols/opcua/readwrite/model/UserTokenPolicy.go @@ -303,8 +303,8 @@ func (b *_UserTokenPolicy) CreateUserTokenPolicyBuilder() UserTokenPolicyBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_UserTokenPolicy) GetIdentifier() string { - return "306" +func (m *_UserTokenPolicy) GetExtensionId() int32 { + return int32(306) } /////////////////////// @@ -386,7 +386,7 @@ func (m *_UserTokenPolicy) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_UserTokenPolicy) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__userTokenPolicy UserTokenPolicy, err error) { +func (m *_UserTokenPolicy) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__userTokenPolicy UserTokenPolicy, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/VariableAttributes.go b/plc4go/protocols/opcua/readwrite/model/VariableAttributes.go new file mode 100644 index 00000000000..3d7d32c1914 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/VariableAttributes.go @@ -0,0 +1,781 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// VariableAttributes is the corresponding interface of VariableAttributes +type VariableAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetValue returns Value (property field) + GetValue() Variant + // GetDataType returns DataType (property field) + GetDataType() NodeId + // GetValueRank returns ValueRank (property field) + GetValueRank() int32 + // GetArrayDimensions returns ArrayDimensions (property field) + GetArrayDimensions() []uint32 + // GetAccessLevel returns AccessLevel (property field) + GetAccessLevel() uint8 + // GetUserAccessLevel returns UserAccessLevel (property field) + GetUserAccessLevel() uint8 + // GetMinimumSamplingInterval returns MinimumSamplingInterval (property field) + GetMinimumSamplingInterval() float64 + // GetHistorizing returns Historizing (property field) + GetHistorizing() bool + // IsVariableAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsVariableAttributes() + // CreateBuilder creates a VariableAttributesBuilder + CreateVariableAttributesBuilder() VariableAttributesBuilder +} + +// _VariableAttributes is the data-structure of this message +type _VariableAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + Value Variant + DataType NodeId + ValueRank int32 + ArrayDimensions []uint32 + AccessLevel uint8 + UserAccessLevel uint8 + MinimumSamplingInterval float64 + Historizing bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ VariableAttributes = (*_VariableAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_VariableAttributes)(nil) + +// NewVariableAttributes factory function for _VariableAttributes +func NewVariableAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, accessLevel uint8, userAccessLevel uint8, minimumSamplingInterval float64, historizing bool) *_VariableAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for VariableAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for VariableAttributes must not be nil") + } + if value == nil { + panic("value of type Variant for VariableAttributes must not be nil") + } + if dataType == nil { + panic("dataType of type NodeId for VariableAttributes must not be nil") + } + _result := &_VariableAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + Value: value, + DataType: dataType, + ValueRank: valueRank, + ArrayDimensions: arrayDimensions, + AccessLevel: accessLevel, + UserAccessLevel: userAccessLevel, + MinimumSamplingInterval: minimumSamplingInterval, + Historizing: historizing, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// VariableAttributesBuilder is a builder for VariableAttributes +type VariableAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, accessLevel uint8, userAccessLevel uint8, minimumSamplingInterval float64, historizing bool) VariableAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) VariableAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) VariableAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) VariableAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) VariableAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) VariableAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) VariableAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) VariableAttributesBuilder + // WithValue adds Value (property field) + WithValue(Variant) VariableAttributesBuilder + // WithValueBuilder adds Value (property field) which is build by the builder + WithValueBuilder(func(VariantBuilder) VariantBuilder) VariableAttributesBuilder + // WithDataType adds DataType (property field) + WithDataType(NodeId) VariableAttributesBuilder + // WithDataTypeBuilder adds DataType (property field) which is build by the builder + WithDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) VariableAttributesBuilder + // WithValueRank adds ValueRank (property field) + WithValueRank(int32) VariableAttributesBuilder + // WithArrayDimensions adds ArrayDimensions (property field) + WithArrayDimensions(...uint32) VariableAttributesBuilder + // WithAccessLevel adds AccessLevel (property field) + WithAccessLevel(uint8) VariableAttributesBuilder + // WithUserAccessLevel adds UserAccessLevel (property field) + WithUserAccessLevel(uint8) VariableAttributesBuilder + // WithMinimumSamplingInterval adds MinimumSamplingInterval (property field) + WithMinimumSamplingInterval(float64) VariableAttributesBuilder + // WithHistorizing adds Historizing (property field) + WithHistorizing(bool) VariableAttributesBuilder + // Build builds the VariableAttributes or returns an error if something is wrong + Build() (VariableAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() VariableAttributes +} + +// NewVariableAttributesBuilder() creates a VariableAttributesBuilder +func NewVariableAttributesBuilder() VariableAttributesBuilder { + return &_VariableAttributesBuilder{_VariableAttributes: new(_VariableAttributes)} +} + +type _VariableAttributesBuilder struct { + *_VariableAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (VariableAttributesBuilder) = (*_VariableAttributesBuilder)(nil) + +func (b *_VariableAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_VariableAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, accessLevel uint8, userAccessLevel uint8, minimumSamplingInterval float64, historizing bool) VariableAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithValue(value).WithDataType(dataType).WithValueRank(valueRank).WithArrayDimensions(arrayDimensions...).WithAccessLevel(accessLevel).WithUserAccessLevel(userAccessLevel).WithMinimumSamplingInterval(minimumSamplingInterval).WithHistorizing(historizing) +} + +func (b *_VariableAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) VariableAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_VariableAttributesBuilder) WithDisplayName(displayName LocalizedText) VariableAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_VariableAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) VariableAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_VariableAttributesBuilder) WithDescription(description LocalizedText) VariableAttributesBuilder { + b.Description = description + return b +} + +func (b *_VariableAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) VariableAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_VariableAttributesBuilder) WithWriteMask(writeMask uint32) VariableAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_VariableAttributesBuilder) WithUserWriteMask(userWriteMask uint32) VariableAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_VariableAttributesBuilder) WithValue(value Variant) VariableAttributesBuilder { + b.Value = value + return b +} + +func (b *_VariableAttributesBuilder) WithValueBuilder(builderSupplier func(VariantBuilder) VariantBuilder) VariableAttributesBuilder { + builder := builderSupplier(b.Value.CreateVariantBuilder()) + var err error + b.Value, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_VariableAttributesBuilder) WithDataType(dataType NodeId) VariableAttributesBuilder { + b.DataType = dataType + return b +} + +func (b *_VariableAttributesBuilder) WithDataTypeBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) VariableAttributesBuilder { + builder := builderSupplier(b.DataType.CreateNodeIdBuilder()) + var err error + b.DataType, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_VariableAttributesBuilder) WithValueRank(valueRank int32) VariableAttributesBuilder { + b.ValueRank = valueRank + return b +} + +func (b *_VariableAttributesBuilder) WithArrayDimensions(arrayDimensions ...uint32) VariableAttributesBuilder { + b.ArrayDimensions = arrayDimensions + return b +} + +func (b *_VariableAttributesBuilder) WithAccessLevel(accessLevel uint8) VariableAttributesBuilder { + b.AccessLevel = accessLevel + return b +} + +func (b *_VariableAttributesBuilder) WithUserAccessLevel(userAccessLevel uint8) VariableAttributesBuilder { + b.UserAccessLevel = userAccessLevel + return b +} + +func (b *_VariableAttributesBuilder) WithMinimumSamplingInterval(minimumSamplingInterval float64) VariableAttributesBuilder { + b.MinimumSamplingInterval = minimumSamplingInterval + return b +} + +func (b *_VariableAttributesBuilder) WithHistorizing(historizing bool) VariableAttributesBuilder { + b.Historizing = historizing + return b +} + +func (b *_VariableAttributesBuilder) Build() (VariableAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.Value == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'value' not set")) + } + if b.DataType == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataType' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._VariableAttributes.deepCopy(), nil +} + +func (b *_VariableAttributesBuilder) MustBuild() VariableAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_VariableAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_VariableAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_VariableAttributesBuilder) DeepCopy() any { + _copy := b.CreateVariableAttributesBuilder().(*_VariableAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateVariableAttributesBuilder creates a VariableAttributesBuilder +func (b *_VariableAttributes) CreateVariableAttributesBuilder() VariableAttributesBuilder { + if b == nil { + return NewVariableAttributesBuilder() + } + return &_VariableAttributesBuilder{_VariableAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_VariableAttributes) GetExtensionId() int32 { + return int32(357) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_VariableAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_VariableAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_VariableAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_VariableAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_VariableAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_VariableAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_VariableAttributes) GetValue() Variant { + return m.Value +} + +func (m *_VariableAttributes) GetDataType() NodeId { + return m.DataType +} + +func (m *_VariableAttributes) GetValueRank() int32 { + return m.ValueRank +} + +func (m *_VariableAttributes) GetArrayDimensions() []uint32 { + return m.ArrayDimensions +} + +func (m *_VariableAttributes) GetAccessLevel() uint8 { + return m.AccessLevel +} + +func (m *_VariableAttributes) GetUserAccessLevel() uint8 { + return m.UserAccessLevel +} + +func (m *_VariableAttributes) GetMinimumSamplingInterval() float64 { + return m.MinimumSamplingInterval +} + +func (m *_VariableAttributes) GetHistorizing() bool { + return m.Historizing +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastVariableAttributes(structType any) VariableAttributes { + if casted, ok := structType.(VariableAttributes); ok { + return casted + } + if casted, ok := structType.(*VariableAttributes); ok { + return *casted + } + return nil +} + +func (m *_VariableAttributes) GetTypeName() string { + return "VariableAttributes" +} + +func (m *_VariableAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Simple field (value) + lengthInBits += m.Value.GetLengthInBits(ctx) + + // Simple field (dataType) + lengthInBits += m.DataType.GetLengthInBits(ctx) + + // Simple field (valueRank) + lengthInBits += 32 + + // Implicit Field (noOfArrayDimensions) + lengthInBits += 32 + + // Array field + if len(m.ArrayDimensions) > 0 { + lengthInBits += 32 * uint16(len(m.ArrayDimensions)) + } + + // Simple field (accessLevel) + lengthInBits += 8 + + // Simple field (userAccessLevel) + lengthInBits += 8 + + // Simple field (minimumSamplingInterval) + lengthInBits += 64 + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (historizing) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_VariableAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_VariableAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__variableAttributes VariableAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("VariableAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for VariableAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + value, err := ReadSimpleField[Variant](ctx, "value", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'value' field")) + } + m.Value = value + + dataType, err := ReadSimpleField[NodeId](ctx, "dataType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataType' field")) + } + m.DataType = dataType + + valueRank, err := ReadSimpleField(ctx, "valueRank", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'valueRank' field")) + } + m.ValueRank = valueRank + + noOfArrayDimensions, err := ReadImplicitField[int32](ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfArrayDimensions' field")) + } + _ = noOfArrayDimensions + + arrayDimensions, err := ReadCountArrayField[uint32](ctx, "arrayDimensions", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfArrayDimensions)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'arrayDimensions' field")) + } + m.ArrayDimensions = arrayDimensions + + accessLevel, err := ReadSimpleField(ctx, "accessLevel", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'accessLevel' field")) + } + m.AccessLevel = accessLevel + + userAccessLevel, err := ReadSimpleField(ctx, "userAccessLevel", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userAccessLevel' field")) + } + m.UserAccessLevel = userAccessLevel + + minimumSamplingInterval, err := ReadSimpleField(ctx, "minimumSamplingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'minimumSamplingInterval' field")) + } + m.MinimumSamplingInterval = minimumSamplingInterval + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + historizing, err := ReadSimpleField(ctx, "historizing", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'historizing' field")) + } + m.Historizing = historizing + + if closeErr := readBuffer.CloseContext("VariableAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for VariableAttributes") + } + + return m, nil +} + +func (m *_VariableAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_VariableAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("VariableAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for VariableAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteSimpleField[Variant](ctx, "value", m.GetValue(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'value' field") + } + + if err := WriteSimpleField[NodeId](ctx, "dataType", m.GetDataType(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataType' field") + } + + if err := WriteSimpleField[int32](ctx, "valueRank", m.GetValueRank(), WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'valueRank' field") + } + noOfArrayDimensions := int32(utils.InlineIf(bool((m.GetArrayDimensions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetArrayDimensions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfArrayDimensions", noOfArrayDimensions, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfArrayDimensions' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "arrayDimensions", m.GetArrayDimensions(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'arrayDimensions' field") + } + + if err := WriteSimpleField[uint8](ctx, "accessLevel", m.GetAccessLevel(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'accessLevel' field") + } + + if err := WriteSimpleField[uint8](ctx, "userAccessLevel", m.GetUserAccessLevel(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'userAccessLevel' field") + } + + if err := WriteSimpleField[float64](ctx, "minimumSamplingInterval", m.GetMinimumSamplingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'minimumSamplingInterval' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "historizing", m.GetHistorizing(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'historizing' field") + } + + if popErr := writeBuffer.PopContext("VariableAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for VariableAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_VariableAttributes) IsVariableAttributes() {} + +func (m *_VariableAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_VariableAttributes) deepCopy() *_VariableAttributes { + if m == nil { + return nil + } + _VariableAttributesCopy := &_VariableAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.Value.DeepCopy().(Variant), + m.DataType.DeepCopy().(NodeId), + m.ValueRank, + utils.DeepCopySlice[uint32, uint32](m.ArrayDimensions), + m.AccessLevel, + m.UserAccessLevel, + m.MinimumSamplingInterval, + m.Historizing, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _VariableAttributesCopy +} + +func (m *_VariableAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/VariableTypeAttributes.go b/plc4go/protocols/opcua/readwrite/model/VariableTypeAttributes.go new file mode 100644 index 00000000000..bdf23496cb1 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/VariableTypeAttributes.go @@ -0,0 +1,694 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// VariableTypeAttributes is the corresponding interface of VariableTypeAttributes +type VariableTypeAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetValue returns Value (property field) + GetValue() Variant + // GetDataType returns DataType (property field) + GetDataType() NodeId + // GetValueRank returns ValueRank (property field) + GetValueRank() int32 + // GetArrayDimensions returns ArrayDimensions (property field) + GetArrayDimensions() []uint32 + // GetIsAbstract returns IsAbstract (property field) + GetIsAbstract() bool + // IsVariableTypeAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsVariableTypeAttributes() + // CreateBuilder creates a VariableTypeAttributesBuilder + CreateVariableTypeAttributesBuilder() VariableTypeAttributesBuilder +} + +// _VariableTypeAttributes is the data-structure of this message +type _VariableTypeAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + Value Variant + DataType NodeId + ValueRank int32 + ArrayDimensions []uint32 + IsAbstract bool + // Reserved Fields + reservedField0 *uint8 +} + +var _ VariableTypeAttributes = (*_VariableTypeAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_VariableTypeAttributes)(nil) + +// NewVariableTypeAttributes factory function for _VariableTypeAttributes +func NewVariableTypeAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, isAbstract bool) *_VariableTypeAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for VariableTypeAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for VariableTypeAttributes must not be nil") + } + if value == nil { + panic("value of type Variant for VariableTypeAttributes must not be nil") + } + if dataType == nil { + panic("dataType of type NodeId for VariableTypeAttributes must not be nil") + } + _result := &_VariableTypeAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + Value: value, + DataType: dataType, + ValueRank: valueRank, + ArrayDimensions: arrayDimensions, + IsAbstract: isAbstract, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// VariableTypeAttributesBuilder is a builder for VariableTypeAttributes +type VariableTypeAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, isAbstract bool) VariableTypeAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) VariableTypeAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) VariableTypeAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) VariableTypeAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) VariableTypeAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) VariableTypeAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) VariableTypeAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) VariableTypeAttributesBuilder + // WithValue adds Value (property field) + WithValue(Variant) VariableTypeAttributesBuilder + // WithValueBuilder adds Value (property field) which is build by the builder + WithValueBuilder(func(VariantBuilder) VariantBuilder) VariableTypeAttributesBuilder + // WithDataType adds DataType (property field) + WithDataType(NodeId) VariableTypeAttributesBuilder + // WithDataTypeBuilder adds DataType (property field) which is build by the builder + WithDataTypeBuilder(func(NodeIdBuilder) NodeIdBuilder) VariableTypeAttributesBuilder + // WithValueRank adds ValueRank (property field) + WithValueRank(int32) VariableTypeAttributesBuilder + // WithArrayDimensions adds ArrayDimensions (property field) + WithArrayDimensions(...uint32) VariableTypeAttributesBuilder + // WithIsAbstract adds IsAbstract (property field) + WithIsAbstract(bool) VariableTypeAttributesBuilder + // Build builds the VariableTypeAttributes or returns an error if something is wrong + Build() (VariableTypeAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() VariableTypeAttributes +} + +// NewVariableTypeAttributesBuilder() creates a VariableTypeAttributesBuilder +func NewVariableTypeAttributesBuilder() VariableTypeAttributesBuilder { + return &_VariableTypeAttributesBuilder{_VariableTypeAttributes: new(_VariableTypeAttributes)} +} + +type _VariableTypeAttributesBuilder struct { + *_VariableTypeAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (VariableTypeAttributesBuilder) = (*_VariableTypeAttributesBuilder)(nil) + +func (b *_VariableTypeAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_VariableTypeAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, value Variant, dataType NodeId, valueRank int32, arrayDimensions []uint32, isAbstract bool) VariableTypeAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithValue(value).WithDataType(dataType).WithValueRank(valueRank).WithArrayDimensions(arrayDimensions...).WithIsAbstract(isAbstract) +} + +func (b *_VariableTypeAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) VariableTypeAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDisplayName(displayName LocalizedText) VariableTypeAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) VariableTypeAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDescription(description LocalizedText) VariableTypeAttributesBuilder { + b.Description = description + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) VariableTypeAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_VariableTypeAttributesBuilder) WithWriteMask(writeMask uint32) VariableTypeAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_VariableTypeAttributesBuilder) WithUserWriteMask(userWriteMask uint32) VariableTypeAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_VariableTypeAttributesBuilder) WithValue(value Variant) VariableTypeAttributesBuilder { + b.Value = value + return b +} + +func (b *_VariableTypeAttributesBuilder) WithValueBuilder(builderSupplier func(VariantBuilder) VariantBuilder) VariableTypeAttributesBuilder { + builder := builderSupplier(b.Value.CreateVariantBuilder()) + var err error + b.Value, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "VariantBuilder failed")) + } + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDataType(dataType NodeId) VariableTypeAttributesBuilder { + b.DataType = dataType + return b +} + +func (b *_VariableTypeAttributesBuilder) WithDataTypeBuilder(builderSupplier func(NodeIdBuilder) NodeIdBuilder) VariableTypeAttributesBuilder { + builder := builderSupplier(b.DataType.CreateNodeIdBuilder()) + var err error + b.DataType, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "NodeIdBuilder failed")) + } + return b +} + +func (b *_VariableTypeAttributesBuilder) WithValueRank(valueRank int32) VariableTypeAttributesBuilder { + b.ValueRank = valueRank + return b +} + +func (b *_VariableTypeAttributesBuilder) WithArrayDimensions(arrayDimensions ...uint32) VariableTypeAttributesBuilder { + b.ArrayDimensions = arrayDimensions + return b +} + +func (b *_VariableTypeAttributesBuilder) WithIsAbstract(isAbstract bool) VariableTypeAttributesBuilder { + b.IsAbstract = isAbstract + return b +} + +func (b *_VariableTypeAttributesBuilder) Build() (VariableTypeAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.Value == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'value' not set")) + } + if b.DataType == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'dataType' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._VariableTypeAttributes.deepCopy(), nil +} + +func (b *_VariableTypeAttributesBuilder) MustBuild() VariableTypeAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_VariableTypeAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_VariableTypeAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_VariableTypeAttributesBuilder) DeepCopy() any { + _copy := b.CreateVariableTypeAttributesBuilder().(*_VariableTypeAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateVariableTypeAttributesBuilder creates a VariableTypeAttributesBuilder +func (b *_VariableTypeAttributes) CreateVariableTypeAttributesBuilder() VariableTypeAttributesBuilder { + if b == nil { + return NewVariableTypeAttributesBuilder() + } + return &_VariableTypeAttributesBuilder{_VariableTypeAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_VariableTypeAttributes) GetExtensionId() int32 { + return int32(366) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_VariableTypeAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_VariableTypeAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_VariableTypeAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_VariableTypeAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_VariableTypeAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_VariableTypeAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_VariableTypeAttributes) GetValue() Variant { + return m.Value +} + +func (m *_VariableTypeAttributes) GetDataType() NodeId { + return m.DataType +} + +func (m *_VariableTypeAttributes) GetValueRank() int32 { + return m.ValueRank +} + +func (m *_VariableTypeAttributes) GetArrayDimensions() []uint32 { + return m.ArrayDimensions +} + +func (m *_VariableTypeAttributes) GetIsAbstract() bool { + return m.IsAbstract +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastVariableTypeAttributes(structType any) VariableTypeAttributes { + if casted, ok := structType.(VariableTypeAttributes); ok { + return casted + } + if casted, ok := structType.(*VariableTypeAttributes); ok { + return *casted + } + return nil +} + +func (m *_VariableTypeAttributes) GetTypeName() string { + return "VariableTypeAttributes" +} + +func (m *_VariableTypeAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Simple field (value) + lengthInBits += m.Value.GetLengthInBits(ctx) + + // Simple field (dataType) + lengthInBits += m.DataType.GetLengthInBits(ctx) + + // Simple field (valueRank) + lengthInBits += 32 + + // Implicit Field (noOfArrayDimensions) + lengthInBits += 32 + + // Array field + if len(m.ArrayDimensions) > 0 { + lengthInBits += 32 * uint16(len(m.ArrayDimensions)) + } + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (isAbstract) + lengthInBits += 1 + + return lengthInBits +} + +func (m *_VariableTypeAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_VariableTypeAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__variableTypeAttributes VariableTypeAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("VariableTypeAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for VariableTypeAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + value, err := ReadSimpleField[Variant](ctx, "value", ReadComplex[Variant](VariantParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'value' field")) + } + m.Value = value + + dataType, err := ReadSimpleField[NodeId](ctx, "dataType", ReadComplex[NodeId](NodeIdParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataType' field")) + } + m.DataType = dataType + + valueRank, err := ReadSimpleField(ctx, "valueRank", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'valueRank' field")) + } + m.ValueRank = valueRank + + noOfArrayDimensions, err := ReadImplicitField[int32](ctx, "noOfArrayDimensions", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfArrayDimensions' field")) + } + _ = noOfArrayDimensions + + arrayDimensions, err := ReadCountArrayField[uint32](ctx, "arrayDimensions", ReadUnsignedInt(readBuffer, uint8(32)), uint64(noOfArrayDimensions)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'arrayDimensions' field")) + } + m.ArrayDimensions = arrayDimensions + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + isAbstract, err := ReadSimpleField(ctx, "isAbstract", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'isAbstract' field")) + } + m.IsAbstract = isAbstract + + if closeErr := readBuffer.CloseContext("VariableTypeAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for VariableTypeAttributes") + } + + return m, nil +} + +func (m *_VariableTypeAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_VariableTypeAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("VariableTypeAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for VariableTypeAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteSimpleField[Variant](ctx, "value", m.GetValue(), WriteComplex[Variant](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'value' field") + } + + if err := WriteSimpleField[NodeId](ctx, "dataType", m.GetDataType(), WriteComplex[NodeId](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'dataType' field") + } + + if err := WriteSimpleField[int32](ctx, "valueRank", m.GetValueRank(), WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'valueRank' field") + } + noOfArrayDimensions := int32(utils.InlineIf(bool((m.GetArrayDimensions()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetArrayDimensions()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfArrayDimensions", noOfArrayDimensions, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfArrayDimensions' field") + } + + if err := WriteSimpleTypeArrayField(ctx, "arrayDimensions", m.GetArrayDimensions(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'arrayDimensions' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "isAbstract", m.GetIsAbstract(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'isAbstract' field") + } + + if popErr := writeBuffer.PopContext("VariableTypeAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for VariableTypeAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_VariableTypeAttributes) IsVariableTypeAttributes() {} + +func (m *_VariableTypeAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_VariableTypeAttributes) deepCopy() *_VariableTypeAttributes { + if m == nil { + return nil + } + _VariableTypeAttributesCopy := &_VariableTypeAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.Value.DeepCopy().(Variant), + m.DataType.DeepCopy().(NodeId), + m.ValueRank, + utils.DeepCopySlice[uint32, uint32](m.ArrayDimensions), + m.IsAbstract, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _VariableTypeAttributesCopy +} + +func (m *_VariableTypeAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/VariantExtensionObject.go b/plc4go/protocols/opcua/readwrite/model/VariantExtensionObject.go index e99159d9f95..9429567a5b1 100644 --- a/plc4go/protocols/opcua/readwrite/model/VariantExtensionObject.go +++ b/plc4go/protocols/opcua/readwrite/model/VariantExtensionObject.go @@ -263,7 +263,7 @@ func (m *_VariantExtensionObject) parse(ctx context.Context, readBuffer utils.Re } m.ArrayLength = arrayLength - value, err := ReadCountArrayField[ExtensionObject](ctx, "value", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer((bool)(bool(true))), readBuffer), uint64(utils.InlineIf(bool((arrayLength) == (nil)), func() any { return int32(int32(1)) }, func() any { return int32((*arrayLength)) }).(int32))) + value, err := ReadCountArrayField[ExtensionObject](ctx, "value", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer), uint64(utils.InlineIf(bool((arrayLength) == (nil)), func() any { return int32(int32(1)) }, func() any { return int32((*arrayLength)) }).(int32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'value' field")) } diff --git a/plc4go/protocols/opcua/readwrite/model/ViewAttributes.go b/plc4go/protocols/opcua/readwrite/model/ViewAttributes.go new file mode 100644 index 00000000000..d290efa961e --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/ViewAttributes.go @@ -0,0 +1,544 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ViewAttributes is the corresponding interface of ViewAttributes +type ViewAttributes interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetSpecifiedAttributes returns SpecifiedAttributes (property field) + GetSpecifiedAttributes() uint32 + // GetDisplayName returns DisplayName (property field) + GetDisplayName() LocalizedText + // GetDescription returns Description (property field) + GetDescription() LocalizedText + // GetWriteMask returns WriteMask (property field) + GetWriteMask() uint32 + // GetUserWriteMask returns UserWriteMask (property field) + GetUserWriteMask() uint32 + // GetContainsNoLoops returns ContainsNoLoops (property field) + GetContainsNoLoops() bool + // GetEventNotifier returns EventNotifier (property field) + GetEventNotifier() uint8 + // IsViewAttributes is a marker method to prevent unintentional type checks (interfaces of same signature) + IsViewAttributes() + // CreateBuilder creates a ViewAttributesBuilder + CreateViewAttributesBuilder() ViewAttributesBuilder +} + +// _ViewAttributes is the data-structure of this message +type _ViewAttributes struct { + ExtensionObjectDefinitionContract + SpecifiedAttributes uint32 + DisplayName LocalizedText + Description LocalizedText + WriteMask uint32 + UserWriteMask uint32 + ContainsNoLoops bool + EventNotifier uint8 + // Reserved Fields + reservedField0 *uint8 +} + +var _ ViewAttributes = (*_ViewAttributes)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_ViewAttributes)(nil) + +// NewViewAttributes factory function for _ViewAttributes +func NewViewAttributes(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, containsNoLoops bool, eventNotifier uint8) *_ViewAttributes { + if displayName == nil { + panic("displayName of type LocalizedText for ViewAttributes must not be nil") + } + if description == nil { + panic("description of type LocalizedText for ViewAttributes must not be nil") + } + _result := &_ViewAttributes{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + SpecifiedAttributes: specifiedAttributes, + DisplayName: displayName, + Description: description, + WriteMask: writeMask, + UserWriteMask: userWriteMask, + ContainsNoLoops: containsNoLoops, + EventNotifier: eventNotifier, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// ViewAttributesBuilder is a builder for ViewAttributes +type ViewAttributesBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, containsNoLoops bool, eventNotifier uint8) ViewAttributesBuilder + // WithSpecifiedAttributes adds SpecifiedAttributes (property field) + WithSpecifiedAttributes(uint32) ViewAttributesBuilder + // WithDisplayName adds DisplayName (property field) + WithDisplayName(LocalizedText) ViewAttributesBuilder + // WithDisplayNameBuilder adds DisplayName (property field) which is build by the builder + WithDisplayNameBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ViewAttributesBuilder + // WithDescription adds Description (property field) + WithDescription(LocalizedText) ViewAttributesBuilder + // WithDescriptionBuilder adds Description (property field) which is build by the builder + WithDescriptionBuilder(func(LocalizedTextBuilder) LocalizedTextBuilder) ViewAttributesBuilder + // WithWriteMask adds WriteMask (property field) + WithWriteMask(uint32) ViewAttributesBuilder + // WithUserWriteMask adds UserWriteMask (property field) + WithUserWriteMask(uint32) ViewAttributesBuilder + // WithContainsNoLoops adds ContainsNoLoops (property field) + WithContainsNoLoops(bool) ViewAttributesBuilder + // WithEventNotifier adds EventNotifier (property field) + WithEventNotifier(uint8) ViewAttributesBuilder + // Build builds the ViewAttributes or returns an error if something is wrong + Build() (ViewAttributes, error) + // MustBuild does the same as Build but panics on error + MustBuild() ViewAttributes +} + +// NewViewAttributesBuilder() creates a ViewAttributesBuilder +func NewViewAttributesBuilder() ViewAttributesBuilder { + return &_ViewAttributesBuilder{_ViewAttributes: new(_ViewAttributes)} +} + +type _ViewAttributesBuilder struct { + *_ViewAttributes + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (ViewAttributesBuilder) = (*_ViewAttributesBuilder)(nil) + +func (b *_ViewAttributesBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_ViewAttributesBuilder) WithMandatoryFields(specifiedAttributes uint32, displayName LocalizedText, description LocalizedText, writeMask uint32, userWriteMask uint32, containsNoLoops bool, eventNotifier uint8) ViewAttributesBuilder { + return b.WithSpecifiedAttributes(specifiedAttributes).WithDisplayName(displayName).WithDescription(description).WithWriteMask(writeMask).WithUserWriteMask(userWriteMask).WithContainsNoLoops(containsNoLoops).WithEventNotifier(eventNotifier) +} + +func (b *_ViewAttributesBuilder) WithSpecifiedAttributes(specifiedAttributes uint32) ViewAttributesBuilder { + b.SpecifiedAttributes = specifiedAttributes + return b +} + +func (b *_ViewAttributesBuilder) WithDisplayName(displayName LocalizedText) ViewAttributesBuilder { + b.DisplayName = displayName + return b +} + +func (b *_ViewAttributesBuilder) WithDisplayNameBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ViewAttributesBuilder { + builder := builderSupplier(b.DisplayName.CreateLocalizedTextBuilder()) + var err error + b.DisplayName, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ViewAttributesBuilder) WithDescription(description LocalizedText) ViewAttributesBuilder { + b.Description = description + return b +} + +func (b *_ViewAttributesBuilder) WithDescriptionBuilder(builderSupplier func(LocalizedTextBuilder) LocalizedTextBuilder) ViewAttributesBuilder { + builder := builderSupplier(b.Description.CreateLocalizedTextBuilder()) + var err error + b.Description, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "LocalizedTextBuilder failed")) + } + return b +} + +func (b *_ViewAttributesBuilder) WithWriteMask(writeMask uint32) ViewAttributesBuilder { + b.WriteMask = writeMask + return b +} + +func (b *_ViewAttributesBuilder) WithUserWriteMask(userWriteMask uint32) ViewAttributesBuilder { + b.UserWriteMask = userWriteMask + return b +} + +func (b *_ViewAttributesBuilder) WithContainsNoLoops(containsNoLoops bool) ViewAttributesBuilder { + b.ContainsNoLoops = containsNoLoops + return b +} + +func (b *_ViewAttributesBuilder) WithEventNotifier(eventNotifier uint8) ViewAttributesBuilder { + b.EventNotifier = eventNotifier + return b +} + +func (b *_ViewAttributesBuilder) Build() (ViewAttributes, error) { + if b.DisplayName == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'displayName' not set")) + } + if b.Description == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'description' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._ViewAttributes.deepCopy(), nil +} + +func (b *_ViewAttributesBuilder) MustBuild() ViewAttributes { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_ViewAttributesBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_ViewAttributesBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_ViewAttributesBuilder) DeepCopy() any { + _copy := b.CreateViewAttributesBuilder().(*_ViewAttributesBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateViewAttributesBuilder creates a ViewAttributesBuilder +func (b *_ViewAttributes) CreateViewAttributesBuilder() ViewAttributesBuilder { + if b == nil { + return NewViewAttributesBuilder() + } + return &_ViewAttributesBuilder{_ViewAttributes: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ViewAttributes) GetExtensionId() int32 { + return int32(375) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ViewAttributes) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ViewAttributes) GetSpecifiedAttributes() uint32 { + return m.SpecifiedAttributes +} + +func (m *_ViewAttributes) GetDisplayName() LocalizedText { + return m.DisplayName +} + +func (m *_ViewAttributes) GetDescription() LocalizedText { + return m.Description +} + +func (m *_ViewAttributes) GetWriteMask() uint32 { + return m.WriteMask +} + +func (m *_ViewAttributes) GetUserWriteMask() uint32 { + return m.UserWriteMask +} + +func (m *_ViewAttributes) GetContainsNoLoops() bool { + return m.ContainsNoLoops +} + +func (m *_ViewAttributes) GetEventNotifier() uint8 { + return m.EventNotifier +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastViewAttributes(structType any) ViewAttributes { + if casted, ok := structType.(ViewAttributes); ok { + return casted + } + if casted, ok := structType.(*ViewAttributes); ok { + return *casted + } + return nil +} + +func (m *_ViewAttributes) GetTypeName() string { + return "ViewAttributes" +} + +func (m *_ViewAttributes) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (specifiedAttributes) + lengthInBits += 32 + + // Simple field (displayName) + lengthInBits += m.DisplayName.GetLengthInBits(ctx) + + // Simple field (description) + lengthInBits += m.Description.GetLengthInBits(ctx) + + // Simple field (writeMask) + lengthInBits += 32 + + // Simple field (userWriteMask) + lengthInBits += 32 + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (containsNoLoops) + lengthInBits += 1 + + // Simple field (eventNotifier) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_ViewAttributes) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_ViewAttributes) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__viewAttributes ViewAttributes, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ViewAttributes"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ViewAttributes") + } + currentPos := positionAware.GetPos() + _ = currentPos + + specifiedAttributes, err := ReadSimpleField(ctx, "specifiedAttributes", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'specifiedAttributes' field")) + } + m.SpecifiedAttributes = specifiedAttributes + + displayName, err := ReadSimpleField[LocalizedText](ctx, "displayName", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'displayName' field")) + } + m.DisplayName = displayName + + description, err := ReadSimpleField[LocalizedText](ctx, "description", ReadComplex[LocalizedText](LocalizedTextParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'description' field")) + } + m.Description = description + + writeMask, err := ReadSimpleField(ctx, "writeMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writeMask' field")) + } + m.WriteMask = writeMask + + userWriteMask, err := ReadSimpleField(ctx, "userWriteMask", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'userWriteMask' field")) + } + m.UserWriteMask = userWriteMask + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + containsNoLoops, err := ReadSimpleField(ctx, "containsNoLoops", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'containsNoLoops' field")) + } + m.ContainsNoLoops = containsNoLoops + + eventNotifier, err := ReadSimpleField(ctx, "eventNotifier", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'eventNotifier' field")) + } + m.EventNotifier = eventNotifier + + if closeErr := readBuffer.CloseContext("ViewAttributes"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ViewAttributes") + } + + return m, nil +} + +func (m *_ViewAttributes) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_ViewAttributes) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("ViewAttributes"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ViewAttributes") + } + + if err := WriteSimpleField[uint32](ctx, "specifiedAttributes", m.GetSpecifiedAttributes(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'specifiedAttributes' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "displayName", m.GetDisplayName(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'displayName' field") + } + + if err := WriteSimpleField[LocalizedText](ctx, "description", m.GetDescription(), WriteComplex[LocalizedText](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'description' field") + } + + if err := WriteSimpleField[uint32](ctx, "writeMask", m.GetWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'writeMask' field") + } + + if err := WriteSimpleField[uint32](ctx, "userWriteMask", m.GetUserWriteMask(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'userWriteMask' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "containsNoLoops", m.GetContainsNoLoops(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'containsNoLoops' field") + } + + if err := WriteSimpleField[uint8](ctx, "eventNotifier", m.GetEventNotifier(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'eventNotifier' field") + } + + if popErr := writeBuffer.PopContext("ViewAttributes"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ViewAttributes") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_ViewAttributes) IsViewAttributes() {} + +func (m *_ViewAttributes) DeepCopy() any { + return m.deepCopy() +} + +func (m *_ViewAttributes) deepCopy() *_ViewAttributes { + if m == nil { + return nil + } + _ViewAttributesCopy := &_ViewAttributes{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.SpecifiedAttributes, + m.DisplayName.DeepCopy().(LocalizedText), + m.Description.DeepCopy().(LocalizedText), + m.WriteMask, + m.UserWriteMask, + m.ContainsNoLoops, + m.EventNotifier, + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _ViewAttributesCopy +} + +func (m *_ViewAttributes) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/ViewDescription.go b/plc4go/protocols/opcua/readwrite/model/ViewDescription.go index 710eb6f0a53..b116e646149 100644 --- a/plc4go/protocols/opcua/readwrite/model/ViewDescription.go +++ b/plc4go/protocols/opcua/readwrite/model/ViewDescription.go @@ -209,8 +209,8 @@ func (b *_ViewDescription) CreateViewDescriptionBuilder() ViewDescriptionBuilder /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_ViewDescription) GetIdentifier() string { - return "513" +func (m *_ViewDescription) GetExtensionId() int32 { + return int32(513) } /////////////////////// @@ -278,7 +278,7 @@ func (m *_ViewDescription) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_ViewDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__viewDescription ViewDescription, err error) { +func (m *_ViewDescription) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__viewDescription ViewDescription, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/WriteRequest.go b/plc4go/protocols/opcua/readwrite/model/WriteRequest.go index dfcac2e339a..85cf7a93dc2 100644 --- a/plc4go/protocols/opcua/readwrite/model/WriteRequest.go +++ b/plc4go/protocols/opcua/readwrite/model/WriteRequest.go @@ -41,11 +41,9 @@ type WriteRequest interface { utils.Copyable ExtensionObjectDefinition // GetRequestHeader returns RequestHeader (property field) - GetRequestHeader() ExtensionObjectDefinition - // GetNoOfNodesToWrite returns NoOfNodesToWrite (property field) - GetNoOfNodesToWrite() int32 + GetRequestHeader() RequestHeader // GetNodesToWrite returns NodesToWrite (property field) - GetNodesToWrite() []ExtensionObjectDefinition + GetNodesToWrite() []WriteValue // IsWriteRequest is a marker method to prevent unintentional type checks (interfaces of same signature) IsWriteRequest() // CreateBuilder creates a WriteRequestBuilder @@ -55,23 +53,21 @@ type WriteRequest interface { // _WriteRequest is the data-structure of this message type _WriteRequest struct { ExtensionObjectDefinitionContract - RequestHeader ExtensionObjectDefinition - NoOfNodesToWrite int32 - NodesToWrite []ExtensionObjectDefinition + RequestHeader RequestHeader + NodesToWrite []WriteValue } var _ WriteRequest = (*_WriteRequest)(nil) var _ ExtensionObjectDefinitionRequirements = (*_WriteRequest)(nil) // NewWriteRequest factory function for _WriteRequest -func NewWriteRequest(requestHeader ExtensionObjectDefinition, noOfNodesToWrite int32, nodesToWrite []ExtensionObjectDefinition) *_WriteRequest { +func NewWriteRequest(requestHeader RequestHeader, nodesToWrite []WriteValue) *_WriteRequest { if requestHeader == nil { - panic("requestHeader of type ExtensionObjectDefinition for WriteRequest must not be nil") + panic("requestHeader of type RequestHeader for WriteRequest must not be nil") } _result := &_WriteRequest{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), RequestHeader: requestHeader, - NoOfNodesToWrite: noOfNodesToWrite, NodesToWrite: nodesToWrite, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -87,15 +83,13 @@ func NewWriteRequest(requestHeader ExtensionObjectDefinition, noOfNodesToWrite i type WriteRequestBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToWrite int32, nodesToWrite []ExtensionObjectDefinition) WriteRequestBuilder + WithMandatoryFields(requestHeader RequestHeader, nodesToWrite []WriteValue) WriteRequestBuilder // WithRequestHeader adds RequestHeader (property field) - WithRequestHeader(ExtensionObjectDefinition) WriteRequestBuilder + WithRequestHeader(RequestHeader) WriteRequestBuilder // WithRequestHeaderBuilder adds RequestHeader (property field) which is build by the builder - WithRequestHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) WriteRequestBuilder - // WithNoOfNodesToWrite adds NoOfNodesToWrite (property field) - WithNoOfNodesToWrite(int32) WriteRequestBuilder + WithRequestHeaderBuilder(func(RequestHeaderBuilder) RequestHeaderBuilder) WriteRequestBuilder // WithNodesToWrite adds NodesToWrite (property field) - WithNodesToWrite(...ExtensionObjectDefinition) WriteRequestBuilder + WithNodesToWrite(...WriteValue) WriteRequestBuilder // Build builds the WriteRequest or returns an error if something is wrong Build() (WriteRequest, error) // MustBuild does the same as Build but panics on error @@ -121,34 +115,29 @@ func (b *_WriteRequestBuilder) setParent(contract ExtensionObjectDefinitionContr b.ExtensionObjectDefinitionContract = contract } -func (b *_WriteRequestBuilder) WithMandatoryFields(requestHeader ExtensionObjectDefinition, noOfNodesToWrite int32, nodesToWrite []ExtensionObjectDefinition) WriteRequestBuilder { - return b.WithRequestHeader(requestHeader).WithNoOfNodesToWrite(noOfNodesToWrite).WithNodesToWrite(nodesToWrite...) +func (b *_WriteRequestBuilder) WithMandatoryFields(requestHeader RequestHeader, nodesToWrite []WriteValue) WriteRequestBuilder { + return b.WithRequestHeader(requestHeader).WithNodesToWrite(nodesToWrite...) } -func (b *_WriteRequestBuilder) WithRequestHeader(requestHeader ExtensionObjectDefinition) WriteRequestBuilder { +func (b *_WriteRequestBuilder) WithRequestHeader(requestHeader RequestHeader) WriteRequestBuilder { b.RequestHeader = requestHeader return b } -func (b *_WriteRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) WriteRequestBuilder { - builder := builderSupplier(b.RequestHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_WriteRequestBuilder) WithRequestHeaderBuilder(builderSupplier func(RequestHeaderBuilder) RequestHeaderBuilder) WriteRequestBuilder { + builder := builderSupplier(b.RequestHeader.CreateRequestHeaderBuilder()) var err error b.RequestHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "RequestHeaderBuilder failed")) } return b } -func (b *_WriteRequestBuilder) WithNoOfNodesToWrite(noOfNodesToWrite int32) WriteRequestBuilder { - b.NoOfNodesToWrite = noOfNodesToWrite - return b -} - -func (b *_WriteRequestBuilder) WithNodesToWrite(nodesToWrite ...ExtensionObjectDefinition) WriteRequestBuilder { +func (b *_WriteRequestBuilder) WithNodesToWrite(nodesToWrite ...WriteValue) WriteRequestBuilder { b.NodesToWrite = nodesToWrite return b } @@ -209,8 +198,8 @@ func (b *_WriteRequest) CreateWriteRequestBuilder() WriteRequestBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_WriteRequest) GetIdentifier() string { - return "673" +func (m *_WriteRequest) GetExtensionId() int32 { + return int32(673) } /////////////////////// @@ -227,15 +216,11 @@ func (m *_WriteRequest) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_WriteRequest) GetRequestHeader() ExtensionObjectDefinition { +func (m *_WriteRequest) GetRequestHeader() RequestHeader { return m.RequestHeader } -func (m *_WriteRequest) GetNoOfNodesToWrite() int32 { - return m.NoOfNodesToWrite -} - -func (m *_WriteRequest) GetNodesToWrite() []ExtensionObjectDefinition { +func (m *_WriteRequest) GetNodesToWrite() []WriteValue { return m.NodesToWrite } @@ -265,7 +250,7 @@ func (m *_WriteRequest) GetLengthInBits(ctx context.Context) uint16 { // Simple field (requestHeader) lengthInBits += m.RequestHeader.GetLengthInBits(ctx) - // Simple field (noOfNodesToWrite) + // Implicit Field (noOfNodesToWrite) lengthInBits += 32 // Array field @@ -285,7 +270,7 @@ func (m *_WriteRequest) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_WriteRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__writeRequest WriteRequest, err error) { +func (m *_WriteRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writeRequest WriteRequest, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -296,19 +281,19 @@ func (m *_WriteRequest) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - requestHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("391")), readBuffer)) + requestHeader, err := ReadSimpleField[RequestHeader](ctx, "requestHeader", ReadComplex[RequestHeader](ExtensionObjectDefinitionParseWithBufferProducer[RequestHeader]((int32)(int32(391))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'requestHeader' field")) } m.RequestHeader = requestHeader - noOfNodesToWrite, err := ReadSimpleField(ctx, "noOfNodesToWrite", ReadSignedInt(readBuffer, uint8(32))) + noOfNodesToWrite, err := ReadImplicitField[int32](ctx, "noOfNodesToWrite", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfNodesToWrite' field")) } - m.NoOfNodesToWrite = noOfNodesToWrite + _ = noOfNodesToWrite - nodesToWrite, err := ReadCountArrayField[ExtensionObjectDefinition](ctx, "nodesToWrite", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("670")), readBuffer), uint64(noOfNodesToWrite)) + nodesToWrite, err := ReadCountArrayField[WriteValue](ctx, "nodesToWrite", ReadComplex[WriteValue](ExtensionObjectDefinitionParseWithBufferProducer[WriteValue]((int32)(int32(670))), readBuffer), uint64(noOfNodesToWrite)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'nodesToWrite' field")) } @@ -339,11 +324,11 @@ func (m *_WriteRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuffe return errors.Wrap(pushErr, "Error pushing for WriteRequest") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[RequestHeader](ctx, "requestHeader", m.GetRequestHeader(), WriteComplex[RequestHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'requestHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfNodesToWrite", m.GetNoOfNodesToWrite(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfNodesToWrite := int32(utils.InlineIf(bool((m.GetNodesToWrite()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetNodesToWrite()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfNodesToWrite", noOfNodesToWrite, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfNodesToWrite' field") } @@ -371,9 +356,8 @@ func (m *_WriteRequest) deepCopy() *_WriteRequest { } _WriteRequestCopy := &_WriteRequest{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.RequestHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfNodesToWrite, - utils.DeepCopySlice[ExtensionObjectDefinition, ExtensionObjectDefinition](m.NodesToWrite), + m.RequestHeader.DeepCopy().(RequestHeader), + utils.DeepCopySlice[WriteValue, WriteValue](m.NodesToWrite), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _WriteRequestCopy diff --git a/plc4go/protocols/opcua/readwrite/model/WriteResponse.go b/plc4go/protocols/opcua/readwrite/model/WriteResponse.go index 5c78fb0b269..62a255e641b 100644 --- a/plc4go/protocols/opcua/readwrite/model/WriteResponse.go +++ b/plc4go/protocols/opcua/readwrite/model/WriteResponse.go @@ -41,13 +41,9 @@ type WriteResponse interface { utils.Copyable ExtensionObjectDefinition // GetResponseHeader returns ResponseHeader (property field) - GetResponseHeader() ExtensionObjectDefinition - // GetNoOfResults returns NoOfResults (property field) - GetNoOfResults() int32 + GetResponseHeader() ResponseHeader // GetResults returns Results (property field) GetResults() []StatusCode - // GetNoOfDiagnosticInfos returns NoOfDiagnosticInfos (property field) - GetNoOfDiagnosticInfos() int32 // GetDiagnosticInfos returns DiagnosticInfos (property field) GetDiagnosticInfos() []DiagnosticInfo // IsWriteResponse is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -59,27 +55,23 @@ type WriteResponse interface { // _WriteResponse is the data-structure of this message type _WriteResponse struct { ExtensionObjectDefinitionContract - ResponseHeader ExtensionObjectDefinition - NoOfResults int32 - Results []StatusCode - NoOfDiagnosticInfos int32 - DiagnosticInfos []DiagnosticInfo + ResponseHeader ResponseHeader + Results []StatusCode + DiagnosticInfos []DiagnosticInfo } var _ WriteResponse = (*_WriteResponse)(nil) var _ ExtensionObjectDefinitionRequirements = (*_WriteResponse)(nil) // NewWriteResponse factory function for _WriteResponse -func NewWriteResponse(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) *_WriteResponse { +func NewWriteResponse(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) *_WriteResponse { if responseHeader == nil { - panic("responseHeader of type ExtensionObjectDefinition for WriteResponse must not be nil") + panic("responseHeader of type ResponseHeader for WriteResponse must not be nil") } _result := &_WriteResponse{ ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), ResponseHeader: responseHeader, - NoOfResults: noOfResults, Results: results, - NoOfDiagnosticInfos: noOfDiagnosticInfos, DiagnosticInfos: diagnosticInfos, } _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result @@ -95,17 +87,13 @@ func NewWriteResponse(responseHeader ExtensionObjectDefinition, noOfResults int3 type WriteResponseBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) WriteResponseBuilder + WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) WriteResponseBuilder // WithResponseHeader adds ResponseHeader (property field) - WithResponseHeader(ExtensionObjectDefinition) WriteResponseBuilder + WithResponseHeader(ResponseHeader) WriteResponseBuilder // WithResponseHeaderBuilder adds ResponseHeader (property field) which is build by the builder - WithResponseHeaderBuilder(func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) WriteResponseBuilder - // WithNoOfResults adds NoOfResults (property field) - WithNoOfResults(int32) WriteResponseBuilder + WithResponseHeaderBuilder(func(ResponseHeaderBuilder) ResponseHeaderBuilder) WriteResponseBuilder // WithResults adds Results (property field) WithResults(...StatusCode) WriteResponseBuilder - // WithNoOfDiagnosticInfos adds NoOfDiagnosticInfos (property field) - WithNoOfDiagnosticInfos(int32) WriteResponseBuilder // WithDiagnosticInfos adds DiagnosticInfos (property field) WithDiagnosticInfos(...DiagnosticInfo) WriteResponseBuilder // Build builds the WriteResponse or returns an error if something is wrong @@ -133,43 +121,33 @@ func (b *_WriteResponseBuilder) setParent(contract ExtensionObjectDefinitionCont b.ExtensionObjectDefinitionContract = contract } -func (b *_WriteResponseBuilder) WithMandatoryFields(responseHeader ExtensionObjectDefinition, noOfResults int32, results []StatusCode, noOfDiagnosticInfos int32, diagnosticInfos []DiagnosticInfo) WriteResponseBuilder { - return b.WithResponseHeader(responseHeader).WithNoOfResults(noOfResults).WithResults(results...).WithNoOfDiagnosticInfos(noOfDiagnosticInfos).WithDiagnosticInfos(diagnosticInfos...) +func (b *_WriteResponseBuilder) WithMandatoryFields(responseHeader ResponseHeader, results []StatusCode, diagnosticInfos []DiagnosticInfo) WriteResponseBuilder { + return b.WithResponseHeader(responseHeader).WithResults(results...).WithDiagnosticInfos(diagnosticInfos...) } -func (b *_WriteResponseBuilder) WithResponseHeader(responseHeader ExtensionObjectDefinition) WriteResponseBuilder { +func (b *_WriteResponseBuilder) WithResponseHeader(responseHeader ResponseHeader) WriteResponseBuilder { b.ResponseHeader = responseHeader return b } -func (b *_WriteResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ExtensionObjectDefinitionBuilder) ExtensionObjectDefinitionBuilder) WriteResponseBuilder { - builder := builderSupplier(b.ResponseHeader.CreateExtensionObjectDefinitionBuilder()) +func (b *_WriteResponseBuilder) WithResponseHeaderBuilder(builderSupplier func(ResponseHeaderBuilder) ResponseHeaderBuilder) WriteResponseBuilder { + builder := builderSupplier(b.ResponseHeader.CreateResponseHeaderBuilder()) var err error b.ResponseHeader, err = builder.Build() if err != nil { if b.err == nil { b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} } - b.err.Append(errors.Wrap(err, "ExtensionObjectDefinitionBuilder failed")) + b.err.Append(errors.Wrap(err, "ResponseHeaderBuilder failed")) } return b } -func (b *_WriteResponseBuilder) WithNoOfResults(noOfResults int32) WriteResponseBuilder { - b.NoOfResults = noOfResults - return b -} - func (b *_WriteResponseBuilder) WithResults(results ...StatusCode) WriteResponseBuilder { b.Results = results return b } -func (b *_WriteResponseBuilder) WithNoOfDiagnosticInfos(noOfDiagnosticInfos int32) WriteResponseBuilder { - b.NoOfDiagnosticInfos = noOfDiagnosticInfos - return b -} - func (b *_WriteResponseBuilder) WithDiagnosticInfos(diagnosticInfos ...DiagnosticInfo) WriteResponseBuilder { b.DiagnosticInfos = diagnosticInfos return b @@ -231,8 +209,8 @@ func (b *_WriteResponse) CreateWriteResponseBuilder() WriteResponseBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_WriteResponse) GetIdentifier() string { - return "676" +func (m *_WriteResponse) GetExtensionId() int32 { + return int32(676) } /////////////////////// @@ -249,22 +227,14 @@ func (m *_WriteResponse) GetParent() ExtensionObjectDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// -func (m *_WriteResponse) GetResponseHeader() ExtensionObjectDefinition { +func (m *_WriteResponse) GetResponseHeader() ResponseHeader { return m.ResponseHeader } -func (m *_WriteResponse) GetNoOfResults() int32 { - return m.NoOfResults -} - func (m *_WriteResponse) GetResults() []StatusCode { return m.Results } -func (m *_WriteResponse) GetNoOfDiagnosticInfos() int32 { - return m.NoOfDiagnosticInfos -} - func (m *_WriteResponse) GetDiagnosticInfos() []DiagnosticInfo { return m.DiagnosticInfos } @@ -295,7 +265,7 @@ func (m *_WriteResponse) GetLengthInBits(ctx context.Context) uint16 { // Simple field (responseHeader) lengthInBits += m.ResponseHeader.GetLengthInBits(ctx) - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32 // Array field @@ -308,7 +278,7 @@ func (m *_WriteResponse) GetLengthInBits(ctx context.Context) uint16 { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32 // Array field @@ -328,7 +298,7 @@ func (m *_WriteResponse) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_WriteResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__writeResponse WriteResponse, err error) { +func (m *_WriteResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writeResponse WriteResponse, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer @@ -339,17 +309,17 @@ func (m *_WriteResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, currentPos := positionAware.GetPos() _ = currentPos - responseHeader, err := ReadSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", ReadComplex[ExtensionObjectDefinition](ExtensionObjectDefinitionParseWithBufferProducer[ExtensionObjectDefinition]((string)("394")), readBuffer)) + responseHeader, err := ReadSimpleField[ResponseHeader](ctx, "responseHeader", ReadComplex[ResponseHeader](ExtensionObjectDefinitionParseWithBufferProducer[ResponseHeader]((int32)(int32(394))), readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'responseHeader' field")) } m.ResponseHeader = responseHeader - noOfResults, err := ReadSimpleField(ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) + noOfResults, err := ReadImplicitField[int32](ctx, "noOfResults", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfResults' field")) } - m.NoOfResults = noOfResults + _ = noOfResults results, err := ReadCountArrayField[StatusCode](ctx, "results", ReadComplex[StatusCode](StatusCodeParseWithBuffer, readBuffer), uint64(noOfResults)) if err != nil { @@ -357,11 +327,11 @@ func (m *_WriteResponse) parse(ctx context.Context, readBuffer utils.ReadBuffer, } m.Results = results - noOfDiagnosticInfos, err := ReadSimpleField(ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) + noOfDiagnosticInfos, err := ReadImplicitField[int32](ctx, "noOfDiagnosticInfos", ReadSignedInt(readBuffer, uint8(32))) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDiagnosticInfos' field")) } - m.NoOfDiagnosticInfos = noOfDiagnosticInfos + _ = noOfDiagnosticInfos diagnosticInfos, err := ReadCountArrayField[DiagnosticInfo](ctx, "diagnosticInfos", ReadComplex[DiagnosticInfo](DiagnosticInfoParseWithBuffer, readBuffer), uint64(noOfDiagnosticInfos)) if err != nil { @@ -394,19 +364,19 @@ func (m *_WriteResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuff return errors.Wrap(pushErr, "Error pushing for WriteResponse") } - if err := WriteSimpleField[ExtensionObjectDefinition](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ExtensionObjectDefinition](writeBuffer)); err != nil { + if err := WriteSimpleField[ResponseHeader](ctx, "responseHeader", m.GetResponseHeader(), WriteComplex[ResponseHeader](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'responseHeader' field") } - - if err := WriteSimpleField[int32](ctx, "noOfResults", m.GetNoOfResults(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfResults := int32(utils.InlineIf(bool((m.GetResults()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetResults()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfResults", noOfResults, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfResults' field") } if err := WriteComplexTypeArrayField(ctx, "results", m.GetResults(), writeBuffer); err != nil { return errors.Wrap(err, "Error serializing 'results' field") } - - if err := WriteSimpleField[int32](ctx, "noOfDiagnosticInfos", m.GetNoOfDiagnosticInfos(), WriteSignedInt(writeBuffer, 32)); err != nil { + noOfDiagnosticInfos := int32(utils.InlineIf(bool((m.GetDiagnosticInfos()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDiagnosticInfos()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDiagnosticInfos", noOfDiagnosticInfos, WriteSignedInt(writeBuffer, 32)); err != nil { return errors.Wrap(err, "Error serializing 'noOfDiagnosticInfos' field") } @@ -434,10 +404,8 @@ func (m *_WriteResponse) deepCopy() *_WriteResponse { } _WriteResponseCopy := &_WriteResponse{ m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), - m.ResponseHeader.DeepCopy().(ExtensionObjectDefinition), - m.NoOfResults, + m.ResponseHeader.DeepCopy().(ResponseHeader), utils.DeepCopySlice[StatusCode, StatusCode](m.Results), - m.NoOfDiagnosticInfos, utils.DeepCopySlice[DiagnosticInfo, DiagnosticInfo](m.DiagnosticInfos), } m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m diff --git a/plc4go/protocols/opcua/readwrite/model/WriteValue.go b/plc4go/protocols/opcua/readwrite/model/WriteValue.go index b8f488de23d..72008215885 100644 --- a/plc4go/protocols/opcua/readwrite/model/WriteValue.go +++ b/plc4go/protocols/opcua/readwrite/model/WriteValue.go @@ -268,8 +268,8 @@ func (b *_WriteValue) CreateWriteValueBuilder() WriteValueBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_WriteValue) GetIdentifier() string { - return "670" +func (m *_WriteValue) GetExtensionId() int32 { + return int32(670) } /////////////////////// @@ -344,7 +344,7 @@ func (m *_WriteValue) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_WriteValue) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__writeValue WriteValue, err error) { +func (m *_WriteValue) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writeValue WriteValue, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/WriterGroupDataType.go b/plc4go/protocols/opcua/readwrite/model/WriterGroupDataType.go new file mode 100644 index 00000000000..b856eb82b98 --- /dev/null +++ b/plc4go/protocols/opcua/readwrite/model/WriterGroupDataType.go @@ -0,0 +1,957 @@ +/* + * 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 + * + * https://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 ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/rs/zerolog" + + . "github.com/apache/plc4x/plc4go/spi/codegen/fields" + . "github.com/apache/plc4x/plc4go/spi/codegen/io" + "github.com/apache/plc4x/plc4go/spi/utils" +) + +// Code generated by code-generation. DO NOT EDIT. + +// WriterGroupDataType is the corresponding interface of WriterGroupDataType +type WriterGroupDataType interface { + fmt.Stringer + utils.LengthAware + utils.Serializable + utils.Copyable + ExtensionObjectDefinition + // GetName returns Name (property field) + GetName() PascalString + // GetEnabled returns Enabled (property field) + GetEnabled() bool + // GetSecurityMode returns SecurityMode (property field) + GetSecurityMode() MessageSecurityMode + // GetSecurityGroupId returns SecurityGroupId (property field) + GetSecurityGroupId() PascalString + // GetSecurityKeyServices returns SecurityKeyServices (property field) + GetSecurityKeyServices() []EndpointDescription + // GetMaxNetworkMessageSize returns MaxNetworkMessageSize (property field) + GetMaxNetworkMessageSize() uint32 + // GetGroupProperties returns GroupProperties (property field) + GetGroupProperties() []KeyValuePair + // GetWriterGroupId returns WriterGroupId (property field) + GetWriterGroupId() uint16 + // GetPublishingInterval returns PublishingInterval (property field) + GetPublishingInterval() float64 + // GetKeepAliveTime returns KeepAliveTime (property field) + GetKeepAliveTime() float64 + // GetPriority returns Priority (property field) + GetPriority() uint8 + // GetLocaleIds returns LocaleIds (property field) + GetLocaleIds() []PascalString + // GetHeaderLayoutUri returns HeaderLayoutUri (property field) + GetHeaderLayoutUri() PascalString + // GetTransportSettings returns TransportSettings (property field) + GetTransportSettings() ExtensionObject + // GetMessageSettings returns MessageSettings (property field) + GetMessageSettings() ExtensionObject + // GetDataSetWriters returns DataSetWriters (property field) + GetDataSetWriters() []DataSetWriterDataType + // IsWriterGroupDataType is a marker method to prevent unintentional type checks (interfaces of same signature) + IsWriterGroupDataType() + // CreateBuilder creates a WriterGroupDataTypeBuilder + CreateWriterGroupDataTypeBuilder() WriterGroupDataTypeBuilder +} + +// _WriterGroupDataType is the data-structure of this message +type _WriterGroupDataType struct { + ExtensionObjectDefinitionContract + Name PascalString + Enabled bool + SecurityMode MessageSecurityMode + SecurityGroupId PascalString + SecurityKeyServices []EndpointDescription + MaxNetworkMessageSize uint32 + GroupProperties []KeyValuePair + WriterGroupId uint16 + PublishingInterval float64 + KeepAliveTime float64 + Priority uint8 + LocaleIds []PascalString + HeaderLayoutUri PascalString + TransportSettings ExtensionObject + MessageSettings ExtensionObject + DataSetWriters []DataSetWriterDataType + // Reserved Fields + reservedField0 *uint8 +} + +var _ WriterGroupDataType = (*_WriterGroupDataType)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_WriterGroupDataType)(nil) + +// NewWriterGroupDataType factory function for _WriterGroupDataType +func NewWriterGroupDataType(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, writerGroupId uint16, publishingInterval float64, keepAliveTime float64, priority uint8, localeIds []PascalString, headerLayoutUri PascalString, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetWriters []DataSetWriterDataType) *_WriterGroupDataType { + if name == nil { + panic("name of type PascalString for WriterGroupDataType must not be nil") + } + if securityGroupId == nil { + panic("securityGroupId of type PascalString for WriterGroupDataType must not be nil") + } + if headerLayoutUri == nil { + panic("headerLayoutUri of type PascalString for WriterGroupDataType must not be nil") + } + if transportSettings == nil { + panic("transportSettings of type ExtensionObject for WriterGroupDataType must not be nil") + } + if messageSettings == nil { + panic("messageSettings of type ExtensionObject for WriterGroupDataType must not be nil") + } + _result := &_WriterGroupDataType{ + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + Name: name, + Enabled: enabled, + SecurityMode: securityMode, + SecurityGroupId: securityGroupId, + SecurityKeyServices: securityKeyServices, + MaxNetworkMessageSize: maxNetworkMessageSize, + GroupProperties: groupProperties, + WriterGroupId: writerGroupId, + PublishingInterval: publishingInterval, + KeepAliveTime: keepAliveTime, + Priority: priority, + LocaleIds: localeIds, + HeaderLayoutUri: headerLayoutUri, + TransportSettings: transportSettings, + MessageSettings: messageSettings, + DataSetWriters: dataSetWriters, + } + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result + return _result +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Builder +/////////////////////// + +// WriterGroupDataTypeBuilder is a builder for WriterGroupDataType +type WriterGroupDataTypeBuilder interface { + utils.Copyable + // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) + WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, writerGroupId uint16, publishingInterval float64, keepAliveTime float64, priority uint8, localeIds []PascalString, headerLayoutUri PascalString, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetWriters []DataSetWriterDataType) WriterGroupDataTypeBuilder + // WithName adds Name (property field) + WithName(PascalString) WriterGroupDataTypeBuilder + // WithNameBuilder adds Name (property field) which is build by the builder + WithNameBuilder(func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder + // WithEnabled adds Enabled (property field) + WithEnabled(bool) WriterGroupDataTypeBuilder + // WithSecurityMode adds SecurityMode (property field) + WithSecurityMode(MessageSecurityMode) WriterGroupDataTypeBuilder + // WithSecurityGroupId adds SecurityGroupId (property field) + WithSecurityGroupId(PascalString) WriterGroupDataTypeBuilder + // WithSecurityGroupIdBuilder adds SecurityGroupId (property field) which is build by the builder + WithSecurityGroupIdBuilder(func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder + // WithSecurityKeyServices adds SecurityKeyServices (property field) + WithSecurityKeyServices(...EndpointDescription) WriterGroupDataTypeBuilder + // WithMaxNetworkMessageSize adds MaxNetworkMessageSize (property field) + WithMaxNetworkMessageSize(uint32) WriterGroupDataTypeBuilder + // WithGroupProperties adds GroupProperties (property field) + WithGroupProperties(...KeyValuePair) WriterGroupDataTypeBuilder + // WithWriterGroupId adds WriterGroupId (property field) + WithWriterGroupId(uint16) WriterGroupDataTypeBuilder + // WithPublishingInterval adds PublishingInterval (property field) + WithPublishingInterval(float64) WriterGroupDataTypeBuilder + // WithKeepAliveTime adds KeepAliveTime (property field) + WithKeepAliveTime(float64) WriterGroupDataTypeBuilder + // WithPriority adds Priority (property field) + WithPriority(uint8) WriterGroupDataTypeBuilder + // WithLocaleIds adds LocaleIds (property field) + WithLocaleIds(...PascalString) WriterGroupDataTypeBuilder + // WithHeaderLayoutUri adds HeaderLayoutUri (property field) + WithHeaderLayoutUri(PascalString) WriterGroupDataTypeBuilder + // WithHeaderLayoutUriBuilder adds HeaderLayoutUri (property field) which is build by the builder + WithHeaderLayoutUriBuilder(func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder + // WithTransportSettings adds TransportSettings (property field) + WithTransportSettings(ExtensionObject) WriterGroupDataTypeBuilder + // WithTransportSettingsBuilder adds TransportSettings (property field) which is build by the builder + WithTransportSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) WriterGroupDataTypeBuilder + // WithMessageSettings adds MessageSettings (property field) + WithMessageSettings(ExtensionObject) WriterGroupDataTypeBuilder + // WithMessageSettingsBuilder adds MessageSettings (property field) which is build by the builder + WithMessageSettingsBuilder(func(ExtensionObjectBuilder) ExtensionObjectBuilder) WriterGroupDataTypeBuilder + // WithDataSetWriters adds DataSetWriters (property field) + WithDataSetWriters(...DataSetWriterDataType) WriterGroupDataTypeBuilder + // Build builds the WriterGroupDataType or returns an error if something is wrong + Build() (WriterGroupDataType, error) + // MustBuild does the same as Build but panics on error + MustBuild() WriterGroupDataType +} + +// NewWriterGroupDataTypeBuilder() creates a WriterGroupDataTypeBuilder +func NewWriterGroupDataTypeBuilder() WriterGroupDataTypeBuilder { + return &_WriterGroupDataTypeBuilder{_WriterGroupDataType: new(_WriterGroupDataType)} +} + +type _WriterGroupDataTypeBuilder struct { + *_WriterGroupDataType + + parentBuilder *_ExtensionObjectDefinitionBuilder + + err *utils.MultiError +} + +var _ (WriterGroupDataTypeBuilder) = (*_WriterGroupDataTypeBuilder)(nil) + +func (b *_WriterGroupDataTypeBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_WriterGroupDataTypeBuilder) WithMandatoryFields(name PascalString, enabled bool, securityMode MessageSecurityMode, securityGroupId PascalString, securityKeyServices []EndpointDescription, maxNetworkMessageSize uint32, groupProperties []KeyValuePair, writerGroupId uint16, publishingInterval float64, keepAliveTime float64, priority uint8, localeIds []PascalString, headerLayoutUri PascalString, transportSettings ExtensionObject, messageSettings ExtensionObject, dataSetWriters []DataSetWriterDataType) WriterGroupDataTypeBuilder { + return b.WithName(name).WithEnabled(enabled).WithSecurityMode(securityMode).WithSecurityGroupId(securityGroupId).WithSecurityKeyServices(securityKeyServices...).WithMaxNetworkMessageSize(maxNetworkMessageSize).WithGroupProperties(groupProperties...).WithWriterGroupId(writerGroupId).WithPublishingInterval(publishingInterval).WithKeepAliveTime(keepAliveTime).WithPriority(priority).WithLocaleIds(localeIds...).WithHeaderLayoutUri(headerLayoutUri).WithTransportSettings(transportSettings).WithMessageSettings(messageSettings).WithDataSetWriters(dataSetWriters...) +} + +func (b *_WriterGroupDataTypeBuilder) WithName(name PascalString) WriterGroupDataTypeBuilder { + b.Name = name + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithNameBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder { + builder := builderSupplier(b.Name.CreatePascalStringBuilder()) + var err error + b.Name, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithEnabled(enabled bool) WriterGroupDataTypeBuilder { + b.Enabled = enabled + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithSecurityMode(securityMode MessageSecurityMode) WriterGroupDataTypeBuilder { + b.SecurityMode = securityMode + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithSecurityGroupId(securityGroupId PascalString) WriterGroupDataTypeBuilder { + b.SecurityGroupId = securityGroupId + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithSecurityGroupIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder { + builder := builderSupplier(b.SecurityGroupId.CreatePascalStringBuilder()) + var err error + b.SecurityGroupId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithSecurityKeyServices(securityKeyServices ...EndpointDescription) WriterGroupDataTypeBuilder { + b.SecurityKeyServices = securityKeyServices + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithMaxNetworkMessageSize(maxNetworkMessageSize uint32) WriterGroupDataTypeBuilder { + b.MaxNetworkMessageSize = maxNetworkMessageSize + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithGroupProperties(groupProperties ...KeyValuePair) WriterGroupDataTypeBuilder { + b.GroupProperties = groupProperties + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithWriterGroupId(writerGroupId uint16) WriterGroupDataTypeBuilder { + b.WriterGroupId = writerGroupId + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithPublishingInterval(publishingInterval float64) WriterGroupDataTypeBuilder { + b.PublishingInterval = publishingInterval + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithKeepAliveTime(keepAliveTime float64) WriterGroupDataTypeBuilder { + b.KeepAliveTime = keepAliveTime + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithPriority(priority uint8) WriterGroupDataTypeBuilder { + b.Priority = priority + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithLocaleIds(localeIds ...PascalString) WriterGroupDataTypeBuilder { + b.LocaleIds = localeIds + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithHeaderLayoutUri(headerLayoutUri PascalString) WriterGroupDataTypeBuilder { + b.HeaderLayoutUri = headerLayoutUri + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithHeaderLayoutUriBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) WriterGroupDataTypeBuilder { + builder := builderSupplier(b.HeaderLayoutUri.CreatePascalStringBuilder()) + var err error + b.HeaderLayoutUri, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithTransportSettings(transportSettings ExtensionObject) WriterGroupDataTypeBuilder { + b.TransportSettings = transportSettings + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithTransportSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) WriterGroupDataTypeBuilder { + builder := builderSupplier(b.TransportSettings.CreateExtensionObjectBuilder()) + var err error + b.TransportSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithMessageSettings(messageSettings ExtensionObject) WriterGroupDataTypeBuilder { + b.MessageSettings = messageSettings + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithMessageSettingsBuilder(builderSupplier func(ExtensionObjectBuilder) ExtensionObjectBuilder) WriterGroupDataTypeBuilder { + builder := builderSupplier(b.MessageSettings.CreateExtensionObjectBuilder()) + var err error + b.MessageSettings, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "ExtensionObjectBuilder failed")) + } + return b +} + +func (b *_WriterGroupDataTypeBuilder) WithDataSetWriters(dataSetWriters ...DataSetWriterDataType) WriterGroupDataTypeBuilder { + b.DataSetWriters = dataSetWriters + return b +} + +func (b *_WriterGroupDataTypeBuilder) Build() (WriterGroupDataType, error) { + if b.Name == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'name' not set")) + } + if b.SecurityGroupId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'securityGroupId' not set")) + } + if b.HeaderLayoutUri == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'headerLayoutUri' not set")) + } + if b.TransportSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'transportSettings' not set")) + } + if b.MessageSettings == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'messageSettings' not set")) + } + if b.err != nil { + return nil, errors.Wrap(b.err, "error occurred during build") + } + return b._WriterGroupDataType.deepCopy(), nil +} + +func (b *_WriterGroupDataTypeBuilder) MustBuild() WriterGroupDataType { + build, err := b.Build() + if err != nil { + panic(err) + } + return build +} + +// Done is used to finish work on this child and return to the parent builder +func (b *_WriterGroupDataTypeBuilder) Done() ExtensionObjectDefinitionBuilder { + return b.parentBuilder +} + +func (b *_WriterGroupDataTypeBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { + return b.Build() +} + +func (b *_WriterGroupDataTypeBuilder) DeepCopy() any { + _copy := b.CreateWriterGroupDataTypeBuilder().(*_WriterGroupDataTypeBuilder) + if b.err != nil { + _copy.err = b.err.DeepCopy().(*utils.MultiError) + } + return _copy +} + +// CreateWriterGroupDataTypeBuilder creates a WriterGroupDataTypeBuilder +func (b *_WriterGroupDataType) CreateWriterGroupDataTypeBuilder() WriterGroupDataTypeBuilder { + if b == nil { + return NewWriterGroupDataTypeBuilder() + } + return &_WriterGroupDataTypeBuilder{_WriterGroupDataType: b.deepCopy()} +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_WriterGroupDataType) GetExtensionId() int32 { + return int32(15482) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_WriterGroupDataType) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_WriterGroupDataType) GetName() PascalString { + return m.Name +} + +func (m *_WriterGroupDataType) GetEnabled() bool { + return m.Enabled +} + +func (m *_WriterGroupDataType) GetSecurityMode() MessageSecurityMode { + return m.SecurityMode +} + +func (m *_WriterGroupDataType) GetSecurityGroupId() PascalString { + return m.SecurityGroupId +} + +func (m *_WriterGroupDataType) GetSecurityKeyServices() []EndpointDescription { + return m.SecurityKeyServices +} + +func (m *_WriterGroupDataType) GetMaxNetworkMessageSize() uint32 { + return m.MaxNetworkMessageSize +} + +func (m *_WriterGroupDataType) GetGroupProperties() []KeyValuePair { + return m.GroupProperties +} + +func (m *_WriterGroupDataType) GetWriterGroupId() uint16 { + return m.WriterGroupId +} + +func (m *_WriterGroupDataType) GetPublishingInterval() float64 { + return m.PublishingInterval +} + +func (m *_WriterGroupDataType) GetKeepAliveTime() float64 { + return m.KeepAliveTime +} + +func (m *_WriterGroupDataType) GetPriority() uint8 { + return m.Priority +} + +func (m *_WriterGroupDataType) GetLocaleIds() []PascalString { + return m.LocaleIds +} + +func (m *_WriterGroupDataType) GetHeaderLayoutUri() PascalString { + return m.HeaderLayoutUri +} + +func (m *_WriterGroupDataType) GetTransportSettings() ExtensionObject { + return m.TransportSettings +} + +func (m *_WriterGroupDataType) GetMessageSettings() ExtensionObject { + return m.MessageSettings +} + +func (m *_WriterGroupDataType) GetDataSetWriters() []DataSetWriterDataType { + return m.DataSetWriters +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// Deprecated: use the interface for direct cast +func CastWriterGroupDataType(structType any) WriterGroupDataType { + if casted, ok := structType.(WriterGroupDataType); ok { + return casted + } + if casted, ok := structType.(*WriterGroupDataType); ok { + return *casted + } + return nil +} + +func (m *_WriterGroupDataType) GetTypeName() string { + return "WriterGroupDataType" +} + +func (m *_WriterGroupDataType) GetLengthInBits(ctx context.Context) uint16 { + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (name) + lengthInBits += m.Name.GetLengthInBits(ctx) + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (enabled) + lengthInBits += 1 + + // Simple field (securityMode) + lengthInBits += 32 + + // Simple field (securityGroupId) + lengthInBits += m.SecurityGroupId.GetLengthInBits(ctx) + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32 + + // Array field + if len(m.SecurityKeyServices) > 0 { + for _curItem, element := range m.SecurityKeyServices { + arrayCtx := utils.CreateArrayContext(ctx, len(m.SecurityKeyServices), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (maxNetworkMessageSize) + lengthInBits += 32 + + // Implicit Field (noOfGroupProperties) + lengthInBits += 32 + + // Array field + if len(m.GroupProperties) > 0 { + for _curItem, element := range m.GroupProperties { + arrayCtx := utils.CreateArrayContext(ctx, len(m.GroupProperties), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (writerGroupId) + lengthInBits += 16 + + // Simple field (publishingInterval) + lengthInBits += 64 + + // Simple field (keepAliveTime) + lengthInBits += 64 + + // Simple field (priority) + lengthInBits += 8 + + // Implicit Field (noOfLocaleIds) + lengthInBits += 32 + + // Array field + if len(m.LocaleIds) > 0 { + for _curItem, element := range m.LocaleIds { + arrayCtx := utils.CreateArrayContext(ctx, len(m.LocaleIds), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + // Simple field (headerLayoutUri) + lengthInBits += m.HeaderLayoutUri.GetLengthInBits(ctx) + + // Simple field (transportSettings) + lengthInBits += m.TransportSettings.GetLengthInBits(ctx) + + // Simple field (messageSettings) + lengthInBits += m.MessageSettings.GetLengthInBits(ctx) + + // Implicit Field (noOfDataSetWriters) + lengthInBits += 32 + + // Array field + if len(m.DataSetWriters) > 0 { + for _curItem, element := range m.DataSetWriters { + arrayCtx := utils.CreateArrayContext(ctx, len(m.DataSetWriters), _curItem) + _ = arrayCtx + _ = _curItem + lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx) + } + } + + return lengthInBits +} + +func (m *_WriterGroupDataType) GetLengthInBytes(ctx context.Context) uint16 { + return m.GetLengthInBits(ctx) / 8 +} + +func (m *_WriterGroupDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writerGroupDataType WriterGroupDataType, err error) { + m.ExtensionObjectDefinitionContract = parent + parent._SubType = m + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("WriterGroupDataType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for WriterGroupDataType") + } + currentPos := positionAware.GetPos() + _ = currentPos + + name, err := ReadSimpleField[PascalString](ctx, "name", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'name' field")) + } + m.Name = name + + reservedField0, err := ReadReservedField(ctx, "reserved", ReadUnsignedByte(readBuffer, uint8(7)), uint8(0x00)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing reserved field")) + } + m.reservedField0 = reservedField0 + + enabled, err := ReadSimpleField(ctx, "enabled", ReadBoolean(readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'enabled' field")) + } + m.Enabled = enabled + + securityMode, err := ReadEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", ReadEnum(MessageSecurityModeByValue, ReadUnsignedInt(readBuffer, uint8(32)))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityMode' field")) + } + m.SecurityMode = securityMode + + securityGroupId, err := ReadSimpleField[PascalString](ctx, "securityGroupId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityGroupId' field")) + } + m.SecurityGroupId = securityGroupId + + noOfSecurityKeyServices, err := ReadImplicitField[int32](ctx, "noOfSecurityKeyServices", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfSecurityKeyServices' field")) + } + _ = noOfSecurityKeyServices + + securityKeyServices, err := ReadCountArrayField[EndpointDescription](ctx, "securityKeyServices", ReadComplex[EndpointDescription](ExtensionObjectDefinitionParseWithBufferProducer[EndpointDescription]((int32)(int32(314))), readBuffer), uint64(noOfSecurityKeyServices)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'securityKeyServices' field")) + } + m.SecurityKeyServices = securityKeyServices + + maxNetworkMessageSize, err := ReadSimpleField(ctx, "maxNetworkMessageSize", ReadUnsignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'maxNetworkMessageSize' field")) + } + m.MaxNetworkMessageSize = maxNetworkMessageSize + + noOfGroupProperties, err := ReadImplicitField[int32](ctx, "noOfGroupProperties", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfGroupProperties' field")) + } + _ = noOfGroupProperties + + groupProperties, err := ReadCountArrayField[KeyValuePair](ctx, "groupProperties", ReadComplex[KeyValuePair](ExtensionObjectDefinitionParseWithBufferProducer[KeyValuePair]((int32)(int32(14535))), readBuffer), uint64(noOfGroupProperties)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'groupProperties' field")) + } + m.GroupProperties = groupProperties + + writerGroupId, err := ReadSimpleField(ctx, "writerGroupId", ReadUnsignedShort(readBuffer, uint8(16))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'writerGroupId' field")) + } + m.WriterGroupId = writerGroupId + + publishingInterval, err := ReadSimpleField(ctx, "publishingInterval", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'publishingInterval' field")) + } + m.PublishingInterval = publishingInterval + + keepAliveTime, err := ReadSimpleField(ctx, "keepAliveTime", ReadDouble(readBuffer, uint8(64))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'keepAliveTime' field")) + } + m.KeepAliveTime = keepAliveTime + + priority, err := ReadSimpleField(ctx, "priority", ReadUnsignedByte(readBuffer, uint8(8))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'priority' field")) + } + m.Priority = priority + + noOfLocaleIds, err := ReadImplicitField[int32](ctx, "noOfLocaleIds", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfLocaleIds' field")) + } + _ = noOfLocaleIds + + localeIds, err := ReadCountArrayField[PascalString](ctx, "localeIds", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer), uint64(noOfLocaleIds)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'localeIds' field")) + } + m.LocaleIds = localeIds + + headerLayoutUri, err := ReadSimpleField[PascalString](ctx, "headerLayoutUri", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'headerLayoutUri' field")) + } + m.HeaderLayoutUri = headerLayoutUri + + transportSettings, err := ReadSimpleField[ExtensionObject](ctx, "transportSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'transportSettings' field")) + } + m.TransportSettings = transportSettings + + messageSettings, err := ReadSimpleField[ExtensionObject](ctx, "messageSettings", ReadComplex[ExtensionObject](ExtensionObjectParseWithBufferProducer[ExtensionObject]((bool)(bool(true))), readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'messageSettings' field")) + } + m.MessageSettings = messageSettings + + noOfDataSetWriters, err := ReadImplicitField[int32](ctx, "noOfDataSetWriters", ReadSignedInt(readBuffer, uint8(32))) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'noOfDataSetWriters' field")) + } + _ = noOfDataSetWriters + + dataSetWriters, err := ReadCountArrayField[DataSetWriterDataType](ctx, "dataSetWriters", ReadComplex[DataSetWriterDataType](ExtensionObjectDefinitionParseWithBufferProducer[DataSetWriterDataType]((int32)(int32(15599))), readBuffer), uint64(noOfDataSetWriters)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'dataSetWriters' field")) + } + m.DataSetWriters = dataSetWriters + + if closeErr := readBuffer.CloseContext("WriterGroupDataType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for WriterGroupDataType") + } + + return m, nil +} + +func (m *_WriterGroupDataType) Serialize() ([]byte, error) { + wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes(context.Background())))) + if err := m.SerializeWithWriteBuffer(context.Background(), wb); err != nil { + return nil, err + } + return wb.GetBytes(), nil +} + +func (m *_WriterGroupDataType) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + log := zerolog.Ctx(ctx) + _ = log + ser := func() error { + if pushErr := writeBuffer.PushContext("WriterGroupDataType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for WriterGroupDataType") + } + + if err := WriteSimpleField[PascalString](ctx, "name", m.GetName(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'name' field") + } + + if err := WriteReservedField[uint8](ctx, "reserved", uint8(0x00), WriteUnsignedByte(writeBuffer, 7)); err != nil { + return errors.Wrap(err, "Error serializing 'reserved' field number 1") + } + + if err := WriteSimpleField[bool](ctx, "enabled", m.GetEnabled(), WriteBoolean(writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'enabled' field") + } + + if err := WriteSimpleEnumField[MessageSecurityMode](ctx, "securityMode", "MessageSecurityMode", m.GetSecurityMode(), WriteEnum[MessageSecurityMode, uint32](MessageSecurityMode.GetValue, MessageSecurityMode.PLC4XEnumName, WriteUnsignedInt(writeBuffer, 32))); err != nil { + return errors.Wrap(err, "Error serializing 'securityMode' field") + } + + if err := WriteSimpleField[PascalString](ctx, "securityGroupId", m.GetSecurityGroupId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'securityGroupId' field") + } + noOfSecurityKeyServices := int32(utils.InlineIf(bool((m.GetSecurityKeyServices()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetSecurityKeyServices()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfSecurityKeyServices", noOfSecurityKeyServices, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfSecurityKeyServices' field") + } + + if err := WriteComplexTypeArrayField(ctx, "securityKeyServices", m.GetSecurityKeyServices(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'securityKeyServices' field") + } + + if err := WriteSimpleField[uint32](ctx, "maxNetworkMessageSize", m.GetMaxNetworkMessageSize(), WriteUnsignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'maxNetworkMessageSize' field") + } + noOfGroupProperties := int32(utils.InlineIf(bool((m.GetGroupProperties()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetGroupProperties()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfGroupProperties", noOfGroupProperties, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfGroupProperties' field") + } + + if err := WriteComplexTypeArrayField(ctx, "groupProperties", m.GetGroupProperties(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'groupProperties' field") + } + + if err := WriteSimpleField[uint16](ctx, "writerGroupId", m.GetWriterGroupId(), WriteUnsignedShort(writeBuffer, 16)); err != nil { + return errors.Wrap(err, "Error serializing 'writerGroupId' field") + } + + if err := WriteSimpleField[float64](ctx, "publishingInterval", m.GetPublishingInterval(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'publishingInterval' field") + } + + if err := WriteSimpleField[float64](ctx, "keepAliveTime", m.GetKeepAliveTime(), WriteDouble(writeBuffer, 64)); err != nil { + return errors.Wrap(err, "Error serializing 'keepAliveTime' field") + } + + if err := WriteSimpleField[uint8](ctx, "priority", m.GetPriority(), WriteUnsignedByte(writeBuffer, 8)); err != nil { + return errors.Wrap(err, "Error serializing 'priority' field") + } + noOfLocaleIds := int32(utils.InlineIf(bool((m.GetLocaleIds()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetLocaleIds()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfLocaleIds", noOfLocaleIds, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfLocaleIds' field") + } + + if err := WriteComplexTypeArrayField(ctx, "localeIds", m.GetLocaleIds(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'localeIds' field") + } + + if err := WriteSimpleField[PascalString](ctx, "headerLayoutUri", m.GetHeaderLayoutUri(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'headerLayoutUri' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "transportSettings", m.GetTransportSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'transportSettings' field") + } + + if err := WriteSimpleField[ExtensionObject](ctx, "messageSettings", m.GetMessageSettings(), WriteComplex[ExtensionObject](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'messageSettings' field") + } + noOfDataSetWriters := int32(utils.InlineIf(bool((m.GetDataSetWriters()) == (nil)), func() any { return int32(-(int32(1))) }, func() any { return int32(int32(len(m.GetDataSetWriters()))) }).(int32)) + if err := WriteImplicitField(ctx, "noOfDataSetWriters", noOfDataSetWriters, WriteSignedInt(writeBuffer, 32)); err != nil { + return errors.Wrap(err, "Error serializing 'noOfDataSetWriters' field") + } + + if err := WriteComplexTypeArrayField(ctx, "dataSetWriters", m.GetDataSetWriters(), writeBuffer); err != nil { + return errors.Wrap(err, "Error serializing 'dataSetWriters' field") + } + + if popErr := writeBuffer.PopContext("WriterGroupDataType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for WriterGroupDataType") + } + return nil + } + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) +} + +func (m *_WriterGroupDataType) IsWriterGroupDataType() {} + +func (m *_WriterGroupDataType) DeepCopy() any { + return m.deepCopy() +} + +func (m *_WriterGroupDataType) deepCopy() *_WriterGroupDataType { + if m == nil { + return nil + } + _WriterGroupDataTypeCopy := &_WriterGroupDataType{ + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.Name.DeepCopy().(PascalString), + m.Enabled, + m.SecurityMode, + m.SecurityGroupId.DeepCopy().(PascalString), + utils.DeepCopySlice[EndpointDescription, EndpointDescription](m.SecurityKeyServices), + m.MaxNetworkMessageSize, + utils.DeepCopySlice[KeyValuePair, KeyValuePair](m.GroupProperties), + m.WriterGroupId, + m.PublishingInterval, + m.KeepAliveTime, + m.Priority, + utils.DeepCopySlice[PascalString, PascalString](m.LocaleIds), + m.HeaderLayoutUri.DeepCopy().(PascalString), + m.TransportSettings.DeepCopy().(ExtensionObject), + m.MessageSettings.DeepCopy().(ExtensionObject), + utils.DeepCopySlice[DataSetWriterDataType, DataSetWriterDataType](m.DataSetWriters), + m.reservedField0, + } + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m + return _WriterGroupDataTypeCopy +} + +func (m *_WriterGroupDataType) String() string { + if m == nil { + return "" + } + wb := utils.NewWriteBufferBoxBased( + utils.WithWriteBufferBoxBasedMergeSingleBoxes(), + utils.WithWriteBufferBoxBasedOmitEmptyBoxes(), + utils.WithWriteBufferBoxBasedPrintPosLengthFooter(), + ) + if err := wb.WriteSerializable(context.Background(), m); err != nil { + return err.Error() + } + return wb.GetBox().String() +} diff --git a/plc4go/protocols/opcua/readwrite/model/WriterGroupMessageDataType.go b/plc4go/protocols/opcua/readwrite/model/WriterGroupMessageDataType.go index c87734465ea..1be450a55be 100644 --- a/plc4go/protocols/opcua/readwrite/model/WriterGroupMessageDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/WriterGroupMessageDataType.go @@ -150,8 +150,8 @@ func (b *_WriterGroupMessageDataType) CreateWriterGroupMessageDataTypeBuilder() /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_WriterGroupMessageDataType) GetIdentifier() string { - return "15618" +func (m *_WriterGroupMessageDataType) GetExtensionId() int32 { + return int32(15618) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_WriterGroupMessageDataType) GetLengthInBytes(ctx context.Context) uint return m.GetLengthInBits(ctx) / 8 } -func (m *_WriterGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__writerGroupMessageDataType WriterGroupMessageDataType, err error) { +func (m *_WriterGroupMessageDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writerGroupMessageDataType WriterGroupMessageDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/WriterGroupTransportDataType.go b/plc4go/protocols/opcua/readwrite/model/WriterGroupTransportDataType.go index fe646b16e32..d46de3eb437 100644 --- a/plc4go/protocols/opcua/readwrite/model/WriterGroupTransportDataType.go +++ b/plc4go/protocols/opcua/readwrite/model/WriterGroupTransportDataType.go @@ -150,8 +150,8 @@ func (b *_WriterGroupTransportDataType) CreateWriterGroupTransportDataTypeBuilde /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_WriterGroupTransportDataType) GetIdentifier() string { - return "15613" +func (m *_WriterGroupTransportDataType) GetExtensionId() int32 { + return int32(15613) } /////////////////////// @@ -188,7 +188,7 @@ func (m *_WriterGroupTransportDataType) GetLengthInBytes(ctx context.Context) ui return m.GetLengthInBits(ctx) / 8 } -func (m *_WriterGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__writerGroupTransportDataType WriterGroupTransportDataType, err error) { +func (m *_WriterGroupTransportDataType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__writerGroupTransportDataType WriterGroupTransportDataType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/protocols/opcua/readwrite/model/X509IdentityToken.go b/plc4go/protocols/opcua/readwrite/model/X509IdentityToken.go index 82926bbf69b..8c68a968461 100644 --- a/plc4go/protocols/opcua/readwrite/model/X509IdentityToken.go +++ b/plc4go/protocols/opcua/readwrite/model/X509IdentityToken.go @@ -39,7 +39,9 @@ type X509IdentityToken interface { utils.LengthAware utils.Serializable utils.Copyable - UserIdentityTokenDefinition + ExtensionObjectDefinition + // GetPolicyId returns PolicyId (property field) + GetPolicyId() PascalString // GetCertificateData returns CertificateData (property field) GetCertificateData() PascalByteString // IsX509IdentityToken is a marker method to prevent unintentional type checks (interfaces of same signature) @@ -50,23 +52,28 @@ type X509IdentityToken interface { // _X509IdentityToken is the data-structure of this message type _X509IdentityToken struct { - UserIdentityTokenDefinitionContract + ExtensionObjectDefinitionContract + PolicyId PascalString CertificateData PascalByteString } var _ X509IdentityToken = (*_X509IdentityToken)(nil) -var _ UserIdentityTokenDefinitionRequirements = (*_X509IdentityToken)(nil) +var _ ExtensionObjectDefinitionRequirements = (*_X509IdentityToken)(nil) // NewX509IdentityToken factory function for _X509IdentityToken -func NewX509IdentityToken(certificateData PascalByteString) *_X509IdentityToken { +func NewX509IdentityToken(policyId PascalString, certificateData PascalByteString) *_X509IdentityToken { + if policyId == nil { + panic("policyId of type PascalString for X509IdentityToken must not be nil") + } if certificateData == nil { panic("certificateData of type PascalByteString for X509IdentityToken must not be nil") } _result := &_X509IdentityToken{ - UserIdentityTokenDefinitionContract: NewUserIdentityTokenDefinition(), - CertificateData: certificateData, + ExtensionObjectDefinitionContract: NewExtensionObjectDefinition(), + PolicyId: policyId, + CertificateData: certificateData, } - _result.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = _result + _result.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = _result return _result } @@ -79,7 +86,11 @@ func NewX509IdentityToken(certificateData PascalByteString) *_X509IdentityToken type X509IdentityTokenBuilder interface { utils.Copyable // WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls) - WithMandatoryFields(certificateData PascalByteString) X509IdentityTokenBuilder + WithMandatoryFields(policyId PascalString, certificateData PascalByteString) X509IdentityTokenBuilder + // WithPolicyId adds PolicyId (property field) + WithPolicyId(PascalString) X509IdentityTokenBuilder + // WithPolicyIdBuilder adds PolicyId (property field) which is build by the builder + WithPolicyIdBuilder(func(PascalStringBuilder) PascalStringBuilder) X509IdentityTokenBuilder // WithCertificateData adds CertificateData (property field) WithCertificateData(PascalByteString) X509IdentityTokenBuilder // WithCertificateDataBuilder adds CertificateData (property field) which is build by the builder @@ -98,19 +109,37 @@ func NewX509IdentityTokenBuilder() X509IdentityTokenBuilder { type _X509IdentityTokenBuilder struct { *_X509IdentityToken - parentBuilder *_UserIdentityTokenDefinitionBuilder + parentBuilder *_ExtensionObjectDefinitionBuilder err *utils.MultiError } var _ (X509IdentityTokenBuilder) = (*_X509IdentityTokenBuilder)(nil) -func (b *_X509IdentityTokenBuilder) setParent(contract UserIdentityTokenDefinitionContract) { - b.UserIdentityTokenDefinitionContract = contract +func (b *_X509IdentityTokenBuilder) setParent(contract ExtensionObjectDefinitionContract) { + b.ExtensionObjectDefinitionContract = contract +} + +func (b *_X509IdentityTokenBuilder) WithMandatoryFields(policyId PascalString, certificateData PascalByteString) X509IdentityTokenBuilder { + return b.WithPolicyId(policyId).WithCertificateData(certificateData) } -func (b *_X509IdentityTokenBuilder) WithMandatoryFields(certificateData PascalByteString) X509IdentityTokenBuilder { - return b.WithCertificateData(certificateData) +func (b *_X509IdentityTokenBuilder) WithPolicyId(policyId PascalString) X509IdentityTokenBuilder { + b.PolicyId = policyId + return b +} + +func (b *_X509IdentityTokenBuilder) WithPolicyIdBuilder(builderSupplier func(PascalStringBuilder) PascalStringBuilder) X509IdentityTokenBuilder { + builder := builderSupplier(b.PolicyId.CreatePascalStringBuilder()) + var err error + b.PolicyId, err = builder.Build() + if err != nil { + if b.err == nil { + b.err = &utils.MultiError{MainError: errors.New("sub builder failed")} + } + b.err.Append(errors.Wrap(err, "PascalStringBuilder failed")) + } + return b } func (b *_X509IdentityTokenBuilder) WithCertificateData(certificateData PascalByteString) X509IdentityTokenBuilder { @@ -132,6 +161,12 @@ func (b *_X509IdentityTokenBuilder) WithCertificateDataBuilder(builderSupplier f } func (b *_X509IdentityTokenBuilder) Build() (X509IdentityToken, error) { + if b.PolicyId == nil { + if b.err == nil { + b.err = new(utils.MultiError) + } + b.err.Append(errors.New("mandatory field 'policyId' not set")) + } if b.CertificateData == nil { if b.err == nil { b.err = new(utils.MultiError) @@ -153,11 +188,11 @@ func (b *_X509IdentityTokenBuilder) MustBuild() X509IdentityToken { } // Done is used to finish work on this child and return to the parent builder -func (b *_X509IdentityTokenBuilder) Done() UserIdentityTokenDefinitionBuilder { +func (b *_X509IdentityTokenBuilder) Done() ExtensionObjectDefinitionBuilder { return b.parentBuilder } -func (b *_X509IdentityTokenBuilder) buildForUserIdentityTokenDefinition() (UserIdentityTokenDefinition, error) { +func (b *_X509IdentityTokenBuilder) buildForExtensionObjectDefinition() (ExtensionObjectDefinition, error) { return b.Build() } @@ -187,8 +222,8 @@ func (b *_X509IdentityToken) CreateX509IdentityTokenBuilder() X509IdentityTokenB /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_X509IdentityToken) GetIdentifier() string { - return "certificate" +func (m *_X509IdentityToken) GetExtensionId() int32 { + return int32(327) } /////////////////////// @@ -196,8 +231,8 @@ func (m *_X509IdentityToken) GetIdentifier() string { /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// -func (m *_X509IdentityToken) GetParent() UserIdentityTokenDefinitionContract { - return m.UserIdentityTokenDefinitionContract +func (m *_X509IdentityToken) GetParent() ExtensionObjectDefinitionContract { + return m.ExtensionObjectDefinitionContract } /////////////////////////////////////////////////////////// @@ -205,6 +240,10 @@ func (m *_X509IdentityToken) GetParent() UserIdentityTokenDefinitionContract { /////////////////////// Accessors for property fields. /////////////////////// +func (m *_X509IdentityToken) GetPolicyId() PascalString { + return m.PolicyId +} + func (m *_X509IdentityToken) GetCertificateData() PascalByteString { return m.CertificateData } @@ -230,7 +269,10 @@ func (m *_X509IdentityToken) GetTypeName() string { } func (m *_X509IdentityToken) GetLengthInBits(ctx context.Context) uint16 { - lengthInBits := uint16(m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).getLengthInBits(ctx)) + lengthInBits := uint16(m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).getLengthInBits(ctx)) + + // Simple field (policyId) + lengthInBits += m.PolicyId.GetLengthInBits(ctx) // Simple field (certificateData) lengthInBits += m.CertificateData.GetLengthInBits(ctx) @@ -242,8 +284,8 @@ func (m *_X509IdentityToken) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_X509IdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_UserIdentityTokenDefinition, identifier string) (__x509IdentityToken X509IdentityToken, err error) { - m.UserIdentityTokenDefinitionContract = parent +func (m *_X509IdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__x509IdentityToken X509IdentityToken, err error) { + m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer _ = positionAware @@ -253,6 +295,12 @@ func (m *_X509IdentityToken) parse(ctx context.Context, readBuffer utils.ReadBuf currentPos := positionAware.GetPos() _ = currentPos + policyId, err := ReadSimpleField[PascalString](ctx, "policyId", ReadComplex[PascalString](PascalStringParseWithBuffer, readBuffer)) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'policyId' field")) + } + m.PolicyId = policyId + certificateData, err := ReadSimpleField[PascalByteString](ctx, "certificateData", ReadComplex[PascalByteString](PascalByteStringParseWithBuffer, readBuffer)) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("Error parsing 'certificateData' field")) @@ -284,6 +332,10 @@ func (m *_X509IdentityToken) SerializeWithWriteBuffer(ctx context.Context, write return errors.Wrap(pushErr, "Error pushing for X509IdentityToken") } + if err := WriteSimpleField[PascalString](ctx, "policyId", m.GetPolicyId(), WriteComplex[PascalString](writeBuffer)); err != nil { + return errors.Wrap(err, "Error serializing 'policyId' field") + } + if err := WriteSimpleField[PascalByteString](ctx, "certificateData", m.GetCertificateData(), WriteComplex[PascalByteString](writeBuffer)); err != nil { return errors.Wrap(err, "Error serializing 'certificateData' field") } @@ -293,7 +345,7 @@ func (m *_X509IdentityToken) SerializeWithWriteBuffer(ctx context.Context, write } return nil } - return m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).serializeParent(ctx, writeBuffer, m, ser) + return m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).serializeParent(ctx, writeBuffer, m, ser) } func (m *_X509IdentityToken) IsX509IdentityToken() {} @@ -307,10 +359,11 @@ func (m *_X509IdentityToken) deepCopy() *_X509IdentityToken { return nil } _X509IdentityTokenCopy := &_X509IdentityToken{ - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition).deepCopy(), + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition).deepCopy(), + m.PolicyId.DeepCopy().(PascalString), m.CertificateData.DeepCopy().(PascalByteString), } - m.UserIdentityTokenDefinitionContract.(*_UserIdentityTokenDefinition)._SubType = m + m.ExtensionObjectDefinitionContract.(*_ExtensionObjectDefinition)._SubType = m return _X509IdentityTokenCopy } diff --git a/plc4go/protocols/opcua/readwrite/model/XVType.go b/plc4go/protocols/opcua/readwrite/model/XVType.go index 72eaddc59e4..50772c69a3c 100644 --- a/plc4go/protocols/opcua/readwrite/model/XVType.go +++ b/plc4go/protocols/opcua/readwrite/model/XVType.go @@ -174,8 +174,8 @@ func (b *_XVType) CreateXVTypeBuilder() XVTypeBuilder { /////////////////////// Accessors for discriminator values. /////////////////////// -func (m *_XVType) GetIdentifier() string { - return "12082" +func (m *_XVType) GetExtensionId() int32 { + return int32(12082) } /////////////////////// @@ -236,7 +236,7 @@ func (m *_XVType) GetLengthInBytes(ctx context.Context) uint16 { return m.GetLengthInBits(ctx) / 8 } -func (m *_XVType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, identifier string) (__xVType XVType, err error) { +func (m *_XVType) parse(ctx context.Context, readBuffer utils.ReadBuffer, parent *_ExtensionObjectDefinition, extensionId int32) (__xVType XVType, err error) { m.ExtensionObjectDefinitionContract = parent parent._SubType = m positionAware := readBuffer diff --git a/plc4go/tests/drivers/tests/opcua_driver_test.go b/plc4go/tests/drivers/tests/opcua_driver_test.go index 57d7fb09482..95096ae95ce 100644 --- a/plc4go/tests/drivers/tests/opcua_driver_test.go +++ b/plc4go/tests/drivers/tests/opcua_driver_test.go @@ -20,29 +20,9 @@ package tests import ( - "context" "testing" - - "github.com/apache/plc4x/plc4go/internal/opcua" - opcuaIO "github.com/apache/plc4x/plc4go/protocols/opcua/readwrite" - readWriteModel "github.com/apache/plc4x/plc4go/protocols/opcua/readwrite/model" - "github.com/apache/plc4x/plc4go/spi/testutils" - "github.com/apache/plc4x/plc4go/spi/utils" ) func TestOPCUADriver(t *testing.T) { - //t.Skip("Not yet finished") - parser := func(readBufferByteBased utils.ReadBufferByteBased) (any, error) { - return readWriteModel.MessagePDUParseWithBuffer[readWriteModel.MessagePDU](context.Background(), readBufferByteBased, false) - } - optionsForTesting := testutils.EnrichOptionsWithOptionsForTesting(t) - testutils.RunDriverTestsuite( - t, - opcua.NewDriver(optionsForTesting...), - "assets/testing/protocols/opcua/DriverTestsuite.xml", - opcuaIO.OpcuaXmlParserHelper{}, - append(optionsForTesting, - testutils.WithRootTypeParser(parser), - )..., - ) + t.Skip("Not yet finished") } diff --git a/plc4j/drivers/opcua/pom.xml b/plc4j/drivers/opcua/pom.xml index c63e139f1bf..40fbdfe9422 100644 --- a/plc4j/drivers/opcua/pom.xml +++ b/plc4j/drivers/opcua/pom.xml @@ -162,6 +162,11 @@ bcprov-jdk18on + + com.google.guava + guava + test + org.apache.plc4x plc4j-transport-tcp @@ -289,6 +294,11 @@ provided + + com.google.guava + guava + provided + org.apache.plc4x diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionRequest.java index 7a280a05830..0b43c965bcd 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionRequest.java @@ -38,60 +38,46 @@ public class ActivateSessionRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "467"; + public Integer getExtensionId() { + return (int) 467; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition clientSignature; - protected final int noOfClientSoftwareCertificates; - protected final List clientSoftwareCertificates; - protected final int noOfLocaleIds; + protected final RequestHeader requestHeader; + protected final SignatureData clientSignature; + protected final List clientSoftwareCertificates; protected final List localeIds; protected final ExtensionObject userIdentityToken; - protected final ExtensionObjectDefinition userTokenSignature; + protected final SignatureData userTokenSignature; public ActivateSessionRequest( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition clientSignature, - int noOfClientSoftwareCertificates, - List clientSoftwareCertificates, - int noOfLocaleIds, + RequestHeader requestHeader, + SignatureData clientSignature, + List clientSoftwareCertificates, List localeIds, ExtensionObject userIdentityToken, - ExtensionObjectDefinition userTokenSignature) { + SignatureData userTokenSignature) { super(); this.requestHeader = requestHeader; this.clientSignature = clientSignature; - this.noOfClientSoftwareCertificates = noOfClientSoftwareCertificates; this.clientSoftwareCertificates = clientSoftwareCertificates; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.userIdentityToken = userIdentityToken; this.userTokenSignature = userTokenSignature; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getClientSignature() { + public SignatureData getClientSignature() { return clientSignature; } - public int getNoOfClientSoftwareCertificates() { - return noOfClientSoftwareCertificates; - } - - public List getClientSoftwareCertificates() { + public List getClientSoftwareCertificates() { return clientSoftwareCertificates; } - public int getNoOfLocaleIds() { - return noOfLocaleIds; - } - public List getLocaleIds() { return localeIds; } @@ -100,7 +86,7 @@ public ExtensionObject getUserIdentityToken() { return userIdentityToken; } - public ExtensionObjectDefinition getUserTokenSignature() { + public SignatureData getUserTokenSignature() { return userTokenSignature; } @@ -117,8 +103,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (clientSignature) writeSimpleField("clientSignature", clientSignature, writeComplex(writeBuffer)); - // Simple Field (noOfClientSoftwareCertificates) - writeSimpleField( + // Implicit Field (noOfClientSoftwareCertificates) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfClientSoftwareCertificates = + (int) + ((((getClientSoftwareCertificates()) == (null)) + ? -(1) + : COUNT(getClientSoftwareCertificates()))); + writeImplicitField( "noOfClientSoftwareCertificates", noOfClientSoftwareCertificates, writeSignedInt(writeBuffer, 32)); @@ -127,8 +119,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeComplexTypeArrayField( "clientSoftwareCertificates", clientSoftwareCertificates, writeBuffer); - // Simple Field (noOfLocaleIds) - writeSimpleField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); // Array Field (localeIds) writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); @@ -159,19 +153,19 @@ public int getLengthInBits() { // Simple field (clientSignature) lengthInBits += clientSignature.getLengthInBits(); - // Simple field (noOfClientSoftwareCertificates) + // Implicit Field (noOfClientSoftwareCertificates) lengthInBits += 32; // Array field if (clientSoftwareCertificates != null) { int i = 0; - for (ExtensionObjectDefinition element : clientSoftwareCertificates) { + for (SignedSoftwareCertificate element : clientSoftwareCertificates) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= clientSoftwareCertificates.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32; // Array field @@ -193,37 +187,41 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ActivateSessionRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition clientSignature = + SignatureData clientSignature = readSimpleField( "clientSignature", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("458")), + () -> + (SignatureData) ExtensionObjectDefinition.staticParse(readBuffer, (int) (458)), readBuffer)); int noOfClientSoftwareCertificates = - readSimpleField("noOfClientSoftwareCertificates", readSignedInt(readBuffer, 32)); + readImplicitField("noOfClientSoftwareCertificates", readSignedInt(readBuffer, 32)); - List clientSoftwareCertificates = + List clientSoftwareCertificates = readCountArrayField( "clientSoftwareCertificates", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("346")), + () -> + (SignedSoftwareCertificate) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (346)), readBuffer), noOfClientSoftwareCertificates); - int noOfLocaleIds = readSimpleField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); List localeIds = readCountArrayField( @@ -237,11 +235,12 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex( () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); - ExtensionObjectDefinition userTokenSignature = + SignatureData userTokenSignature = readSimpleField( "userTokenSignature", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("458")), + () -> + (SignatureData) ExtensionObjectDefinition.staticParse(readBuffer, (int) (458)), readBuffer)); readBuffer.closeContext("ActivateSessionRequest"); @@ -249,9 +248,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit return new ActivateSessionRequestBuilderImpl( requestHeader, clientSignature, - noOfClientSoftwareCertificates, clientSoftwareCertificates, - noOfLocaleIds, localeIds, userIdentityToken, userTokenSignature); @@ -259,29 +256,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class ActivateSessionRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition clientSignature; - private final int noOfClientSoftwareCertificates; - private final List clientSoftwareCertificates; - private final int noOfLocaleIds; + private final RequestHeader requestHeader; + private final SignatureData clientSignature; + private final List clientSoftwareCertificates; private final List localeIds; private final ExtensionObject userIdentityToken; - private final ExtensionObjectDefinition userTokenSignature; + private final SignatureData userTokenSignature; public ActivateSessionRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition clientSignature, - int noOfClientSoftwareCertificates, - List clientSoftwareCertificates, - int noOfLocaleIds, + RequestHeader requestHeader, + SignatureData clientSignature, + List clientSoftwareCertificates, List localeIds, ExtensionObject userIdentityToken, - ExtensionObjectDefinition userTokenSignature) { + SignatureData userTokenSignature) { this.requestHeader = requestHeader; this.clientSignature = clientSignature; - this.noOfClientSoftwareCertificates = noOfClientSoftwareCertificates; this.clientSoftwareCertificates = clientSoftwareCertificates; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.userIdentityToken = userIdentityToken; this.userTokenSignature = userTokenSignature; @@ -292,9 +283,7 @@ public ActivateSessionRequest build() { new ActivateSessionRequest( requestHeader, clientSignature, - noOfClientSoftwareCertificates, clientSoftwareCertificates, - noOfLocaleIds, localeIds, userIdentityToken, userTokenSignature); @@ -313,9 +302,7 @@ public boolean equals(Object o) { ActivateSessionRequest that = (ActivateSessionRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getClientSignature() == that.getClientSignature()) - && (getNoOfClientSoftwareCertificates() == that.getNoOfClientSoftwareCertificates()) && (getClientSoftwareCertificates() == that.getClientSoftwareCertificates()) - && (getNoOfLocaleIds() == that.getNoOfLocaleIds()) && (getLocaleIds() == that.getLocaleIds()) && (getUserIdentityToken() == that.getUserIdentityToken()) && (getUserTokenSignature() == that.getUserTokenSignature()) @@ -329,9 +316,7 @@ public int hashCode() { super.hashCode(), getRequestHeader(), getClientSignature(), - getNoOfClientSoftwareCertificates(), getClientSoftwareCertificates(), - getNoOfLocaleIds(), getLocaleIds(), getUserIdentityToken(), getUserTokenSignature()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionResponse.java index 199bc616869..7e9f4cb1567 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ActivateSessionResponse.java @@ -38,35 +38,29 @@ public class ActivateSessionResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "470"; + public Integer getExtensionId() { + return (int) 470; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final PascalByteString serverNonce; - protected final int noOfResults; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public ActivateSessionResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, PascalByteString serverNonce, - int noOfResults, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; this.serverNonce = serverNonce; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -74,18 +68,10 @@ public PascalByteString getServerNonce() { return serverNonce; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -103,14 +89,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (serverNonce) writeSimpleField("serverNonce", serverNonce, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -135,7 +126,7 @@ public int getLengthInBits() { // Simple field (serverNonce) lengthInBits += serverNonce.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -147,7 +138,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -163,23 +154,24 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ActivateSessionResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); PascalByteString serverNonce = readSimpleField( "serverNonce", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -187,7 +179,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -198,42 +191,30 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ActivateSessionResponse"); // Create the instance return new ActivateSessionResponseBuilderImpl( - responseHeader, serverNonce, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + responseHeader, serverNonce, results, diagnosticInfos); } public static class ActivateSessionResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final PascalByteString serverNonce; - private final int noOfResults; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public ActivateSessionResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, PascalByteString serverNonce, - int noOfResults, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; this.serverNonce = serverNonce; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public ActivateSessionResponse build() { ActivateSessionResponse activateSessionResponse = - new ActivateSessionResponse( - responseHeader, - serverNonce, - noOfResults, - results, - noOfDiagnosticInfos, - diagnosticInfos); + new ActivateSessionResponse(responseHeader, serverNonce, results, diagnosticInfos); return activateSessionResponse; } } @@ -249,9 +230,7 @@ public boolean equals(Object o) { ActivateSessionResponse that = (ActivateSessionResponse) o; return (getResponseHeader() == that.getResponseHeader()) && (getServerNonce() == that.getServerNonce()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -263,9 +242,7 @@ public int hashCode() { super.hashCode(), getResponseHeader(), getServerNonce(), - getNoOfResults(), getResults(), - getNoOfDiagnosticInfos(), getDiagnosticInfos()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesItem.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesItem.java index 890f29c603a..90d7fec563f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesItem.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesItem.java @@ -38,8 +38,8 @@ public class AddNodesItem extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "378"; + public Integer getExtensionId() { + return (int) 378; } // Properties. @@ -168,7 +168,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddNodesItem"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesRequest.java index df2265caed8..58effce83d4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesRequest.java @@ -38,34 +38,25 @@ public class AddNodesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "488"; + public Integer getExtensionId() { + return (int) 488; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfNodesToAdd; - protected final List nodesToAdd; - - public AddNodesRequest( - ExtensionObjectDefinition requestHeader, - int noOfNodesToAdd, - List nodesToAdd) { + protected final RequestHeader requestHeader; + protected final List nodesToAdd; + + public AddNodesRequest(RequestHeader requestHeader, List nodesToAdd) { super(); this.requestHeader = requestHeader; - this.noOfNodesToAdd = noOfNodesToAdd; this.nodesToAdd = nodesToAdd; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfNodesToAdd() { - return noOfNodesToAdd; - } - - public List getNodesToAdd() { + public List getNodesToAdd() { return nodesToAdd; } @@ -79,8 +70,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfNodesToAdd) - writeSimpleField("noOfNodesToAdd", noOfNodesToAdd, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToAdd) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToAdd = (int) ((((getNodesToAdd()) == (null)) ? -(1) : COUNT(getNodesToAdd()))); + writeImplicitField("noOfNodesToAdd", noOfNodesToAdd, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToAdd) writeComplexTypeArrayField("nodesToAdd", nodesToAdd, writeBuffer); @@ -102,13 +95,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfNodesToAdd) + // Implicit Field (noOfNodesToAdd) lengthInBits += 32; // Array field if (nodesToAdd != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToAdd) { + for (AddNodesItem element : nodesToAdd) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToAdd.size()); lengthInBits += element.getLengthInBits(); } @@ -118,51 +111,46 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddNodesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfNodesToAdd = readSimpleField("noOfNodesToAdd", readSignedInt(readBuffer, 32)); + int noOfNodesToAdd = readImplicitField("noOfNodesToAdd", readSignedInt(readBuffer, 32)); - List nodesToAdd = + List nodesToAdd = readCountArrayField( "nodesToAdd", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("378")), + () -> (AddNodesItem) ExtensionObjectDefinition.staticParse(readBuffer, (int) (378)), readBuffer), noOfNodesToAdd); readBuffer.closeContext("AddNodesRequest"); // Create the instance - return new AddNodesRequestBuilderImpl(requestHeader, noOfNodesToAdd, nodesToAdd); + return new AddNodesRequestBuilderImpl(requestHeader, nodesToAdd); } public static class AddNodesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfNodesToAdd; - private final List nodesToAdd; - - public AddNodesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfNodesToAdd, - List nodesToAdd) { + private final RequestHeader requestHeader; + private final List nodesToAdd; + + public AddNodesRequestBuilderImpl(RequestHeader requestHeader, List nodesToAdd) { this.requestHeader = requestHeader; - this.noOfNodesToAdd = noOfNodesToAdd; this.nodesToAdd = nodesToAdd; } public AddNodesRequest build() { - AddNodesRequest addNodesRequest = - new AddNodesRequest(requestHeader, noOfNodesToAdd, nodesToAdd); + AddNodesRequest addNodesRequest = new AddNodesRequest(requestHeader, nodesToAdd); return addNodesRequest; } } @@ -177,7 +165,6 @@ public boolean equals(Object o) { } AddNodesRequest that = (AddNodesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfNodesToAdd() == that.getNoOfNodesToAdd()) && (getNodesToAdd() == that.getNodesToAdd()) && super.equals(that) && true; @@ -185,7 +172,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getRequestHeader(), getNoOfNodesToAdd(), getNodesToAdd()); + return Objects.hash(super.hashCode(), getRequestHeader(), getNodesToAdd()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResponse.java index 8c8320541c0..5e36de45140 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResponse.java @@ -38,47 +38,33 @@ public class AddNodesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "491"; + public Integer getExtensionId() { + return (int) 491; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public AddNodesResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (AddNodesResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,32 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddNodesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("485")), + () -> + (AddNodesResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (485)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +176,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("AddNodesResponse"); // Create the instance - return new AddNodesResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new AddNodesResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class AddNodesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public AddNodesResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public AddNodesResponse build() { AddNodesResponse addNodesResponse = - new AddNodesResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new AddNodesResponse(responseHeader, results, diagnosticInfos); return addNodesResponse; } } @@ -225,9 +211,7 @@ public boolean equals(Object o) { } AddNodesResponse that = (AddNodesResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +219,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResult.java index aef84880de9..54f1fce7a04 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddNodesResult.java @@ -38,8 +38,8 @@ public class AddNodesResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "485"; + public Integer getExtensionId() { + return (int) 485; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddNodesResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesItem.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesItem.java index 8f31e626ef8..709483b9b95 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesItem.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesItem.java @@ -38,8 +38,8 @@ public class AddReferencesItem extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "381"; + public Integer getExtensionId() { + return (int) 381; } // Properties. @@ -161,7 +161,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddReferencesItem"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesRequest.java index 3a3c3b96744..770c6e9261d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesRequest.java @@ -38,34 +38,26 @@ public class AddReferencesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "494"; + public Integer getExtensionId() { + return (int) 494; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfReferencesToAdd; - protected final List referencesToAdd; + protected final RequestHeader requestHeader; + protected final List referencesToAdd; public AddReferencesRequest( - ExtensionObjectDefinition requestHeader, - int noOfReferencesToAdd, - List referencesToAdd) { + RequestHeader requestHeader, List referencesToAdd) { super(); this.requestHeader = requestHeader; - this.noOfReferencesToAdd = noOfReferencesToAdd; this.referencesToAdd = referencesToAdd; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfReferencesToAdd() { - return noOfReferencesToAdd; - } - - public List getReferencesToAdd() { + public List getReferencesToAdd() { return referencesToAdd; } @@ -79,8 +71,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfReferencesToAdd) - writeSimpleField("noOfReferencesToAdd", noOfReferencesToAdd, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfReferencesToAdd) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReferencesToAdd = + (int) ((((getReferencesToAdd()) == (null)) ? -(1) : COUNT(getReferencesToAdd()))); + writeImplicitField("noOfReferencesToAdd", noOfReferencesToAdd, writeSignedInt(writeBuffer, 32)); // Array Field (referencesToAdd) writeComplexTypeArrayField("referencesToAdd", referencesToAdd, writeBuffer); @@ -102,13 +97,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfReferencesToAdd) + // Implicit Field (noOfReferencesToAdd) lengthInBits += 32; // Array field if (referencesToAdd != null) { int i = 0; - for (ExtensionObjectDefinition element : referencesToAdd) { + for (AddReferencesItem element : referencesToAdd) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= referencesToAdd.size()); lengthInBits += element.getLengthInBits(); } @@ -118,51 +113,51 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddReferencesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfReferencesToAdd = readSimpleField("noOfReferencesToAdd", readSignedInt(readBuffer, 32)); + int noOfReferencesToAdd = + readImplicitField("noOfReferencesToAdd", readSignedInt(readBuffer, 32)); - List referencesToAdd = + List referencesToAdd = readCountArrayField( "referencesToAdd", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("381")), + () -> + (AddReferencesItem) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (381)), readBuffer), noOfReferencesToAdd); readBuffer.closeContext("AddReferencesRequest"); // Create the instance - return new AddReferencesRequestBuilderImpl(requestHeader, noOfReferencesToAdd, referencesToAdd); + return new AddReferencesRequestBuilderImpl(requestHeader, referencesToAdd); } public static class AddReferencesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfReferencesToAdd; - private final List referencesToAdd; + private final RequestHeader requestHeader; + private final List referencesToAdd; public AddReferencesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfReferencesToAdd, - List referencesToAdd) { + RequestHeader requestHeader, List referencesToAdd) { this.requestHeader = requestHeader; - this.noOfReferencesToAdd = noOfReferencesToAdd; this.referencesToAdd = referencesToAdd; } public AddReferencesRequest build() { AddReferencesRequest addReferencesRequest = - new AddReferencesRequest(requestHeader, noOfReferencesToAdd, referencesToAdd); + new AddReferencesRequest(requestHeader, referencesToAdd); return addReferencesRequest; } } @@ -177,7 +172,6 @@ public boolean equals(Object o) { } AddReferencesRequest that = (AddReferencesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfReferencesToAdd() == that.getNoOfReferencesToAdd()) && (getReferencesToAdd() == that.getReferencesToAdd()) && super.equals(that) && true; @@ -185,8 +179,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfReferencesToAdd(), getReferencesToAdd()); + return Objects.hash(super.hashCode(), getRequestHeader(), getReferencesToAdd()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesResponse.java index ffe897b616d..9f34ad73955 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AddReferencesResponse.java @@ -38,47 +38,33 @@ public class AddReferencesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "497"; + public Integer getExtensionId() { + return (int) 497; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public AddReferencesResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AddReferencesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("AddReferencesResponse"); // Create the instance - return new AddReferencesResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new AddReferencesResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class AddReferencesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public AddReferencesResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public AddReferencesResponse build() { AddReferencesResponse addReferencesResponse = - new AddReferencesResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new AddReferencesResponse(responseHeader, results, diagnosticInfos); return addReferencesResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } AddReferencesResponse that = (AddReferencesResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AdditionalParametersType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AdditionalParametersType.java index 094fa267f06..764a5c1e096 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AdditionalParametersType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AdditionalParametersType.java @@ -38,25 +38,19 @@ public class AdditionalParametersType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "16315"; + public Integer getExtensionId() { + return (int) 16315; } // Properties. - protected final int noOfParameters; - protected final List parameters; + protected final List parameters; - public AdditionalParametersType(int noOfParameters, List parameters) { + public AdditionalParametersType(List parameters) { super(); - this.noOfParameters = noOfParameters; this.parameters = parameters; } - public int getNoOfParameters() { - return noOfParameters; - } - - public List getParameters() { + public List getParameters() { return parameters; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("AdditionalParametersType"); - // Simple Field (noOfParameters) - writeSimpleField("noOfParameters", noOfParameters, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfParameters) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfParameters = (int) ((((getParameters()) == (null)) ? -(1) : COUNT(getParameters()))); + writeImplicitField("noOfParameters", noOfParameters, writeSignedInt(writeBuffer, 32)); // Array Field (parameters) writeComplexTypeArrayField("parameters", parameters, writeBuffer); @@ -87,13 +83,13 @@ public int getLengthInBits() { AdditionalParametersType _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfParameters) + // Implicit Field (noOfParameters) lengthInBits += 32; // Array field if (parameters != null) { int i = 0; - for (ExtensionObjectDefinition element : parameters) { + for (KeyValuePair element : parameters) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= parameters.size()); lengthInBits += element.getLengthInBits(); } @@ -103,40 +99,37 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AdditionalParametersType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfParameters = readSimpleField("noOfParameters", readSignedInt(readBuffer, 32)); + int noOfParameters = readImplicitField("noOfParameters", readSignedInt(readBuffer, 32)); - List parameters = + List parameters = readCountArrayField( "parameters", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfParameters); readBuffer.closeContext("AdditionalParametersType"); // Create the instance - return new AdditionalParametersTypeBuilderImpl(noOfParameters, parameters); + return new AdditionalParametersTypeBuilderImpl(parameters); } public static class AdditionalParametersTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfParameters; - private final List parameters; + private final List parameters; - public AdditionalParametersTypeBuilderImpl( - int noOfParameters, List parameters) { - this.noOfParameters = noOfParameters; + public AdditionalParametersTypeBuilderImpl(List parameters) { this.parameters = parameters; } public AdditionalParametersType build() { - AdditionalParametersType additionalParametersType = - new AdditionalParametersType(noOfParameters, parameters); + AdditionalParametersType additionalParametersType = new AdditionalParametersType(parameters); return additionalParametersType; } } @@ -150,15 +143,12 @@ public boolean equals(Object o) { return false; } AdditionalParametersType that = (AdditionalParametersType) o; - return (getNoOfParameters() == that.getNoOfParameters()) - && (getParameters() == that.getParameters()) - && super.equals(that) - && true; + return (getParameters() == that.getParameters()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfParameters(), getParameters()); + return Objects.hash(super.hashCode(), getParameters()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateConfiguration.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateConfiguration.java index c3c865b96d8..ac8ab8a28ff 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateConfiguration.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateConfiguration.java @@ -38,8 +38,8 @@ public class AggregateConfiguration extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "950"; + public Integer getExtensionId() { + return (int) 950; } // Properties. @@ -151,7 +151,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AggregateConfiguration"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilter.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilter.java new file mode 100644 index 00000000000..8382d9bdd7f --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilter.java @@ -0,0 +1,218 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class AggregateFilter extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 730; + } + + // Properties. + protected final long startTime; + protected final NodeId aggregateType; + protected final double processingInterval; + protected final AggregateConfiguration aggregateConfiguration; + + public AggregateFilter( + long startTime, + NodeId aggregateType, + double processingInterval, + AggregateConfiguration aggregateConfiguration) { + super(); + this.startTime = startTime; + this.aggregateType = aggregateType; + this.processingInterval = processingInterval; + this.aggregateConfiguration = aggregateConfiguration; + } + + public long getStartTime() { + return startTime; + } + + public NodeId getAggregateType() { + return aggregateType; + } + + public double getProcessingInterval() { + return processingInterval; + } + + public AggregateConfiguration getAggregateConfiguration() { + return aggregateConfiguration; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("AggregateFilter"); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (aggregateType) + writeSimpleField("aggregateType", aggregateType, writeComplex(writeBuffer)); + + // Simple Field (processingInterval) + writeSimpleField("processingInterval", processingInterval, writeDouble(writeBuffer, 64)); + + // Simple Field (aggregateConfiguration) + writeSimpleField("aggregateConfiguration", aggregateConfiguration, writeComplex(writeBuffer)); + + writeBuffer.popContext("AggregateFilter"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + AggregateFilter _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (aggregateType) + lengthInBits += aggregateType.getLengthInBits(); + + // Simple field (processingInterval) + lengthInBits += 64; + + // Simple field (aggregateConfiguration) + lengthInBits += aggregateConfiguration.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("AggregateFilter"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + NodeId aggregateType = + readSimpleField( + "aggregateType", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + double processingInterval = readSimpleField("processingInterval", readDouble(readBuffer, 64)); + + AggregateConfiguration aggregateConfiguration = + readSimpleField( + "aggregateConfiguration", + readComplex( + () -> + (AggregateConfiguration) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (950)), + readBuffer)); + + readBuffer.closeContext("AggregateFilter"); + // Create the instance + return new AggregateFilterBuilderImpl( + startTime, aggregateType, processingInterval, aggregateConfiguration); + } + + public static class AggregateFilterBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long startTime; + private final NodeId aggregateType; + private final double processingInterval; + private final AggregateConfiguration aggregateConfiguration; + + public AggregateFilterBuilderImpl( + long startTime, + NodeId aggregateType, + double processingInterval, + AggregateConfiguration aggregateConfiguration) { + this.startTime = startTime; + this.aggregateType = aggregateType; + this.processingInterval = processingInterval; + this.aggregateConfiguration = aggregateConfiguration; + } + + public AggregateFilter build() { + AggregateFilter aggregateFilter = + new AggregateFilter(startTime, aggregateType, processingInterval, aggregateConfiguration); + return aggregateFilter; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof AggregateFilter)) { + return false; + } + AggregateFilter that = (AggregateFilter) o; + return (getStartTime() == that.getStartTime()) + && (getAggregateType() == that.getAggregateType()) + && (getProcessingInterval() == that.getProcessingInterval()) + && (getAggregateConfiguration() == that.getAggregateConfiguration()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getStartTime(), + getAggregateType(), + getProcessingInterval(), + getAggregateConfiguration()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilterResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilterResult.java new file mode 100644 index 00000000000..b7c2a5d2df2 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AggregateFilterResult.java @@ -0,0 +1,200 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class AggregateFilterResult extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 739; + } + + // Properties. + protected final long revisedStartTime; + protected final double revisedProcessingInterval; + protected final AggregateConfiguration revisedAggregateConfiguration; + + public AggregateFilterResult( + long revisedStartTime, + double revisedProcessingInterval, + AggregateConfiguration revisedAggregateConfiguration) { + super(); + this.revisedStartTime = revisedStartTime; + this.revisedProcessingInterval = revisedProcessingInterval; + this.revisedAggregateConfiguration = revisedAggregateConfiguration; + } + + public long getRevisedStartTime() { + return revisedStartTime; + } + + public double getRevisedProcessingInterval() { + return revisedProcessingInterval; + } + + public AggregateConfiguration getRevisedAggregateConfiguration() { + return revisedAggregateConfiguration; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("AggregateFilterResult"); + + // Simple Field (revisedStartTime) + writeSimpleField("revisedStartTime", revisedStartTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (revisedProcessingInterval) + writeSimpleField( + "revisedProcessingInterval", revisedProcessingInterval, writeDouble(writeBuffer, 64)); + + // Simple Field (revisedAggregateConfiguration) + writeSimpleField( + "revisedAggregateConfiguration", revisedAggregateConfiguration, writeComplex(writeBuffer)); + + writeBuffer.popContext("AggregateFilterResult"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + AggregateFilterResult _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (revisedStartTime) + lengthInBits += 64; + + // Simple field (revisedProcessingInterval) + lengthInBits += 64; + + // Simple field (revisedAggregateConfiguration) + lengthInBits += revisedAggregateConfiguration.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("AggregateFilterResult"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long revisedStartTime = readSimpleField("revisedStartTime", readSignedLong(readBuffer, 64)); + + double revisedProcessingInterval = + readSimpleField("revisedProcessingInterval", readDouble(readBuffer, 64)); + + AggregateConfiguration revisedAggregateConfiguration = + readSimpleField( + "revisedAggregateConfiguration", + readComplex( + () -> + (AggregateConfiguration) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (950)), + readBuffer)); + + readBuffer.closeContext("AggregateFilterResult"); + // Create the instance + return new AggregateFilterResultBuilderImpl( + revisedStartTime, revisedProcessingInterval, revisedAggregateConfiguration); + } + + public static class AggregateFilterResultBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long revisedStartTime; + private final double revisedProcessingInterval; + private final AggregateConfiguration revisedAggregateConfiguration; + + public AggregateFilterResultBuilderImpl( + long revisedStartTime, + double revisedProcessingInterval, + AggregateConfiguration revisedAggregateConfiguration) { + this.revisedStartTime = revisedStartTime; + this.revisedProcessingInterval = revisedProcessingInterval; + this.revisedAggregateConfiguration = revisedAggregateConfiguration; + } + + public AggregateFilterResult build() { + AggregateFilterResult aggregateFilterResult = + new AggregateFilterResult( + revisedStartTime, revisedProcessingInterval, revisedAggregateConfiguration); + return aggregateFilterResult; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof AggregateFilterResult)) { + return false; + } + AggregateFilterResult that = (AggregateFilterResult) o; + return (getRevisedStartTime() == that.getRevisedStartTime()) + && (getRevisedProcessingInterval() == that.getRevisedProcessingInterval()) + && (getRevisedAggregateConfiguration() == that.getRevisedAggregateConfiguration()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getRevisedStartTime(), + getRevisedProcessingInterval(), + getRevisedAggregateConfiguration()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AliasNameDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AliasNameDataType.java index f573682709b..74b2b09b54b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AliasNameDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AliasNameDataType.java @@ -38,20 +38,17 @@ public class AliasNameDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "23470"; + public Integer getExtensionId() { + return (int) 23470; } // Properties. protected final QualifiedName aliasName; - protected final int noOfReferencedNodes; protected final List referencedNodes; - public AliasNameDataType( - QualifiedName aliasName, int noOfReferencedNodes, List referencedNodes) { + public AliasNameDataType(QualifiedName aliasName, List referencedNodes) { super(); this.aliasName = aliasName; - this.noOfReferencedNodes = noOfReferencedNodes; this.referencedNodes = referencedNodes; } @@ -59,10 +56,6 @@ public QualifiedName getAliasName() { return aliasName; } - public int getNoOfReferencedNodes() { - return noOfReferencedNodes; - } - public List getReferencedNodes() { return referencedNodes; } @@ -77,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (aliasName) writeSimpleField("aliasName", aliasName, writeComplex(writeBuffer)); - // Simple Field (noOfReferencedNodes) - writeSimpleField("noOfReferencedNodes", noOfReferencedNodes, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfReferencedNodes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReferencedNodes = + (int) ((((getReferencedNodes()) == (null)) ? -(1) : COUNT(getReferencedNodes()))); + writeImplicitField("noOfReferencedNodes", noOfReferencedNodes, writeSignedInt(writeBuffer, 32)); // Array Field (referencedNodes) writeComplexTypeArrayField("referencedNodes", referencedNodes, writeBuffer); @@ -100,7 +96,7 @@ public int getLengthInBits() { // Simple field (aliasName) lengthInBits += aliasName.getLengthInBits(); - // Simple field (noOfReferencedNodes) + // Implicit Field (noOfReferencedNodes) lengthInBits += 32; // Array field @@ -116,7 +112,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AliasNameDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -125,7 +121,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "aliasName", readComplex(() -> QualifiedName.staticParse(readBuffer), readBuffer)); - int noOfReferencedNodes = readSimpleField("noOfReferencedNodes", readSignedInt(readBuffer, 32)); + int noOfReferencedNodes = + readImplicitField("noOfReferencedNodes", readSignedInt(readBuffer, 32)); List referencedNodes = readCountArrayField( @@ -135,25 +132,22 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("AliasNameDataType"); // Create the instance - return new AliasNameDataTypeBuilderImpl(aliasName, noOfReferencedNodes, referencedNodes); + return new AliasNameDataTypeBuilderImpl(aliasName, referencedNodes); } public static class AliasNameDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final QualifiedName aliasName; - private final int noOfReferencedNodes; private final List referencedNodes; public AliasNameDataTypeBuilderImpl( - QualifiedName aliasName, int noOfReferencedNodes, List referencedNodes) { + QualifiedName aliasName, List referencedNodes) { this.aliasName = aliasName; - this.noOfReferencedNodes = noOfReferencedNodes; this.referencedNodes = referencedNodes; } public AliasNameDataType build() { - AliasNameDataType aliasNameDataType = - new AliasNameDataType(aliasName, noOfReferencedNodes, referencedNodes); + AliasNameDataType aliasNameDataType = new AliasNameDataType(aliasName, referencedNodes); return aliasNameDataType; } } @@ -168,7 +162,6 @@ public boolean equals(Object o) { } AliasNameDataType that = (AliasNameDataType) o; return (getAliasName() == that.getAliasName()) - && (getNoOfReferencedNodes() == that.getNoOfReferencedNodes()) && (getReferencedNodes() == that.getReferencedNodes()) && super.equals(that) && true; @@ -176,8 +169,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getAliasName(), getNoOfReferencedNodes(), getReferencedNodes()); + return Objects.hash(super.hashCode(), getAliasName(), getReferencedNodes()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Annotation.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Annotation.java index 96399102747..52e71193b52 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Annotation.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Annotation.java @@ -38,8 +38,8 @@ public class Annotation extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "893"; + public Integer getExtensionId() { + return (int) 893; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Annotation"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnnotationDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnnotationDataType.java index c3c7bd7bdb4..6edfb83d5d6 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnnotationDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnnotationDataType.java @@ -38,8 +38,8 @@ public class AnnotationDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32436"; + public Integer getExtensionId() { + return (int) 32436; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AnnotationDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnonymousIdentityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnonymousIdentityToken.java index 688351e192f..d16af5e3916 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnonymousIdentityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AnonymousIdentityToken.java @@ -35,24 +35,35 @@ // Code generated by code-generation. DO NOT EDIT. -public class AnonymousIdentityToken extends UserIdentityTokenDefinition implements Message { +public class AnonymousIdentityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "anonymous"; + public Integer getExtensionId() { + return (int) 321; } - public AnonymousIdentityToken() { + // Properties. + protected final PascalString policyId; + + public AnonymousIdentityToken(PascalString policyId) { super(); + this.policyId = policyId; + } + + public PascalString getPolicyId() { + return policyId; } @Override - protected void serializeUserIdentityTokenDefinitionChild(WriteBuffer writeBuffer) + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("AnonymousIdentityToken"); + // Simple Field (policyId) + writeSimpleField("policyId", policyId, writeComplex(writeBuffer)); + writeBuffer.popContext("AnonymousIdentityToken"); } @@ -67,27 +78,37 @@ public int getLengthInBits() { AnonymousIdentityToken _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + // Simple field (policyId) + lengthInBits += policyId.getLengthInBits(); + return lengthInBits; } - public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AnonymousIdentityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + PascalString policyId = + readSimpleField( + "policyId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + readBuffer.closeContext("AnonymousIdentityToken"); // Create the instance - return new AnonymousIdentityTokenBuilderImpl(); + return new AnonymousIdentityTokenBuilderImpl(policyId); } public static class AnonymousIdentityTokenBuilderImpl - implements UserIdentityTokenDefinition.UserIdentityTokenDefinitionBuilder { + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString policyId; - public AnonymousIdentityTokenBuilderImpl() {} + public AnonymousIdentityTokenBuilderImpl(PascalString policyId) { + this.policyId = policyId; + } public AnonymousIdentityToken build() { - AnonymousIdentityToken anonymousIdentityToken = new AnonymousIdentityToken(); + AnonymousIdentityToken anonymousIdentityToken = new AnonymousIdentityToken(policyId); return anonymousIdentityToken; } } @@ -101,12 +122,12 @@ public boolean equals(Object o) { return false; } AnonymousIdentityToken that = (AnonymousIdentityToken) o; - return super.equals(that) && true; + return (getPolicyId() == that.getPolicyId()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode()); + return Objects.hash(super.hashCode(), getPolicyId()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ApplicationDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ApplicationDescription.java index 84f78a103d7..8b39898e212 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ApplicationDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ApplicationDescription.java @@ -38,8 +38,8 @@ public class ApplicationDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "310"; + public Integer getExtensionId() { + return (int) 310; } // Properties. @@ -49,7 +49,6 @@ public String getIdentifier() { protected final ApplicationType applicationType; protected final PascalString gatewayServerUri; protected final PascalString discoveryProfileUri; - protected final int noOfDiscoveryUrls; protected final List discoveryUrls; public ApplicationDescription( @@ -59,7 +58,6 @@ public ApplicationDescription( ApplicationType applicationType, PascalString gatewayServerUri, PascalString discoveryProfileUri, - int noOfDiscoveryUrls, List discoveryUrls) { super(); this.applicationUri = applicationUri; @@ -68,7 +66,6 @@ public ApplicationDescription( this.applicationType = applicationType; this.gatewayServerUri = gatewayServerUri; this.discoveryProfileUri = discoveryProfileUri; - this.noOfDiscoveryUrls = noOfDiscoveryUrls; this.discoveryUrls = discoveryUrls; } @@ -96,10 +93,6 @@ public PascalString getDiscoveryProfileUri() { return discoveryProfileUri; } - public int getNoOfDiscoveryUrls() { - return noOfDiscoveryUrls; - } - public List getDiscoveryUrls() { return discoveryUrls; } @@ -134,8 +127,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (discoveryProfileUri) writeSimpleField("discoveryProfileUri", discoveryProfileUri, writeComplex(writeBuffer)); - // Simple Field (noOfDiscoveryUrls) - writeSimpleField("noOfDiscoveryUrls", noOfDiscoveryUrls, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiscoveryUrls) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiscoveryUrls = + (int) ((((getDiscoveryUrls()) == (null)) ? -(1) : COUNT(getDiscoveryUrls()))); + writeImplicitField("noOfDiscoveryUrls", noOfDiscoveryUrls, writeSignedInt(writeBuffer, 32)); // Array Field (discoveryUrls) writeComplexTypeArrayField("discoveryUrls", discoveryUrls, writeBuffer); @@ -172,7 +168,7 @@ public int getLengthInBits() { // Simple field (discoveryProfileUri) lengthInBits += discoveryProfileUri.getLengthInBits(); - // Simple field (noOfDiscoveryUrls) + // Implicit Field (noOfDiscoveryUrls) lengthInBits += 32; // Array field @@ -188,7 +184,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ApplicationDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -222,7 +218,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "discoveryProfileUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfDiscoveryUrls = readSimpleField("noOfDiscoveryUrls", readSignedInt(readBuffer, 32)); + int noOfDiscoveryUrls = readImplicitField("noOfDiscoveryUrls", readSignedInt(readBuffer, 32)); List discoveryUrls = readCountArrayField( @@ -239,7 +235,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit applicationType, gatewayServerUri, discoveryProfileUri, - noOfDiscoveryUrls, discoveryUrls); } @@ -251,7 +246,6 @@ public static class ApplicationDescriptionBuilderImpl private final ApplicationType applicationType; private final PascalString gatewayServerUri; private final PascalString discoveryProfileUri; - private final int noOfDiscoveryUrls; private final List discoveryUrls; public ApplicationDescriptionBuilderImpl( @@ -261,7 +255,6 @@ public ApplicationDescriptionBuilderImpl( ApplicationType applicationType, PascalString gatewayServerUri, PascalString discoveryProfileUri, - int noOfDiscoveryUrls, List discoveryUrls) { this.applicationUri = applicationUri; this.productUri = productUri; @@ -269,7 +262,6 @@ public ApplicationDescriptionBuilderImpl( this.applicationType = applicationType; this.gatewayServerUri = gatewayServerUri; this.discoveryProfileUri = discoveryProfileUri; - this.noOfDiscoveryUrls = noOfDiscoveryUrls; this.discoveryUrls = discoveryUrls; } @@ -282,7 +274,6 @@ public ApplicationDescription build() { applicationType, gatewayServerUri, discoveryProfileUri, - noOfDiscoveryUrls, discoveryUrls); return applicationDescription; } @@ -303,7 +294,6 @@ public boolean equals(Object o) { && (getApplicationType() == that.getApplicationType()) && (getGatewayServerUri() == that.getGatewayServerUri()) && (getDiscoveryProfileUri() == that.getDiscoveryProfileUri()) - && (getNoOfDiscoveryUrls() == that.getNoOfDiscoveryUrls()) && (getDiscoveryUrls() == that.getDiscoveryUrls()) && super.equals(that) && true; @@ -319,7 +309,6 @@ public int hashCode() { getApplicationType(), getGatewayServerUri(), getDiscoveryProfileUri(), - getNoOfDiscoveryUrls(), getDiscoveryUrls()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Argument.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Argument.java index 56209c4d688..0fd6c900691 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Argument.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Argument.java @@ -38,15 +38,14 @@ public class Argument extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "298"; + public Integer getExtensionId() { + return (int) 298; } // Properties. protected final PascalString name; protected final NodeId dataType; protected final int valueRank; - protected final int noOfArrayDimensions; protected final List arrayDimensions; protected final LocalizedText description; @@ -54,14 +53,12 @@ public Argument( PascalString name, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, LocalizedText description) { super(); this.name = name; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.description = description; } @@ -78,10 +75,6 @@ public int getValueRank() { return valueRank; } - public int getNoOfArrayDimensions() { - return noOfArrayDimensions; - } - public List getArrayDimensions() { return arrayDimensions; } @@ -106,8 +99,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (valueRank) writeSimpleField("valueRank", valueRank, writeSignedInt(writeBuffer, 32)); - // Simple Field (noOfArrayDimensions) - writeSimpleField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfArrayDimensions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfArrayDimensions = + (int) ((((getArrayDimensions()) == (null)) ? -(1) : COUNT(getArrayDimensions()))); + writeImplicitField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); // Array Field (arrayDimensions) writeSimpleTypeArrayField( @@ -139,7 +135,7 @@ public int getLengthInBits() { // Simple field (valueRank) lengthInBits += 32; - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32; // Array field @@ -154,7 +150,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Argument"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -168,7 +164,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit int valueRank = readSimpleField("valueRank", readSignedInt(readBuffer, 32)); - int noOfArrayDimensions = readSimpleField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); + int noOfArrayDimensions = + readImplicitField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); List arrayDimensions = readCountArrayField( @@ -180,8 +177,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("Argument"); // Create the instance - return new ArgumentBuilderImpl( - name, dataType, valueRank, noOfArrayDimensions, arrayDimensions, description); + return new ArgumentBuilderImpl(name, dataType, valueRank, arrayDimensions, description); } public static class ArgumentBuilderImpl @@ -189,7 +185,6 @@ public static class ArgumentBuilderImpl private final PascalString name; private final NodeId dataType; private final int valueRank; - private final int noOfArrayDimensions; private final List arrayDimensions; private final LocalizedText description; @@ -197,21 +192,17 @@ public ArgumentBuilderImpl( PascalString name, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, LocalizedText description) { this.name = name; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.description = description; } public Argument build() { - Argument argument = - new Argument( - name, dataType, valueRank, noOfArrayDimensions, arrayDimensions, description); + Argument argument = new Argument(name, dataType, valueRank, arrayDimensions, description); return argument; } } @@ -228,7 +219,6 @@ public boolean equals(Object o) { return (getName() == that.getName()) && (getDataType() == that.getDataType()) && (getValueRank() == that.getValueRank()) - && (getNoOfArrayDimensions() == that.getNoOfArrayDimensions()) && (getArrayDimensions() == that.getArrayDimensions()) && (getDescription() == that.getDescription()) && super.equals(that) @@ -242,7 +232,6 @@ public int hashCode() { getName(), getDataType(), getValueRank(), - getNoOfArrayDimensions(), getArrayDimensions(), getDescription()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeId.java new file mode 100644 index 00000000000..61d191d9825 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeId.java @@ -0,0 +1,80 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import java.util.HashMap; +import java.util.Map; + +// Code generated by code-generation. DO NOT EDIT. + +public enum AttributeId { + NodeId((long) 1L), + NodeClass((long) 2L), + BrowseName((long) 3L), + DisplayName((long) 4L), + Description((long) 5L), + WriteMask((long) 6L), + UserWriteMask((long) 7L), + IsAbstract((long) 8L), + Symmetric((long) 9L), + InverseName((long) 10L), + ContainsNoLoops((long) 11L), + EventNotifier((long) 12L), + Value((long) 13L), + DataType((long) 14L), + ValueRank((long) 15L), + ArrayDimensions((long) 16L), + AccessLevel((long) 17L), + UserAccessLevel((long) 18L), + MinimumSamplingInterval((long) 19L), + Historizing((long) 20L), + Executable((long) 21L), + UserExecutable((long) 22L), + DataTypeDefinition((long) 23L), + RolePermissions((long) 24L), + UserRolePermissions((long) 25L), + AccessRestrictions((long) 26L), + AccessLevelEx((long) 27L); + private static final Map map; + + static { + map = new HashMap<>(); + for (AttributeId value : AttributeId.values()) { + map.put((long) value.getValue(), value); + } + } + + private final long value; + + AttributeId(long value) { + this.value = value; + } + + public long getValue() { + return value; + } + + public static AttributeId enumForValue(long value) { + return map.get(value); + } + + public static Boolean isDefined(long value) { + return map.containsKey(value); + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeOperand.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeOperand.java new file mode 100644 index 00000000000..f2c45923ef3 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AttributeOperand.java @@ -0,0 +1,238 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class AttributeOperand extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 600; + } + + // Properties. + protected final NodeId nodeId; + protected final PascalString alias; + protected final RelativePath browsePath; + protected final long attributeId; + protected final PascalString indexRange; + + public AttributeOperand( + NodeId nodeId, + PascalString alias, + RelativePath browsePath, + long attributeId, + PascalString indexRange) { + super(); + this.nodeId = nodeId; + this.alias = alias; + this.browsePath = browsePath; + this.attributeId = attributeId; + this.indexRange = indexRange; + } + + public NodeId getNodeId() { + return nodeId; + } + + public PascalString getAlias() { + return alias; + } + + public RelativePath getBrowsePath() { + return browsePath; + } + + public long getAttributeId() { + return attributeId; + } + + public PascalString getIndexRange() { + return indexRange; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("AttributeOperand"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Simple Field (alias) + writeSimpleField("alias", alias, writeComplex(writeBuffer)); + + // Simple Field (browsePath) + writeSimpleField("browsePath", browsePath, writeComplex(writeBuffer)); + + // Simple Field (attributeId) + writeSimpleField("attributeId", attributeId, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (indexRange) + writeSimpleField("indexRange", indexRange, writeComplex(writeBuffer)); + + writeBuffer.popContext("AttributeOperand"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + AttributeOperand _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Simple field (alias) + lengthInBits += alias.getLengthInBits(); + + // Simple field (browsePath) + lengthInBits += browsePath.getLengthInBits(); + + // Simple field (attributeId) + lengthInBits += 32; + + // Simple field (indexRange) + lengthInBits += indexRange.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("AttributeOperand"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + PascalString alias = + readSimpleField( + "alias", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + RelativePath browsePath = + readSimpleField( + "browsePath", + readComplex( + () -> (RelativePath) ExtensionObjectDefinition.staticParse(readBuffer, (int) (542)), + readBuffer)); + + long attributeId = readSimpleField("attributeId", readUnsignedLong(readBuffer, 32)); + + PascalString indexRange = + readSimpleField( + "indexRange", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("AttributeOperand"); + // Create the instance + return new AttributeOperandBuilderImpl(nodeId, alias, browsePath, attributeId, indexRange); + } + + public static class AttributeOperandBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final PascalString alias; + private final RelativePath browsePath; + private final long attributeId; + private final PascalString indexRange; + + public AttributeOperandBuilderImpl( + NodeId nodeId, + PascalString alias, + RelativePath browsePath, + long attributeId, + PascalString indexRange) { + this.nodeId = nodeId; + this.alias = alias; + this.browsePath = browsePath; + this.attributeId = attributeId; + this.indexRange = indexRange; + } + + public AttributeOperand build() { + AttributeOperand attributeOperand = + new AttributeOperand(nodeId, alias, browsePath, attributeId, indexRange); + return attributeOperand; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof AttributeOperand)) { + return false; + } + AttributeOperand that = (AttributeOperand) o; + return (getNodeId() == that.getNodeId()) + && (getAlias() == that.getAlias()) + && (getBrowsePath() == that.getBrowsePath()) + && (getAttributeId() == that.getAttributeId()) + && (getIndexRange() == that.getIndexRange()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getNodeId(), + getAlias(), + getBrowsePath(), + getAttributeId(), + getIndexRange()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AxisInformation.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AxisInformation.java index d17570bfc95..54ce946bae0 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AxisInformation.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/AxisInformation.java @@ -38,39 +38,36 @@ public class AxisInformation extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12081"; + public Integer getExtensionId() { + return (int) 12081; } // Properties. - protected final ExtensionObjectDefinition engineeringUnits; - protected final ExtensionObjectDefinition eURange; + protected final EUInformation engineeringUnits; + protected final Range eURange; protected final LocalizedText title; protected final AxisScaleEnumeration axisScaleType; - protected final int noOfAxisSteps; protected final List axisSteps; public AxisInformation( - ExtensionObjectDefinition engineeringUnits, - ExtensionObjectDefinition eURange, + EUInformation engineeringUnits, + Range eURange, LocalizedText title, AxisScaleEnumeration axisScaleType, - int noOfAxisSteps, List axisSteps) { super(); this.engineeringUnits = engineeringUnits; this.eURange = eURange; this.title = title; this.axisScaleType = axisScaleType; - this.noOfAxisSteps = noOfAxisSteps; this.axisSteps = axisSteps; } - public ExtensionObjectDefinition getEngineeringUnits() { + public EUInformation getEngineeringUnits() { return engineeringUnits; } - public ExtensionObjectDefinition getEURange() { + public Range getEURange() { return eURange; } @@ -82,10 +79,6 @@ public AxisScaleEnumeration getAxisScaleType() { return axisScaleType; } - public int getNoOfAxisSteps() { - return noOfAxisSteps; - } - public List getAxisSteps() { return axisSteps; } @@ -116,8 +109,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) AxisScaleEnumeration::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfAxisSteps) - writeSimpleField("noOfAxisSteps", noOfAxisSteps, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfAxisSteps) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfAxisSteps = (int) ((((getAxisSteps()) == (null)) ? -(1) : COUNT(getAxisSteps()))); + writeImplicitField("noOfAxisSteps", noOfAxisSteps, writeSignedInt(writeBuffer, 32)); // Array Field (axisSteps) writeSimpleTypeArrayField("axisSteps", axisSteps, writeDouble(writeBuffer, 64)); @@ -148,7 +143,7 @@ public int getLengthInBits() { // Simple field (axisScaleType) lengthInBits += 32; - // Simple field (noOfAxisSteps) + // Implicit Field (noOfAxisSteps) lengthInBits += 32; // Array field @@ -160,23 +155,24 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("AxisInformation"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition engineeringUnits = + EUInformation engineeringUnits = readSimpleField( "engineeringUnits", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("889")), + () -> + (EUInformation) ExtensionObjectDefinition.staticParse(readBuffer, (int) (889)), readBuffer)); - ExtensionObjectDefinition eURange = + Range eURange = readSimpleField( "eURange", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("886")), + () -> (Range) ExtensionObjectDefinition.staticParse(readBuffer, (int) (886)), readBuffer)); LocalizedText title = @@ -189,7 +185,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "AxisScaleEnumeration", readEnum(AxisScaleEnumeration::enumForValue, readUnsignedLong(readBuffer, 32))); - int noOfAxisSteps = readSimpleField("noOfAxisSteps", readSignedInt(readBuffer, 32)); + int noOfAxisSteps = readImplicitField("noOfAxisSteps", readSignedInt(readBuffer, 32)); List axisSteps = readCountArrayField("axisSteps", readDouble(readBuffer, 64), noOfAxisSteps); @@ -197,37 +193,33 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("AxisInformation"); // Create the instance return new AxisInformationBuilderImpl( - engineeringUnits, eURange, title, axisScaleType, noOfAxisSteps, axisSteps); + engineeringUnits, eURange, title, axisScaleType, axisSteps); } public static class AxisInformationBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition engineeringUnits; - private final ExtensionObjectDefinition eURange; + private final EUInformation engineeringUnits; + private final Range eURange; private final LocalizedText title; private final AxisScaleEnumeration axisScaleType; - private final int noOfAxisSteps; private final List axisSteps; public AxisInformationBuilderImpl( - ExtensionObjectDefinition engineeringUnits, - ExtensionObjectDefinition eURange, + EUInformation engineeringUnits, + Range eURange, LocalizedText title, AxisScaleEnumeration axisScaleType, - int noOfAxisSteps, List axisSteps) { this.engineeringUnits = engineeringUnits; this.eURange = eURange; this.title = title; this.axisScaleType = axisScaleType; - this.noOfAxisSteps = noOfAxisSteps; this.axisSteps = axisSteps; } public AxisInformation build() { AxisInformation axisInformation = - new AxisInformation( - engineeringUnits, eURange, title, axisScaleType, noOfAxisSteps, axisSteps); + new AxisInformation(engineeringUnits, eURange, title, axisScaleType, axisSteps); return axisInformation; } } @@ -245,7 +237,6 @@ public boolean equals(Object o) { && (getEURange() == that.getEURange()) && (getTitle() == that.getTitle()) && (getAxisScaleType() == that.getAxisScaleType()) - && (getNoOfAxisSteps() == that.getNoOfAxisSteps()) && (getAxisSteps() == that.getAxisSteps()) && super.equals(that) && true; @@ -259,7 +250,6 @@ public int hashCode() { getEURange(), getTitle(), getAxisScaleType(), - getNoOfAxisSteps(), getAxisSteps()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryExtensionObjectWithMask.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryExtensionObjectWithMask.java new file mode 100644 index 00000000000..c1db6b21db4 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryExtensionObjectWithMask.java @@ -0,0 +1,166 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class BinaryExtensionObjectWithMask extends ExtensionObjectWithMask implements Message { + + // Accessors for discriminator values. + public Boolean getEncodingMaskXmlBody() { + return (boolean) false; + } + + public Boolean getEncodingMaskBinaryBody() { + return (boolean) true; + } + + // Properties. + protected final ExtensionObjectDefinition body; + + public BinaryExtensionObjectWithMask( + ExpandedNodeId typeId, + ExtensionObjectEncodingMask encodingMask, + ExtensionObjectDefinition body) { + super(typeId, encodingMask); + this.body = body; + } + + public ExtensionObjectDefinition getBody() { + return body; + } + + @Override + protected void serializeExtensionObjectWithMaskChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("BinaryExtensionObjectWithMask"); + + // Implicit Field (bodyLength) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int bodyLength = (int) ((((getBody()) == (null)) ? 0 : getBody().getLengthInBytes())); + writeImplicitField("bodyLength", bodyLength, writeSignedInt(writeBuffer, 32)); + + // Simple Field (body) + writeSimpleField("body", body, writeComplex(writeBuffer)); + + writeBuffer.popContext("BinaryExtensionObjectWithMask"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + BinaryExtensionObjectWithMask _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (bodyLength) + lengthInBits += 32; + + // Simple field (body) + lengthInBits += body.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectWithMaskBuilder staticParseExtensionObjectWithMaskBuilder( + ReadBuffer readBuffer, Integer extensionId, Boolean includeEncodingMask) + throws ParseException { + readBuffer.pullContext("BinaryExtensionObjectWithMask"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int bodyLength = readImplicitField("bodyLength", readSignedInt(readBuffer, 32)); + + ExtensionObjectDefinition body = + readSimpleField( + "body", + readComplex( + () -> ExtensionObjectDefinition.staticParse(readBuffer, (int) (extensionId)), + readBuffer)); + + readBuffer.closeContext("BinaryExtensionObjectWithMask"); + // Create the instance + return new BinaryExtensionObjectWithMaskBuilderImpl(body); + } + + public static class BinaryExtensionObjectWithMaskBuilderImpl + implements ExtensionObjectWithMask.ExtensionObjectWithMaskBuilder { + private final ExtensionObjectDefinition body; + + public BinaryExtensionObjectWithMaskBuilderImpl(ExtensionObjectDefinition body) { + this.body = body; + } + + public BinaryExtensionObjectWithMask build( + ExpandedNodeId typeId, ExtensionObjectEncodingMask encodingMask) { + BinaryExtensionObjectWithMask binaryExtensionObjectWithMask = + new BinaryExtensionObjectWithMask(typeId, encodingMask, body); + return binaryExtensionObjectWithMask; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof BinaryExtensionObjectWithMask)) { + return false; + } + BinaryExtensionObjectWithMask that = (BinaryExtensionObjectWithMask) o; + return (getBody() == that.getBody()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getBody()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryPayload.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryPayload.java index 7f0e9d88dcd..34b5b9d1689 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryPayload.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BinaryPayload.java @@ -38,8 +38,8 @@ public class BinaryPayload extends Payload implements Message { // Accessors for discriminator values. - public Boolean getExtensible() { - return (boolean) false; + public Boolean getBinary() { + return (boolean) true; } // Properties. @@ -86,7 +86,7 @@ public int getLengthInBits() { } public static PayloadBuilder staticParsePayloadBuilder( - ReadBuffer readBuffer, Boolean extensible, Long byteCount) throws ParseException { + ReadBuffer readBuffer, Boolean binary, Long byteCount) throws ParseException { readBuffer.pullContext("BinaryPayload"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BitFieldDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BitFieldDefinition.java index f823b6b0d16..8c7381f5be5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BitFieldDefinition.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BitFieldDefinition.java @@ -38,8 +38,8 @@ public class BitFieldDefinition extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32423"; + public Integer getExtensionId() { + return (int) 32423; } // Properties. @@ -138,7 +138,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BitFieldDefinition"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerConnectionTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerConnectionTransportDataType.java new file mode 100644 index 00000000000..f89d9431e11 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerConnectionTransportDataType.java @@ -0,0 +1,170 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class BrokerConnectionTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15009; + } + + // Properties. + protected final PascalString resourceUri; + protected final PascalString authenticationProfileUri; + + public BrokerConnectionTransportDataType( + PascalString resourceUri, PascalString authenticationProfileUri) { + super(); + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + } + + public PascalString getResourceUri() { + return resourceUri; + } + + public PascalString getAuthenticationProfileUri() { + return authenticationProfileUri; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("BrokerConnectionTransportDataType"); + + // Simple Field (resourceUri) + writeSimpleField("resourceUri", resourceUri, writeComplex(writeBuffer)); + + // Simple Field (authenticationProfileUri) + writeSimpleField( + "authenticationProfileUri", authenticationProfileUri, writeComplex(writeBuffer)); + + writeBuffer.popContext("BrokerConnectionTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + BrokerConnectionTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (resourceUri) + lengthInBits += resourceUri.getLengthInBits(); + + // Simple field (authenticationProfileUri) + lengthInBits += authenticationProfileUri.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("BrokerConnectionTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString resourceUri = + readSimpleField( + "resourceUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString authenticationProfileUri = + readSimpleField( + "authenticationProfileUri", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("BrokerConnectionTransportDataType"); + // Create the instance + return new BrokerConnectionTransportDataTypeBuilderImpl(resourceUri, authenticationProfileUri); + } + + public static class BrokerConnectionTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString resourceUri; + private final PascalString authenticationProfileUri; + + public BrokerConnectionTransportDataTypeBuilderImpl( + PascalString resourceUri, PascalString authenticationProfileUri) { + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + } + + public BrokerConnectionTransportDataType build() { + BrokerConnectionTransportDataType brokerConnectionTransportDataType = + new BrokerConnectionTransportDataType(resourceUri, authenticationProfileUri); + return brokerConnectionTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof BrokerConnectionTransportDataType)) { + return false; + } + BrokerConnectionTransportDataType that = (BrokerConnectionTransportDataType) o; + return (getResourceUri() == that.getResourceUri()) + && (getAuthenticationProfileUri() == that.getAuthenticationProfileUri()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getResourceUri(), getAuthenticationProfileUri()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetReaderTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetReaderTransportDataType.java new file mode 100644 index 00000000000..884e11cb625 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetReaderTransportDataType.java @@ -0,0 +1,262 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class BrokerDataSetReaderTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15672; + } + + // Properties. + protected final PascalString queueName; + protected final PascalString resourceUri; + protected final PascalString authenticationProfileUri; + protected final BrokerTransportQualityOfService requestedDeliveryGuarantee; + protected final PascalString metaDataQueueName; + + public BrokerDataSetReaderTransportDataType( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee, + PascalString metaDataQueueName) { + super(); + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + this.metaDataQueueName = metaDataQueueName; + } + + public PascalString getQueueName() { + return queueName; + } + + public PascalString getResourceUri() { + return resourceUri; + } + + public PascalString getAuthenticationProfileUri() { + return authenticationProfileUri; + } + + public BrokerTransportQualityOfService getRequestedDeliveryGuarantee() { + return requestedDeliveryGuarantee; + } + + public PascalString getMetaDataQueueName() { + return metaDataQueueName; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("BrokerDataSetReaderTransportDataType"); + + // Simple Field (queueName) + writeSimpleField("queueName", queueName, writeComplex(writeBuffer)); + + // Simple Field (resourceUri) + writeSimpleField("resourceUri", resourceUri, writeComplex(writeBuffer)); + + // Simple Field (authenticationProfileUri) + writeSimpleField( + "authenticationProfileUri", authenticationProfileUri, writeComplex(writeBuffer)); + + // Simple Field (requestedDeliveryGuarantee) + writeSimpleEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + requestedDeliveryGuarantee, + writeEnum( + BrokerTransportQualityOfService::getValue, + BrokerTransportQualityOfService::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (metaDataQueueName) + writeSimpleField("metaDataQueueName", metaDataQueueName, writeComplex(writeBuffer)); + + writeBuffer.popContext("BrokerDataSetReaderTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + BrokerDataSetReaderTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (queueName) + lengthInBits += queueName.getLengthInBits(); + + // Simple field (resourceUri) + lengthInBits += resourceUri.getLengthInBits(); + + // Simple field (authenticationProfileUri) + lengthInBits += authenticationProfileUri.getLengthInBits(); + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32; + + // Simple field (metaDataQueueName) + lengthInBits += metaDataQueueName.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("BrokerDataSetReaderTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString queueName = + readSimpleField( + "queueName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString resourceUri = + readSimpleField( + "resourceUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString authenticationProfileUri = + readSimpleField( + "authenticationProfileUri", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + BrokerTransportQualityOfService requestedDeliveryGuarantee = + readEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + readEnum( + BrokerTransportQualityOfService::enumForValue, readUnsignedLong(readBuffer, 32))); + + PascalString metaDataQueueName = + readSimpleField( + "metaDataQueueName", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("BrokerDataSetReaderTransportDataType"); + // Create the instance + return new BrokerDataSetReaderTransportDataTypeBuilderImpl( + queueName, + resourceUri, + authenticationProfileUri, + requestedDeliveryGuarantee, + metaDataQueueName); + } + + public static class BrokerDataSetReaderTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString queueName; + private final PascalString resourceUri; + private final PascalString authenticationProfileUri; + private final BrokerTransportQualityOfService requestedDeliveryGuarantee; + private final PascalString metaDataQueueName; + + public BrokerDataSetReaderTransportDataTypeBuilderImpl( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee, + PascalString metaDataQueueName) { + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + this.metaDataQueueName = metaDataQueueName; + } + + public BrokerDataSetReaderTransportDataType build() { + BrokerDataSetReaderTransportDataType brokerDataSetReaderTransportDataType = + new BrokerDataSetReaderTransportDataType( + queueName, + resourceUri, + authenticationProfileUri, + requestedDeliveryGuarantee, + metaDataQueueName); + return brokerDataSetReaderTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof BrokerDataSetReaderTransportDataType)) { + return false; + } + BrokerDataSetReaderTransportDataType that = (BrokerDataSetReaderTransportDataType) o; + return (getQueueName() == that.getQueueName()) + && (getResourceUri() == that.getResourceUri()) + && (getAuthenticationProfileUri() == that.getAuthenticationProfileUri()) + && (getRequestedDeliveryGuarantee() == that.getRequestedDeliveryGuarantee()) + && (getMetaDataQueueName() == that.getMetaDataQueueName()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getQueueName(), + getResourceUri(), + getAuthenticationProfileUri(), + getRequestedDeliveryGuarantee(), + getMetaDataQueueName()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetWriterTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetWriterTransportDataType.java new file mode 100644 index 00000000000..b738a3c3d19 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerDataSetWriterTransportDataType.java @@ -0,0 +1,284 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class BrokerDataSetWriterTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15671; + } + + // Properties. + protected final PascalString queueName; + protected final PascalString resourceUri; + protected final PascalString authenticationProfileUri; + protected final BrokerTransportQualityOfService requestedDeliveryGuarantee; + protected final PascalString metaDataQueueName; + protected final double metaDataUpdateTime; + + public BrokerDataSetWriterTransportDataType( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee, + PascalString metaDataQueueName, + double metaDataUpdateTime) { + super(); + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + this.metaDataQueueName = metaDataQueueName; + this.metaDataUpdateTime = metaDataUpdateTime; + } + + public PascalString getQueueName() { + return queueName; + } + + public PascalString getResourceUri() { + return resourceUri; + } + + public PascalString getAuthenticationProfileUri() { + return authenticationProfileUri; + } + + public BrokerTransportQualityOfService getRequestedDeliveryGuarantee() { + return requestedDeliveryGuarantee; + } + + public PascalString getMetaDataQueueName() { + return metaDataQueueName; + } + + public double getMetaDataUpdateTime() { + return metaDataUpdateTime; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("BrokerDataSetWriterTransportDataType"); + + // Simple Field (queueName) + writeSimpleField("queueName", queueName, writeComplex(writeBuffer)); + + // Simple Field (resourceUri) + writeSimpleField("resourceUri", resourceUri, writeComplex(writeBuffer)); + + // Simple Field (authenticationProfileUri) + writeSimpleField( + "authenticationProfileUri", authenticationProfileUri, writeComplex(writeBuffer)); + + // Simple Field (requestedDeliveryGuarantee) + writeSimpleEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + requestedDeliveryGuarantee, + writeEnum( + BrokerTransportQualityOfService::getValue, + BrokerTransportQualityOfService::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (metaDataQueueName) + writeSimpleField("metaDataQueueName", metaDataQueueName, writeComplex(writeBuffer)); + + // Simple Field (metaDataUpdateTime) + writeSimpleField("metaDataUpdateTime", metaDataUpdateTime, writeDouble(writeBuffer, 64)); + + writeBuffer.popContext("BrokerDataSetWriterTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + BrokerDataSetWriterTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (queueName) + lengthInBits += queueName.getLengthInBits(); + + // Simple field (resourceUri) + lengthInBits += resourceUri.getLengthInBits(); + + // Simple field (authenticationProfileUri) + lengthInBits += authenticationProfileUri.getLengthInBits(); + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32; + + // Simple field (metaDataQueueName) + lengthInBits += metaDataQueueName.getLengthInBits(); + + // Simple field (metaDataUpdateTime) + lengthInBits += 64; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("BrokerDataSetWriterTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString queueName = + readSimpleField( + "queueName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString resourceUri = + readSimpleField( + "resourceUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString authenticationProfileUri = + readSimpleField( + "authenticationProfileUri", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + BrokerTransportQualityOfService requestedDeliveryGuarantee = + readEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + readEnum( + BrokerTransportQualityOfService::enumForValue, readUnsignedLong(readBuffer, 32))); + + PascalString metaDataQueueName = + readSimpleField( + "metaDataQueueName", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + double metaDataUpdateTime = readSimpleField("metaDataUpdateTime", readDouble(readBuffer, 64)); + + readBuffer.closeContext("BrokerDataSetWriterTransportDataType"); + // Create the instance + return new BrokerDataSetWriterTransportDataTypeBuilderImpl( + queueName, + resourceUri, + authenticationProfileUri, + requestedDeliveryGuarantee, + metaDataQueueName, + metaDataUpdateTime); + } + + public static class BrokerDataSetWriterTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString queueName; + private final PascalString resourceUri; + private final PascalString authenticationProfileUri; + private final BrokerTransportQualityOfService requestedDeliveryGuarantee; + private final PascalString metaDataQueueName; + private final double metaDataUpdateTime; + + public BrokerDataSetWriterTransportDataTypeBuilderImpl( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee, + PascalString metaDataQueueName, + double metaDataUpdateTime) { + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + this.metaDataQueueName = metaDataQueueName; + this.metaDataUpdateTime = metaDataUpdateTime; + } + + public BrokerDataSetWriterTransportDataType build() { + BrokerDataSetWriterTransportDataType brokerDataSetWriterTransportDataType = + new BrokerDataSetWriterTransportDataType( + queueName, + resourceUri, + authenticationProfileUri, + requestedDeliveryGuarantee, + metaDataQueueName, + metaDataUpdateTime); + return brokerDataSetWriterTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof BrokerDataSetWriterTransportDataType)) { + return false; + } + BrokerDataSetWriterTransportDataType that = (BrokerDataSetWriterTransportDataType) o; + return (getQueueName() == that.getQueueName()) + && (getResourceUri() == that.getResourceUri()) + && (getAuthenticationProfileUri() == that.getAuthenticationProfileUri()) + && (getRequestedDeliveryGuarantee() == that.getRequestedDeliveryGuarantee()) + && (getMetaDataQueueName() == that.getMetaDataQueueName()) + && (getMetaDataUpdateTime() == that.getMetaDataUpdateTime()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getQueueName(), + getResourceUri(), + getAuthenticationProfileUri(), + getRequestedDeliveryGuarantee(), + getMetaDataQueueName(), + getMetaDataUpdateTime()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerWriterGroupTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerWriterGroupTransportDataType.java new file mode 100644 index 00000000000..d24e622803d --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrokerWriterGroupTransportDataType.java @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class BrokerWriterGroupTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15669; + } + + // Properties. + protected final PascalString queueName; + protected final PascalString resourceUri; + protected final PascalString authenticationProfileUri; + protected final BrokerTransportQualityOfService requestedDeliveryGuarantee; + + public BrokerWriterGroupTransportDataType( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee) { + super(); + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + } + + public PascalString getQueueName() { + return queueName; + } + + public PascalString getResourceUri() { + return resourceUri; + } + + public PascalString getAuthenticationProfileUri() { + return authenticationProfileUri; + } + + public BrokerTransportQualityOfService getRequestedDeliveryGuarantee() { + return requestedDeliveryGuarantee; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("BrokerWriterGroupTransportDataType"); + + // Simple Field (queueName) + writeSimpleField("queueName", queueName, writeComplex(writeBuffer)); + + // Simple Field (resourceUri) + writeSimpleField("resourceUri", resourceUri, writeComplex(writeBuffer)); + + // Simple Field (authenticationProfileUri) + writeSimpleField( + "authenticationProfileUri", authenticationProfileUri, writeComplex(writeBuffer)); + + // Simple Field (requestedDeliveryGuarantee) + writeSimpleEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + requestedDeliveryGuarantee, + writeEnum( + BrokerTransportQualityOfService::getValue, + BrokerTransportQualityOfService::name, + writeUnsignedLong(writeBuffer, 32))); + + writeBuffer.popContext("BrokerWriterGroupTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + BrokerWriterGroupTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (queueName) + lengthInBits += queueName.getLengthInBits(); + + // Simple field (resourceUri) + lengthInBits += resourceUri.getLengthInBits(); + + // Simple field (authenticationProfileUri) + lengthInBits += authenticationProfileUri.getLengthInBits(); + + // Simple field (requestedDeliveryGuarantee) + lengthInBits += 32; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("BrokerWriterGroupTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString queueName = + readSimpleField( + "queueName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString resourceUri = + readSimpleField( + "resourceUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString authenticationProfileUri = + readSimpleField( + "authenticationProfileUri", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + BrokerTransportQualityOfService requestedDeliveryGuarantee = + readEnumField( + "requestedDeliveryGuarantee", + "BrokerTransportQualityOfService", + readEnum( + BrokerTransportQualityOfService::enumForValue, readUnsignedLong(readBuffer, 32))); + + readBuffer.closeContext("BrokerWriterGroupTransportDataType"); + // Create the instance + return new BrokerWriterGroupTransportDataTypeBuilderImpl( + queueName, resourceUri, authenticationProfileUri, requestedDeliveryGuarantee); + } + + public static class BrokerWriterGroupTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString queueName; + private final PascalString resourceUri; + private final PascalString authenticationProfileUri; + private final BrokerTransportQualityOfService requestedDeliveryGuarantee; + + public BrokerWriterGroupTransportDataTypeBuilderImpl( + PascalString queueName, + PascalString resourceUri, + PascalString authenticationProfileUri, + BrokerTransportQualityOfService requestedDeliveryGuarantee) { + this.queueName = queueName; + this.resourceUri = resourceUri; + this.authenticationProfileUri = authenticationProfileUri; + this.requestedDeliveryGuarantee = requestedDeliveryGuarantee; + } + + public BrokerWriterGroupTransportDataType build() { + BrokerWriterGroupTransportDataType brokerWriterGroupTransportDataType = + new BrokerWriterGroupTransportDataType( + queueName, resourceUri, authenticationProfileUri, requestedDeliveryGuarantee); + return brokerWriterGroupTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof BrokerWriterGroupTransportDataType)) { + return false; + } + BrokerWriterGroupTransportDataType that = (BrokerWriterGroupTransportDataType) o; + return (getQueueName() == that.getQueueName()) + && (getResourceUri() == that.getResourceUri()) + && (getAuthenticationProfileUri() == that.getAuthenticationProfileUri()) + && (getRequestedDeliveryGuarantee() == that.getRequestedDeliveryGuarantee()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getQueueName(), + getResourceUri(), + getAuthenticationProfileUri(), + getRequestedDeliveryGuarantee()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseDescription.java index a4042ebd126..5992c6c1314 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseDescription.java @@ -38,8 +38,8 @@ public class BrowseDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "516"; + public Integer getExtensionId() { + return (int) 516; } // Properties. @@ -162,7 +162,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextRequest.java index 0aaf1bf5e45..4da5bcd2b1d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextRequest.java @@ -38,29 +38,26 @@ public class BrowseNextRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "533"; + public Integer getExtensionId() { + return (int) 533; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final boolean releaseContinuationPoints; - protected final int noOfContinuationPoints; protected final List continuationPoints; public BrowseNextRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, boolean releaseContinuationPoints, - int noOfContinuationPoints, List continuationPoints) { super(); this.requestHeader = requestHeader; this.releaseContinuationPoints = releaseContinuationPoints; - this.noOfContinuationPoints = noOfContinuationPoints; this.continuationPoints = continuationPoints; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -68,10 +65,6 @@ public boolean getReleaseContinuationPoints() { return releaseContinuationPoints; } - public int getNoOfContinuationPoints() { - return noOfContinuationPoints; - } - public List getContinuationPoints() { return continuationPoints; } @@ -93,8 +86,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeSimpleField( "releaseContinuationPoints", releaseContinuationPoints, writeBoolean(writeBuffer)); - // Simple Field (noOfContinuationPoints) - writeSimpleField( + // Implicit Field (noOfContinuationPoints) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfContinuationPoints = + (int) ((((getContinuationPoints()) == (null)) ? -(1) : COUNT(getContinuationPoints()))); + writeImplicitField( "noOfContinuationPoints", noOfContinuationPoints, writeSignedInt(writeBuffer, 32)); // Array Field (continuationPoints) @@ -123,7 +119,7 @@ public int getLengthInBits() { // Simple field (releaseContinuationPoints) lengthInBits += 1; - // Simple field (noOfContinuationPoints) + // Implicit Field (noOfContinuationPoints) lengthInBits += 32; // Array field @@ -139,16 +135,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseNextRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); Byte reservedField0 = @@ -158,7 +155,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField("releaseContinuationPoints", readBoolean(readBuffer)); int noOfContinuationPoints = - readSimpleField("noOfContinuationPoints", readSignedInt(readBuffer, 32)); + readImplicitField("noOfContinuationPoints", readSignedInt(readBuffer, 32)); List continuationPoints = readCountArrayField( @@ -169,31 +166,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("BrowseNextRequest"); // Create the instance return new BrowseNextRequestBuilderImpl( - requestHeader, releaseContinuationPoints, noOfContinuationPoints, continuationPoints); + requestHeader, releaseContinuationPoints, continuationPoints); } public static class BrowseNextRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final boolean releaseContinuationPoints; - private final int noOfContinuationPoints; private final List continuationPoints; public BrowseNextRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, boolean releaseContinuationPoints, - int noOfContinuationPoints, List continuationPoints) { this.requestHeader = requestHeader; this.releaseContinuationPoints = releaseContinuationPoints; - this.noOfContinuationPoints = noOfContinuationPoints; this.continuationPoints = continuationPoints; } public BrowseNextRequest build() { BrowseNextRequest browseNextRequest = - new BrowseNextRequest( - requestHeader, releaseContinuationPoints, noOfContinuationPoints, continuationPoints); + new BrowseNextRequest(requestHeader, releaseContinuationPoints, continuationPoints); return browseNextRequest; } } @@ -209,7 +202,6 @@ public boolean equals(Object o) { BrowseNextRequest that = (BrowseNextRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getReleaseContinuationPoints() == that.getReleaseContinuationPoints()) - && (getNoOfContinuationPoints() == that.getNoOfContinuationPoints()) && (getContinuationPoints() == that.getContinuationPoints()) && super.equals(that) && true; @@ -221,7 +213,6 @@ public int hashCode() { super.hashCode(), getRequestHeader(), getReleaseContinuationPoints(), - getNoOfContinuationPoints(), getContinuationPoints()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextResponse.java index 8bafe3556cb..2ccd7b41e22 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseNextResponse.java @@ -38,47 +38,33 @@ public class BrowseNextResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "536"; + public Integer getExtensionId() { + return (int) 536; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public BrowseNextResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (BrowseResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,31 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseNextResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("524")), + () -> (BrowseResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (524)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +175,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("BrowseNextResponse"); // Create the instance - return new BrowseNextResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new BrowseNextResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class BrowseNextResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public BrowseNextResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public BrowseNextResponse build() { BrowseNextResponse browseNextResponse = - new BrowseNextResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new BrowseNextResponse(responseHeader, results, diagnosticInfos); return browseNextResponse; } } @@ -225,9 +210,7 @@ public boolean equals(Object o) { } BrowseNextResponse that = (BrowseNextResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +218,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePath.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePath.java index 5e6ccf8e162..2d3df74ea7a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePath.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePath.java @@ -38,15 +38,15 @@ public class BrowsePath extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "545"; + public Integer getExtensionId() { + return (int) 545; } // Properties. protected final NodeId startingNode; - protected final ExtensionObjectDefinition relativePath; + protected final RelativePath relativePath; - public BrowsePath(NodeId startingNode, ExtensionObjectDefinition relativePath) { + public BrowsePath(NodeId startingNode, RelativePath relativePath) { super(); this.startingNode = startingNode; this.relativePath = relativePath; @@ -56,7 +56,7 @@ public NodeId getStartingNode() { return startingNode; } - public ExtensionObjectDefinition getRelativePath() { + public RelativePath getRelativePath() { return relativePath; } @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowsePath"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -106,11 +106,11 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "startingNode", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); - ExtensionObjectDefinition relativePath = + RelativePath relativePath = readSimpleField( "relativePath", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("542")), + () -> (RelativePath) ExtensionObjectDefinition.staticParse(readBuffer, (int) (542)), readBuffer)); readBuffer.closeContext("BrowsePath"); @@ -121,9 +121,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class BrowsePathBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final NodeId startingNode; - private final ExtensionObjectDefinition relativePath; + private final RelativePath relativePath; - public BrowsePathBuilderImpl(NodeId startingNode, ExtensionObjectDefinition relativePath) { + public BrowsePathBuilderImpl(NodeId startingNode, RelativePath relativePath) { this.startingNode = startingNode; this.relativePath = relativePath; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathResult.java index 5c9e0eae0da..983a538d61d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathResult.java @@ -38,20 +38,17 @@ public class BrowsePathResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "551"; + public Integer getExtensionId() { + return (int) 551; } // Properties. protected final StatusCode statusCode; - protected final int noOfTargets; - protected final List targets; + protected final List targets; - public BrowsePathResult( - StatusCode statusCode, int noOfTargets, List targets) { + public BrowsePathResult(StatusCode statusCode, List targets) { super(); this.statusCode = statusCode; - this.noOfTargets = noOfTargets; this.targets = targets; } @@ -59,11 +56,7 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfTargets() { - return noOfTargets; - } - - public List getTargets() { + public List getTargets() { return targets; } @@ -77,8 +70,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfTargets) - writeSimpleField("noOfTargets", noOfTargets, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfTargets) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfTargets = (int) ((((getTargets()) == (null)) ? -(1) : COUNT(getTargets()))); + writeImplicitField("noOfTargets", noOfTargets, writeSignedInt(writeBuffer, 32)); // Array Field (targets) writeComplexTypeArrayField("targets", targets, writeBuffer); @@ -100,13 +95,13 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfTargets) + // Implicit Field (noOfTargets) lengthInBits += 32; // Array field if (targets != null) { int i = 0; - for (ExtensionObjectDefinition element : targets) { + for (BrowsePathTarget element : targets) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= targets.size()); lengthInBits += element.getLengthInBits(); } @@ -116,7 +111,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowsePathResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -125,36 +120,35 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); - int noOfTargets = readSimpleField("noOfTargets", readSignedInt(readBuffer, 32)); + int noOfTargets = readImplicitField("noOfTargets", readSignedInt(readBuffer, 32)); - List targets = + List targets = readCountArrayField( "targets", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("548")), + () -> + (BrowsePathTarget) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (548)), readBuffer), noOfTargets); readBuffer.closeContext("BrowsePathResult"); // Create the instance - return new BrowsePathResultBuilderImpl(statusCode, noOfTargets, targets); + return new BrowsePathResultBuilderImpl(statusCode, targets); } public static class BrowsePathResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfTargets; - private final List targets; + private final List targets; - public BrowsePathResultBuilderImpl( - StatusCode statusCode, int noOfTargets, List targets) { + public BrowsePathResultBuilderImpl(StatusCode statusCode, List targets) { this.statusCode = statusCode; - this.noOfTargets = noOfTargets; this.targets = targets; } public BrowsePathResult build() { - BrowsePathResult browsePathResult = new BrowsePathResult(statusCode, noOfTargets, targets); + BrowsePathResult browsePathResult = new BrowsePathResult(statusCode, targets); return browsePathResult; } } @@ -169,7 +163,6 @@ public boolean equals(Object o) { } BrowsePathResult that = (BrowsePathResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfTargets() == that.getNoOfTargets()) && (getTargets() == that.getTargets()) && super.equals(that) && true; @@ -177,7 +170,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getStatusCode(), getNoOfTargets(), getTargets()); + return Objects.hash(super.hashCode(), getStatusCode(), getTargets()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathTarget.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathTarget.java index ef040cc2e11..2fba29bc9b6 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathTarget.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowsePathTarget.java @@ -38,8 +38,8 @@ public class BrowsePathTarget extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "548"; + public Integer getExtensionId() { + return (int) 548; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowsePathTarget"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseRequest.java index d5ca73bc660..cc3adfe2901 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseRequest.java @@ -38,36 +38,33 @@ public class BrowseRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "527"; + public Integer getExtensionId() { + return (int) 527; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition view; + protected final RequestHeader requestHeader; + protected final ViewDescription view; protected final long requestedMaxReferencesPerNode; - protected final int noOfNodesToBrowse; - protected final List nodesToBrowse; + protected final List nodesToBrowse; public BrowseRequest( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition view, + RequestHeader requestHeader, + ViewDescription view, long requestedMaxReferencesPerNode, - int noOfNodesToBrowse, - List nodesToBrowse) { + List nodesToBrowse) { super(); this.requestHeader = requestHeader; this.view = view; this.requestedMaxReferencesPerNode = requestedMaxReferencesPerNode; - this.noOfNodesToBrowse = noOfNodesToBrowse; this.nodesToBrowse = nodesToBrowse; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getView() { + public ViewDescription getView() { return view; } @@ -75,11 +72,7 @@ public long getRequestedMaxReferencesPerNode() { return requestedMaxReferencesPerNode; } - public int getNoOfNodesToBrowse() { - return noOfNodesToBrowse; - } - - public List getNodesToBrowse() { + public List getNodesToBrowse() { return nodesToBrowse; } @@ -102,8 +95,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) requestedMaxReferencesPerNode, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfNodesToBrowse) - writeSimpleField("noOfNodesToBrowse", noOfNodesToBrowse, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToBrowse) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToBrowse = + (int) ((((getNodesToBrowse()) == (null)) ? -(1) : COUNT(getNodesToBrowse()))); + writeImplicitField("noOfNodesToBrowse", noOfNodesToBrowse, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToBrowse) writeComplexTypeArrayField("nodesToBrowse", nodesToBrowse, writeBuffer); @@ -131,13 +127,13 @@ public int getLengthInBits() { // Simple field (requestedMaxReferencesPerNode) lengthInBits += 32; - // Simple field (noOfNodesToBrowse) + // Implicit Field (noOfNodesToBrowse) lengthInBits += 32; // Array field if (nodesToBrowse != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToBrowse) { + for (BrowseDescription element : nodesToBrowse) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToBrowse.size()); lengthInBits += element.getLengthInBits(); } @@ -147,69 +143,70 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition view = + ViewDescription view = readSimpleField( "view", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("513")), + () -> + (ViewDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (513)), readBuffer)); long requestedMaxReferencesPerNode = readSimpleField("requestedMaxReferencesPerNode", readUnsignedLong(readBuffer, 32)); - int noOfNodesToBrowse = readSimpleField("noOfNodesToBrowse", readSignedInt(readBuffer, 32)); + int noOfNodesToBrowse = readImplicitField("noOfNodesToBrowse", readSignedInt(readBuffer, 32)); - List nodesToBrowse = + List nodesToBrowse = readCountArrayField( "nodesToBrowse", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("516")), + () -> + (BrowseDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (516)), readBuffer), noOfNodesToBrowse); readBuffer.closeContext("BrowseRequest"); // Create the instance return new BrowseRequestBuilderImpl( - requestHeader, view, requestedMaxReferencesPerNode, noOfNodesToBrowse, nodesToBrowse); + requestHeader, view, requestedMaxReferencesPerNode, nodesToBrowse); } public static class BrowseRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition view; + private final RequestHeader requestHeader; + private final ViewDescription view; private final long requestedMaxReferencesPerNode; - private final int noOfNodesToBrowse; - private final List nodesToBrowse; + private final List nodesToBrowse; public BrowseRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition view, + RequestHeader requestHeader, + ViewDescription view, long requestedMaxReferencesPerNode, - int noOfNodesToBrowse, - List nodesToBrowse) { + List nodesToBrowse) { this.requestHeader = requestHeader; this.view = view; this.requestedMaxReferencesPerNode = requestedMaxReferencesPerNode; - this.noOfNodesToBrowse = noOfNodesToBrowse; this.nodesToBrowse = nodesToBrowse; } public BrowseRequest build() { BrowseRequest browseRequest = - new BrowseRequest( - requestHeader, view, requestedMaxReferencesPerNode, noOfNodesToBrowse, nodesToBrowse); + new BrowseRequest(requestHeader, view, requestedMaxReferencesPerNode, nodesToBrowse); return browseRequest; } } @@ -226,7 +223,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getView() == that.getView()) && (getRequestedMaxReferencesPerNode() == that.getRequestedMaxReferencesPerNode()) - && (getNoOfNodesToBrowse() == that.getNoOfNodesToBrowse()) && (getNodesToBrowse() == that.getNodesToBrowse()) && super.equals(that) && true; @@ -239,7 +235,6 @@ public int hashCode() { getRequestHeader(), getView(), getRequestedMaxReferencesPerNode(), - getNoOfNodesToBrowse(), getNodesToBrowse()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResponse.java index 41446d0960b..a1f346bd259 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResponse.java @@ -38,47 +38,33 @@ public class BrowseResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "530"; + public Integer getExtensionId() { + return (int) 530; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public BrowseResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (BrowseResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,31 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("524")), + () -> (BrowseResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (524)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +175,26 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("BrowseResponse"); // Create the instance - return new BrowseResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new BrowseResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class BrowseResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public BrowseResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public BrowseResponse build() { - BrowseResponse browseResponse = - new BrowseResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + BrowseResponse browseResponse = new BrowseResponse(responseHeader, results, diagnosticInfos); return browseResponse; } } @@ -225,9 +209,7 @@ public boolean equals(Object o) { } BrowseResponse that = (BrowseResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +217,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResult.java index ce2153b706e..87883a92206 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BrowseResult.java @@ -38,25 +38,22 @@ public class BrowseResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "524"; + public Integer getExtensionId() { + return (int) 524; } // Properties. protected final StatusCode statusCode; protected final PascalByteString continuationPoint; - protected final int noOfReferences; - protected final List references; + protected final List references; public BrowseResult( StatusCode statusCode, PascalByteString continuationPoint, - int noOfReferences, - List references) { + List references) { super(); this.statusCode = statusCode; this.continuationPoint = continuationPoint; - this.noOfReferences = noOfReferences; this.references = references; } @@ -68,11 +65,7 @@ public PascalByteString getContinuationPoint() { return continuationPoint; } - public int getNoOfReferences() { - return noOfReferences; - } - - public List getReferences() { + public List getReferences() { return references; } @@ -89,8 +82,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (continuationPoint) writeSimpleField("continuationPoint", continuationPoint, writeComplex(writeBuffer)); - // Simple Field (noOfReferences) - writeSimpleField("noOfReferences", noOfReferences, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfReferences) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReferences = (int) ((((getReferences()) == (null)) ? -(1) : COUNT(getReferences()))); + writeImplicitField("noOfReferences", noOfReferences, writeSignedInt(writeBuffer, 32)); // Array Field (references) writeComplexTypeArrayField("references", references, writeBuffer); @@ -115,13 +110,13 @@ public int getLengthInBits() { // Simple field (continuationPoint) lengthInBits += continuationPoint.getLengthInBits(); - // Simple field (noOfReferences) + // Implicit Field (noOfReferences) lengthInBits += 32; // Array field if (references != null) { int i = 0; - for (ExtensionObjectDefinition element : references) { + for (ReferenceDescription element : references) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= references.size()); lengthInBits += element.getLengthInBits(); } @@ -131,7 +126,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BrowseResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -145,42 +140,40 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "continuationPoint", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); - int noOfReferences = readSimpleField("noOfReferences", readSignedInt(readBuffer, 32)); + int noOfReferences = readImplicitField("noOfReferences", readSignedInt(readBuffer, 32)); - List references = + List references = readCountArrayField( "references", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("520")), + () -> + (ReferenceDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (520)), readBuffer), noOfReferences); readBuffer.closeContext("BrowseResult"); // Create the instance - return new BrowseResultBuilderImpl(statusCode, continuationPoint, noOfReferences, references); + return new BrowseResultBuilderImpl(statusCode, continuationPoint, references); } public static class BrowseResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; private final PascalByteString continuationPoint; - private final int noOfReferences; - private final List references; + private final List references; public BrowseResultBuilderImpl( StatusCode statusCode, PascalByteString continuationPoint, - int noOfReferences, - List references) { + List references) { this.statusCode = statusCode; this.continuationPoint = continuationPoint; - this.noOfReferences = noOfReferences; this.references = references; } public BrowseResult build() { - BrowseResult browseResult = - new BrowseResult(statusCode, continuationPoint, noOfReferences, references); + BrowseResult browseResult = new BrowseResult(statusCode, continuationPoint, references); return browseResult; } } @@ -196,7 +189,6 @@ public boolean equals(Object o) { BrowseResult that = (BrowseResult) o; return (getStatusCode() == that.getStatusCode()) && (getContinuationPoint() == that.getContinuationPoint()) - && (getNoOfReferences() == that.getNoOfReferences()) && (getReferences() == that.getReferences()) && super.equals(that) && true; @@ -204,12 +196,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getStatusCode(), - getContinuationPoint(), - getNoOfReferences(), - getReferences()); + return Objects.hash(super.hashCode(), getStatusCode(), getContinuationPoint(), getReferences()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BuildInfo.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BuildInfo.java index 090b9097b58..6924995862b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BuildInfo.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/BuildInfo.java @@ -38,8 +38,8 @@ public class BuildInfo extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "340"; + public Integer getExtensionId() { + return (int) 340; } // Properties. @@ -151,7 +151,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("BuildInfo"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodRequest.java index e184122dbe2..ad7164f65d1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodRequest.java @@ -38,22 +38,19 @@ public class CallMethodRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "706"; + public Integer getExtensionId() { + return (int) 706; } // Properties. protected final NodeId objectId; protected final NodeId methodId; - protected final int noOfInputArguments; protected final List inputArguments; - public CallMethodRequest( - NodeId objectId, NodeId methodId, int noOfInputArguments, List inputArguments) { + public CallMethodRequest(NodeId objectId, NodeId methodId, List inputArguments) { super(); this.objectId = objectId; this.methodId = methodId; - this.noOfInputArguments = noOfInputArguments; this.inputArguments = inputArguments; } @@ -65,10 +62,6 @@ public NodeId getMethodId() { return methodId; } - public int getNoOfInputArguments() { - return noOfInputArguments; - } - public List getInputArguments() { return inputArguments; } @@ -86,8 +79,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (methodId) writeSimpleField("methodId", methodId, writeComplex(writeBuffer)); - // Simple Field (noOfInputArguments) - writeSimpleField("noOfInputArguments", noOfInputArguments, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfInputArguments) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfInputArguments = + (int) ((((getInputArguments()) == (null)) ? -(1) : COUNT(getInputArguments()))); + writeImplicitField("noOfInputArguments", noOfInputArguments, writeSignedInt(writeBuffer, 32)); // Array Field (inputArguments) writeComplexTypeArrayField("inputArguments", inputArguments, writeBuffer); @@ -112,7 +108,7 @@ public int getLengthInBits() { // Simple field (methodId) lengthInBits += methodId.getLengthInBits(); - // Simple field (noOfInputArguments) + // Implicit Field (noOfInputArguments) lengthInBits += 32; // Array field @@ -128,7 +124,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CallMethodRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -139,7 +135,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit NodeId methodId = readSimpleField("methodId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); - int noOfInputArguments = readSimpleField("noOfInputArguments", readSignedInt(readBuffer, 32)); + int noOfInputArguments = readImplicitField("noOfInputArguments", readSignedInt(readBuffer, 32)); List inputArguments = readCountArrayField( @@ -149,27 +145,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("CallMethodRequest"); // Create the instance - return new CallMethodRequestBuilderImpl(objectId, methodId, noOfInputArguments, inputArguments); + return new CallMethodRequestBuilderImpl(objectId, methodId, inputArguments); } public static class CallMethodRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final NodeId objectId; private final NodeId methodId; - private final int noOfInputArguments; private final List inputArguments; public CallMethodRequestBuilderImpl( - NodeId objectId, NodeId methodId, int noOfInputArguments, List inputArguments) { + NodeId objectId, NodeId methodId, List inputArguments) { this.objectId = objectId; this.methodId = methodId; - this.noOfInputArguments = noOfInputArguments; this.inputArguments = inputArguments; } public CallMethodRequest build() { CallMethodRequest callMethodRequest = - new CallMethodRequest(objectId, methodId, noOfInputArguments, inputArguments); + new CallMethodRequest(objectId, methodId, inputArguments); return callMethodRequest; } } @@ -185,7 +179,6 @@ public boolean equals(Object o) { CallMethodRequest that = (CallMethodRequest) o; return (getObjectId() == that.getObjectId()) && (getMethodId() == that.getMethodId()) - && (getNoOfInputArguments() == that.getNoOfInputArguments()) && (getInputArguments() == that.getInputArguments()) && super.equals(that) && true; @@ -193,12 +186,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getObjectId(), - getMethodId(), - getNoOfInputArguments(), - getInputArguments()); + return Objects.hash(super.hashCode(), getObjectId(), getMethodId(), getInputArguments()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodResult.java index 7fec8b08015..d37c8d081cf 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallMethodResult.java @@ -38,34 +38,25 @@ public class CallMethodResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "709"; + public Integer getExtensionId() { + return (int) 709; } // Properties. protected final StatusCode statusCode; - protected final int noOfInputArgumentResults; protected final List inputArgumentResults; - protected final int noOfInputArgumentDiagnosticInfos; protected final List inputArgumentDiagnosticInfos; - protected final int noOfOutputArguments; protected final List outputArguments; public CallMethodResult( StatusCode statusCode, - int noOfInputArgumentResults, List inputArgumentResults, - int noOfInputArgumentDiagnosticInfos, List inputArgumentDiagnosticInfos, - int noOfOutputArguments, List outputArguments) { super(); this.statusCode = statusCode; - this.noOfInputArgumentResults = noOfInputArgumentResults; this.inputArgumentResults = inputArgumentResults; - this.noOfInputArgumentDiagnosticInfos = noOfInputArgumentDiagnosticInfos; this.inputArgumentDiagnosticInfos = inputArgumentDiagnosticInfos; - this.noOfOutputArguments = noOfOutputArguments; this.outputArguments = outputArguments; } @@ -73,26 +64,14 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfInputArgumentResults() { - return noOfInputArgumentResults; - } - public List getInputArgumentResults() { return inputArgumentResults; } - public int getNoOfInputArgumentDiagnosticInfos() { - return noOfInputArgumentDiagnosticInfos; - } - public List getInputArgumentDiagnosticInfos() { return inputArgumentDiagnosticInfos; } - public int getNoOfOutputArguments() { - return noOfOutputArguments; - } - public List getOutputArguments() { return outputArguments; } @@ -107,15 +86,24 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfInputArgumentResults) - writeSimpleField( + // Implicit Field (noOfInputArgumentResults) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfInputArgumentResults = + (int) ((((getInputArgumentResults()) == (null)) ? -(1) : COUNT(getInputArgumentResults()))); + writeImplicitField( "noOfInputArgumentResults", noOfInputArgumentResults, writeSignedInt(writeBuffer, 32)); // Array Field (inputArgumentResults) writeComplexTypeArrayField("inputArgumentResults", inputArgumentResults, writeBuffer); - // Simple Field (noOfInputArgumentDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfInputArgumentDiagnosticInfos) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfInputArgumentDiagnosticInfos = + (int) + ((((getInputArgumentDiagnosticInfos()) == (null)) + ? -(1) + : COUNT(getInputArgumentDiagnosticInfos()))); + writeImplicitField( "noOfInputArgumentDiagnosticInfos", noOfInputArgumentDiagnosticInfos, writeSignedInt(writeBuffer, 32)); @@ -124,8 +112,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeComplexTypeArrayField( "inputArgumentDiagnosticInfos", inputArgumentDiagnosticInfos, writeBuffer); - // Simple Field (noOfOutputArguments) - writeSimpleField("noOfOutputArguments", noOfOutputArguments, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfOutputArguments) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfOutputArguments = + (int) ((((getOutputArguments()) == (null)) ? -(1) : COUNT(getOutputArguments()))); + writeImplicitField("noOfOutputArguments", noOfOutputArguments, writeSignedInt(writeBuffer, 32)); // Array Field (outputArguments) writeComplexTypeArrayField("outputArguments", outputArguments, writeBuffer); @@ -147,7 +138,7 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfInputArgumentResults) + // Implicit Field (noOfInputArgumentResults) lengthInBits += 32; // Array field @@ -159,7 +150,7 @@ public int getLengthInBits() { } } - // Simple field (noOfInputArgumentDiagnosticInfos) + // Implicit Field (noOfInputArgumentDiagnosticInfos) lengthInBits += 32; // Array field @@ -171,7 +162,7 @@ public int getLengthInBits() { } } - // Simple field (noOfOutputArguments) + // Implicit Field (noOfOutputArguments) lengthInBits += 32; // Array field @@ -187,7 +178,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CallMethodResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -197,7 +188,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); int noOfInputArgumentResults = - readSimpleField("noOfInputArgumentResults", readSignedInt(readBuffer, 32)); + readImplicitField("noOfInputArgumentResults", readSignedInt(readBuffer, 32)); List inputArgumentResults = readCountArrayField( @@ -206,7 +197,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfInputArgumentResults); int noOfInputArgumentDiagnosticInfos = - readSimpleField("noOfInputArgumentDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfInputArgumentDiagnosticInfos", readSignedInt(readBuffer, 32)); List inputArgumentDiagnosticInfos = readCountArrayField( @@ -214,7 +205,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> DiagnosticInfo.staticParse(readBuffer), readBuffer), noOfInputArgumentDiagnosticInfos); - int noOfOutputArguments = readSimpleField("noOfOutputArguments", readSignedInt(readBuffer, 32)); + int noOfOutputArguments = + readImplicitField("noOfOutputArguments", readSignedInt(readBuffer, 32)); List outputArguments = readCountArrayField( @@ -225,52 +217,31 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("CallMethodResult"); // Create the instance return new CallMethodResultBuilderImpl( - statusCode, - noOfInputArgumentResults, - inputArgumentResults, - noOfInputArgumentDiagnosticInfos, - inputArgumentDiagnosticInfos, - noOfOutputArguments, - outputArguments); + statusCode, inputArgumentResults, inputArgumentDiagnosticInfos, outputArguments); } public static class CallMethodResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfInputArgumentResults; private final List inputArgumentResults; - private final int noOfInputArgumentDiagnosticInfos; private final List inputArgumentDiagnosticInfos; - private final int noOfOutputArguments; private final List outputArguments; public CallMethodResultBuilderImpl( StatusCode statusCode, - int noOfInputArgumentResults, List inputArgumentResults, - int noOfInputArgumentDiagnosticInfos, List inputArgumentDiagnosticInfos, - int noOfOutputArguments, List outputArguments) { this.statusCode = statusCode; - this.noOfInputArgumentResults = noOfInputArgumentResults; this.inputArgumentResults = inputArgumentResults; - this.noOfInputArgumentDiagnosticInfos = noOfInputArgumentDiagnosticInfos; this.inputArgumentDiagnosticInfos = inputArgumentDiagnosticInfos; - this.noOfOutputArguments = noOfOutputArguments; this.outputArguments = outputArguments; } public CallMethodResult build() { CallMethodResult callMethodResult = new CallMethodResult( - statusCode, - noOfInputArgumentResults, - inputArgumentResults, - noOfInputArgumentDiagnosticInfos, - inputArgumentDiagnosticInfos, - noOfOutputArguments, - outputArguments); + statusCode, inputArgumentResults, inputArgumentDiagnosticInfos, outputArguments); return callMethodResult; } } @@ -285,11 +256,8 @@ public boolean equals(Object o) { } CallMethodResult that = (CallMethodResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfInputArgumentResults() == that.getNoOfInputArgumentResults()) && (getInputArgumentResults() == that.getInputArgumentResults()) - && (getNoOfInputArgumentDiagnosticInfos() == that.getNoOfInputArgumentDiagnosticInfos()) && (getInputArgumentDiagnosticInfos() == that.getInputArgumentDiagnosticInfos()) - && (getNoOfOutputArguments() == that.getNoOfOutputArguments()) && (getOutputArguments() == that.getOutputArguments()) && super.equals(that) && true; @@ -300,11 +268,8 @@ public int hashCode() { return Objects.hash( super.hashCode(), getStatusCode(), - getNoOfInputArgumentResults(), getInputArgumentResults(), - getNoOfInputArgumentDiagnosticInfos(), getInputArgumentDiagnosticInfos(), - getNoOfOutputArguments(), getOutputArguments()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallRequest.java index 30b5f975df4..591029b9024 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallRequest.java @@ -38,34 +38,25 @@ public class CallRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "712"; + public Integer getExtensionId() { + return (int) 712; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfMethodsToCall; - protected final List methodsToCall; - - public CallRequest( - ExtensionObjectDefinition requestHeader, - int noOfMethodsToCall, - List methodsToCall) { + protected final RequestHeader requestHeader; + protected final List methodsToCall; + + public CallRequest(RequestHeader requestHeader, List methodsToCall) { super(); this.requestHeader = requestHeader; - this.noOfMethodsToCall = noOfMethodsToCall; this.methodsToCall = methodsToCall; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfMethodsToCall() { - return noOfMethodsToCall; - } - - public List getMethodsToCall() { + public List getMethodsToCall() { return methodsToCall; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfMethodsToCall) - writeSimpleField("noOfMethodsToCall", noOfMethodsToCall, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfMethodsToCall) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfMethodsToCall = + (int) ((((getMethodsToCall()) == (null)) ? -(1) : COUNT(getMethodsToCall()))); + writeImplicitField("noOfMethodsToCall", noOfMethodsToCall, writeSignedInt(writeBuffer, 32)); // Array Field (methodsToCall) writeComplexTypeArrayField("methodsToCall", methodsToCall, writeBuffer); @@ -102,13 +96,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfMethodsToCall) + // Implicit Field (noOfMethodsToCall) lengthInBits += 32; // Array field if (methodsToCall != null) { int i = 0; - for (ExtensionObjectDefinition element : methodsToCall) { + for (CallMethodRequest element : methodsToCall) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= methodsToCall.size()); lengthInBits += element.getLengthInBits(); } @@ -118,50 +112,49 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CallRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfMethodsToCall = readSimpleField("noOfMethodsToCall", readSignedInt(readBuffer, 32)); + int noOfMethodsToCall = readImplicitField("noOfMethodsToCall", readSignedInt(readBuffer, 32)); - List methodsToCall = + List methodsToCall = readCountArrayField( "methodsToCall", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("706")), + () -> + (CallMethodRequest) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (706)), readBuffer), noOfMethodsToCall); readBuffer.closeContext("CallRequest"); // Create the instance - return new CallRequestBuilderImpl(requestHeader, noOfMethodsToCall, methodsToCall); + return new CallRequestBuilderImpl(requestHeader, methodsToCall); } public static class CallRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfMethodsToCall; - private final List methodsToCall; + private final RequestHeader requestHeader; + private final List methodsToCall; public CallRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfMethodsToCall, - List methodsToCall) { + RequestHeader requestHeader, List methodsToCall) { this.requestHeader = requestHeader; - this.noOfMethodsToCall = noOfMethodsToCall; this.methodsToCall = methodsToCall; } public CallRequest build() { - CallRequest callRequest = new CallRequest(requestHeader, noOfMethodsToCall, methodsToCall); + CallRequest callRequest = new CallRequest(requestHeader, methodsToCall); return callRequest; } } @@ -176,7 +169,6 @@ public boolean equals(Object o) { } CallRequest that = (CallRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfMethodsToCall() == that.getNoOfMethodsToCall()) && (getMethodsToCall() == that.getMethodsToCall()) && super.equals(that) && true; @@ -184,8 +176,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfMethodsToCall(), getMethodsToCall()); + return Objects.hash(super.hashCode(), getRequestHeader(), getMethodsToCall()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallResponse.java index 5ceb04ac06a..895b6050a3b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CallResponse.java @@ -38,47 +38,33 @@ public class CallResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "715"; + public Integer getExtensionId() { + return (int) 715; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public CallResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (CallMethodResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CallResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("709")), + () -> + (CallMethodResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (709)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +177,26 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("CallResponse"); // Create the instance - return new CallResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new CallResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class CallResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public CallResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public CallResponse build() { - CallResponse callResponse = - new CallResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + CallResponse callResponse = new CallResponse(responseHeader, results, diagnosticInfos); return callResponse; } } @@ -225,9 +211,7 @@ public boolean equals(Object o) { } CallResponse that = (CallResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +219,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelRequest.java index 8ac2d4365f2..55822642a04 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelRequest.java @@ -38,21 +38,21 @@ public class CancelRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "479"; + public Integer getExtensionId() { + return (int) 479; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long requestHandle; - public CancelRequest(ExtensionObjectDefinition requestHeader, long requestHandle) { + public CancelRequest(RequestHeader requestHeader, long requestHandle) { super(); this.requestHeader = requestHeader; this.requestHandle = requestHandle; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -97,16 +97,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CancelRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long requestHandle = readSimpleField("requestHandle", readUnsignedLong(readBuffer, 32)); @@ -118,10 +119,10 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CancelRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long requestHandle; - public CancelRequestBuilderImpl(ExtensionObjectDefinition requestHeader, long requestHandle) { + public CancelRequestBuilderImpl(RequestHeader requestHeader, long requestHandle) { this.requestHeader = requestHeader; this.requestHandle = requestHandle; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelResponse.java index 5a3e26e2812..14454db4f09 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CancelResponse.java @@ -38,21 +38,21 @@ public class CancelResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "482"; + public Integer getExtensionId() { + return (int) 482; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final long cancelCount; - public CancelResponse(ExtensionObjectDefinition responseHeader, long cancelCount) { + public CancelResponse(ResponseHeader responseHeader, long cancelCount) { super(); this.responseHeader = responseHeader; this.cancelCount = cancelCount; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -97,16 +97,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CancelResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); long cancelCount = readSimpleField("cancelCount", readUnsignedLong(readBuffer, 32)); @@ -118,10 +119,10 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CancelResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final long cancelCount; - public CancelResponseBuilderImpl(ExtensionObjectDefinition responseHeader, long cancelCount) { + public CancelResponseBuilderImpl(ResponseHeader responseHeader, long cancelCount) { this.responseHeader = responseHeader; this.cancelCount = cancelCount; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CartesianCoordinates.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CartesianCoordinates.java index a3891321ef0..cdce08b1323 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CartesianCoordinates.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CartesianCoordinates.java @@ -38,8 +38,8 @@ public class CartesianCoordinates extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "18811"; + public Integer getExtensionId() { + return (int) 18811; } public CartesianCoordinates() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CartesianCoordinates"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ChannelSecurityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ChannelSecurityToken.java index d7b09b297ed..aa84f8d64e7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ChannelSecurityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ChannelSecurityToken.java @@ -38,8 +38,8 @@ public class ChannelSecurityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "443"; + public Integer getExtensionId() { + return (int) 443; } // Properties. @@ -121,7 +121,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ChannelSecurityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelRequest.java index 06f8ecb0b72..e58d37f29bf 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelRequest.java @@ -38,19 +38,19 @@ public class CloseSecureChannelRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "452"; + public Integer getExtensionId() { + return (int) 452; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; - public CloseSecureChannelRequest(ExtensionObjectDefinition requestHeader) { + public CloseSecureChannelRequest(RequestHeader requestHeader) { super(); this.requestHeader = requestHeader; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CloseSecureChannelRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); readBuffer.closeContext("CloseSecureChannelRequest"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CloseSecureChannelRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; - public CloseSecureChannelRequestBuilderImpl(ExtensionObjectDefinition requestHeader) { + public CloseSecureChannelRequestBuilderImpl(RequestHeader requestHeader) { this.requestHeader = requestHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelResponse.java index 655be1a4343..9de37d2bf66 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSecureChannelResponse.java @@ -38,19 +38,19 @@ public class CloseSecureChannelResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "455"; + public Integer getExtensionId() { + return (int) 455; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; - public CloseSecureChannelResponse(ExtensionObjectDefinition responseHeader) { + public CloseSecureChannelResponse(ResponseHeader responseHeader) { super(); this.responseHeader = responseHeader; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CloseSecureChannelResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); readBuffer.closeContext("CloseSecureChannelResponse"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CloseSecureChannelResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; - public CloseSecureChannelResponseBuilderImpl(ExtensionObjectDefinition responseHeader) { + public CloseSecureChannelResponseBuilderImpl(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionRequest.java index 60f5184e5d4..f226690d5e3 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionRequest.java @@ -38,21 +38,21 @@ public class CloseSessionRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "473"; + public Integer getExtensionId() { + return (int) 473; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final boolean deleteSubscriptions; - public CloseSessionRequest(ExtensionObjectDefinition requestHeader, boolean deleteSubscriptions) { + public CloseSessionRequest(RequestHeader requestHeader, boolean deleteSubscriptions) { super(); this.requestHeader = requestHeader; this.deleteSubscriptions = deleteSubscriptions; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -103,16 +103,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CloseSessionRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); Byte reservedField0 = @@ -127,11 +128,11 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CloseSessionRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final boolean deleteSubscriptions; public CloseSessionRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, boolean deleteSubscriptions) { + RequestHeader requestHeader, boolean deleteSubscriptions) { this.requestHeader = requestHeader; this.deleteSubscriptions = deleteSubscriptions; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionResponse.java index af8774b51d2..99d52c55723 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CloseSessionResponse.java @@ -38,19 +38,19 @@ public class CloseSessionResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "476"; + public Integer getExtensionId() { + return (int) 476; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; - public CloseSessionResponse(ExtensionObjectDefinition responseHeader) { + public CloseSessionResponse(ResponseHeader responseHeader) { super(); this.responseHeader = responseHeader; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CloseSessionResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); readBuffer.closeContext("CloseSessionResponse"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CloseSessionResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; - public CloseSessionResponseBuilderImpl(ExtensionObjectDefinition responseHeader) { + public CloseSessionResponseBuilderImpl(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ComplexNumberType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ComplexNumberType.java index efa50557142..2d97a7b824c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ComplexNumberType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ComplexNumberType.java @@ -38,8 +38,8 @@ public class ComplexNumberType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12173"; + public Integer getExtensionId() { + return (int) 12173; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ComplexNumberType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConfigurationVersionDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConfigurationVersionDataType.java index f4421b28bec..e545d4f93fe 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConfigurationVersionDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConfigurationVersionDataType.java @@ -38,8 +38,8 @@ public class ConfigurationVersionDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14595"; + public Integer getExtensionId() { + return (int) 14595; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ConfigurationVersionDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConnectionTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConnectionTransportDataType.java index 772e866833e..717ca23971f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConnectionTransportDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ConnectionTransportDataType.java @@ -38,8 +38,8 @@ public class ConnectionTransportDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15620"; + public Integer getExtensionId() { + return (int) 15620; } public ConnectionTransportDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ConnectionTransportDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilter.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilter.java index 0d737481b07..89ef5f78be4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilter.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilter.java @@ -38,25 +38,19 @@ public class ContentFilter extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "588"; + public Integer getExtensionId() { + return (int) 588; } // Properties. - protected final int noOfElements; - protected final List elements; + protected final List elements; - public ContentFilter(int noOfElements, List elements) { + public ContentFilter(List elements) { super(); - this.noOfElements = noOfElements; this.elements = elements; } - public int getNoOfElements() { - return noOfElements; - } - - public List getElements() { + public List getElements() { return elements; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("ContentFilter"); - // Simple Field (noOfElements) - writeSimpleField("noOfElements", noOfElements, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfElements) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfElements = (int) ((((getElements()) == (null)) ? -(1) : COUNT(getElements()))); + writeImplicitField("noOfElements", noOfElements, writeSignedInt(writeBuffer, 32)); // Array Field (elements) writeComplexTypeArrayField("elements", elements, writeBuffer); @@ -87,13 +83,13 @@ public int getLengthInBits() { ContentFilter _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfElements) + // Implicit Field (noOfElements) lengthInBits += 32; // Array field if (elements != null) { int i = 0; - for (ExtensionObjectDefinition element : elements) { + for (ContentFilterElement element : elements) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= elements.size()); lengthInBits += element.getLengthInBits(); } @@ -103,38 +99,38 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ContentFilter"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfElements = readSimpleField("noOfElements", readSignedInt(readBuffer, 32)); + int noOfElements = readImplicitField("noOfElements", readSignedInt(readBuffer, 32)); - List elements = + List elements = readCountArrayField( "elements", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("585")), + () -> + (ContentFilterElement) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (585)), readBuffer), noOfElements); readBuffer.closeContext("ContentFilter"); // Create the instance - return new ContentFilterBuilderImpl(noOfElements, elements); + return new ContentFilterBuilderImpl(elements); } public static class ContentFilterBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfElements; - private final List elements; + private final List elements; - public ContentFilterBuilderImpl(int noOfElements, List elements) { - this.noOfElements = noOfElements; + public ContentFilterBuilderImpl(List elements) { this.elements = elements; } public ContentFilter build() { - ContentFilter contentFilter = new ContentFilter(noOfElements, elements); + ContentFilter contentFilter = new ContentFilter(elements); return contentFilter; } } @@ -148,15 +144,12 @@ public boolean equals(Object o) { return false; } ContentFilter that = (ContentFilter) o; - return (getNoOfElements() == that.getNoOfElements()) - && (getElements() == that.getElements()) - && super.equals(that) - && true; + return (getElements() == that.getElements()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfElements(), getElements()); + return Objects.hash(super.hashCode(), getElements()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElement.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElement.java index dbf3a2da879..e41a19322ba 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElement.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElement.java @@ -38,20 +38,17 @@ public class ContentFilterElement extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "585"; + public Integer getExtensionId() { + return (int) 585; } // Properties. protected final FilterOperator filterOperator; - protected final int noOfFilterOperands; protected final List filterOperands; - public ContentFilterElement( - FilterOperator filterOperator, int noOfFilterOperands, List filterOperands) { + public ContentFilterElement(FilterOperator filterOperator, List filterOperands) { super(); this.filterOperator = filterOperator; - this.noOfFilterOperands = noOfFilterOperands; this.filterOperands = filterOperands; } @@ -59,10 +56,6 @@ public FilterOperator getFilterOperator() { return filterOperator; } - public int getNoOfFilterOperands() { - return noOfFilterOperands; - } - public List getFilterOperands() { return filterOperands; } @@ -82,8 +75,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeEnum( FilterOperator::getValue, FilterOperator::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfFilterOperands) - writeSimpleField("noOfFilterOperands", noOfFilterOperands, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfFilterOperands) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfFilterOperands = + (int) ((((getFilterOperands()) == (null)) ? -(1) : COUNT(getFilterOperands()))); + writeImplicitField("noOfFilterOperands", noOfFilterOperands, writeSignedInt(writeBuffer, 32)); // Array Field (filterOperands) writeComplexTypeArrayField("filterOperands", filterOperands, writeBuffer); @@ -105,7 +101,7 @@ public int getLengthInBits() { // Simple field (filterOperator) lengthInBits += 32; - // Simple field (noOfFilterOperands) + // Implicit Field (noOfFilterOperands) lengthInBits += 32; // Array field @@ -121,7 +117,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ContentFilterElement"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -132,7 +128,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "FilterOperator", readEnum(FilterOperator::enumForValue, readUnsignedLong(readBuffer, 32))); - int noOfFilterOperands = readSimpleField("noOfFilterOperands", readSignedInt(readBuffer, 32)); + int noOfFilterOperands = readImplicitField("noOfFilterOperands", readSignedInt(readBuffer, 32)); List filterOperands = readCountArrayField( @@ -143,27 +139,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ContentFilterElement"); // Create the instance - return new ContentFilterElementBuilderImpl(filterOperator, noOfFilterOperands, filterOperands); + return new ContentFilterElementBuilderImpl(filterOperator, filterOperands); } public static class ContentFilterElementBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final FilterOperator filterOperator; - private final int noOfFilterOperands; private final List filterOperands; public ContentFilterElementBuilderImpl( - FilterOperator filterOperator, - int noOfFilterOperands, - List filterOperands) { + FilterOperator filterOperator, List filterOperands) { this.filterOperator = filterOperator; - this.noOfFilterOperands = noOfFilterOperands; this.filterOperands = filterOperands; } public ContentFilterElement build() { ContentFilterElement contentFilterElement = - new ContentFilterElement(filterOperator, noOfFilterOperands, filterOperands); + new ContentFilterElement(filterOperator, filterOperands); return contentFilterElement; } } @@ -178,7 +170,6 @@ public boolean equals(Object o) { } ContentFilterElement that = (ContentFilterElement) o; return (getFilterOperator() == that.getFilterOperator()) - && (getNoOfFilterOperands() == that.getNoOfFilterOperands()) && (getFilterOperands() == that.getFilterOperands()) && super.equals(that) && true; @@ -186,8 +177,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getFilterOperator(), getNoOfFilterOperands(), getFilterOperands()); + return Objects.hash(super.hashCode(), getFilterOperator(), getFilterOperands()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElementResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElementResult.java index 8e1fa70a67b..03c1d313e54 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElementResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterElementResult.java @@ -38,28 +38,22 @@ public class ContentFilterElementResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "606"; + public Integer getExtensionId() { + return (int) 606; } // Properties. protected final StatusCode statusCode; - protected final int noOfOperandStatusCodes; protected final List operandStatusCodes; - protected final int noOfOperandDiagnosticInfos; protected final List operandDiagnosticInfos; public ContentFilterElementResult( StatusCode statusCode, - int noOfOperandStatusCodes, List operandStatusCodes, - int noOfOperandDiagnosticInfos, List operandDiagnosticInfos) { super(); this.statusCode = statusCode; - this.noOfOperandStatusCodes = noOfOperandStatusCodes; this.operandStatusCodes = operandStatusCodes; - this.noOfOperandDiagnosticInfos = noOfOperandDiagnosticInfos; this.operandDiagnosticInfos = operandDiagnosticInfos; } @@ -67,18 +61,10 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfOperandStatusCodes() { - return noOfOperandStatusCodes; - } - public List getOperandStatusCodes() { return operandStatusCodes; } - public int getNoOfOperandDiagnosticInfos() { - return noOfOperandDiagnosticInfos; - } - public List getOperandDiagnosticInfos() { return operandDiagnosticInfos; } @@ -93,15 +79,24 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfOperandStatusCodes) - writeSimpleField( + // Implicit Field (noOfOperandStatusCodes) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfOperandStatusCodes = + (int) ((((getOperandStatusCodes()) == (null)) ? -(1) : COUNT(getOperandStatusCodes()))); + writeImplicitField( "noOfOperandStatusCodes", noOfOperandStatusCodes, writeSignedInt(writeBuffer, 32)); // Array Field (operandStatusCodes) writeComplexTypeArrayField("operandStatusCodes", operandStatusCodes, writeBuffer); - // Simple Field (noOfOperandDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfOperandDiagnosticInfos) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfOperandDiagnosticInfos = + (int) + ((((getOperandDiagnosticInfos()) == (null)) + ? -(1) + : COUNT(getOperandDiagnosticInfos()))); + writeImplicitField( "noOfOperandDiagnosticInfos", noOfOperandDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (operandDiagnosticInfos) @@ -124,7 +119,7 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfOperandStatusCodes) + // Implicit Field (noOfOperandStatusCodes) lengthInBits += 32; // Array field @@ -136,7 +131,7 @@ public int getLengthInBits() { } } - // Simple field (noOfOperandDiagnosticInfos) + // Implicit Field (noOfOperandDiagnosticInfos) lengthInBits += 32; // Array field @@ -152,7 +147,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ContentFilterElementResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -162,7 +157,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); int noOfOperandStatusCodes = - readSimpleField("noOfOperandStatusCodes", readSignedInt(readBuffer, 32)); + readImplicitField("noOfOperandStatusCodes", readSignedInt(readBuffer, 32)); List operandStatusCodes = readCountArrayField( @@ -171,7 +166,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfOperandStatusCodes); int noOfOperandDiagnosticInfos = - readSimpleField("noOfOperandDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfOperandDiagnosticInfos", readSignedInt(readBuffer, 32)); List operandDiagnosticInfos = readCountArrayField( @@ -182,42 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ContentFilterElementResult"); // Create the instance return new ContentFilterElementResultBuilderImpl( - statusCode, - noOfOperandStatusCodes, - operandStatusCodes, - noOfOperandDiagnosticInfos, - operandDiagnosticInfos); + statusCode, operandStatusCodes, operandDiagnosticInfos); } public static class ContentFilterElementResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfOperandStatusCodes; private final List operandStatusCodes; - private final int noOfOperandDiagnosticInfos; private final List operandDiagnosticInfos; public ContentFilterElementResultBuilderImpl( StatusCode statusCode, - int noOfOperandStatusCodes, List operandStatusCodes, - int noOfOperandDiagnosticInfos, List operandDiagnosticInfos) { this.statusCode = statusCode; - this.noOfOperandStatusCodes = noOfOperandStatusCodes; this.operandStatusCodes = operandStatusCodes; - this.noOfOperandDiagnosticInfos = noOfOperandDiagnosticInfos; this.operandDiagnosticInfos = operandDiagnosticInfos; } public ContentFilterElementResult build() { ContentFilterElementResult contentFilterElementResult = - new ContentFilterElementResult( - statusCode, - noOfOperandStatusCodes, - operandStatusCodes, - noOfOperandDiagnosticInfos, - operandDiagnosticInfos); + new ContentFilterElementResult(statusCode, operandStatusCodes, operandDiagnosticInfos); return contentFilterElementResult; } } @@ -232,9 +212,7 @@ public boolean equals(Object o) { } ContentFilterElementResult that = (ContentFilterElementResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfOperandStatusCodes() == that.getNoOfOperandStatusCodes()) && (getOperandStatusCodes() == that.getOperandStatusCodes()) - && (getNoOfOperandDiagnosticInfos() == that.getNoOfOperandDiagnosticInfos()) && (getOperandDiagnosticInfos() == that.getOperandDiagnosticInfos()) && super.equals(that) && true; @@ -243,12 +221,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getStatusCode(), - getNoOfOperandStatusCodes(), - getOperandStatusCodes(), - getNoOfOperandDiagnosticInfos(), - getOperandDiagnosticInfos()); + super.hashCode(), getStatusCode(), getOperandStatusCodes(), getOperandDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterResult.java index 3551c7845ba..d447f599746 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ContentFilterResult.java @@ -38,40 +38,26 @@ public class ContentFilterResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "609"; + public Integer getExtensionId() { + return (int) 609; } // Properties. - protected final int noOfElementResults; - protected final List elementResults; - protected final int noOfElementDiagnosticInfos; + protected final List elementResults; protected final List elementDiagnosticInfos; public ContentFilterResult( - int noOfElementResults, - List elementResults, - int noOfElementDiagnosticInfos, + List elementResults, List elementDiagnosticInfos) { super(); - this.noOfElementResults = noOfElementResults; this.elementResults = elementResults; - this.noOfElementDiagnosticInfos = noOfElementDiagnosticInfos; this.elementDiagnosticInfos = elementDiagnosticInfos; } - public int getNoOfElementResults() { - return noOfElementResults; - } - - public List getElementResults() { + public List getElementResults() { return elementResults; } - public int getNoOfElementDiagnosticInfos() { - return noOfElementDiagnosticInfos; - } - public List getElementDiagnosticInfos() { return elementDiagnosticInfos; } @@ -83,14 +69,23 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("ContentFilterResult"); - // Simple Field (noOfElementResults) - writeSimpleField("noOfElementResults", noOfElementResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfElementResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfElementResults = + (int) ((((getElementResults()) == (null)) ? -(1) : COUNT(getElementResults()))); + writeImplicitField("noOfElementResults", noOfElementResults, writeSignedInt(writeBuffer, 32)); // Array Field (elementResults) writeComplexTypeArrayField("elementResults", elementResults, writeBuffer); - // Simple Field (noOfElementDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfElementDiagnosticInfos) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfElementDiagnosticInfos = + (int) + ((((getElementDiagnosticInfos()) == (null)) + ? -(1) + : COUNT(getElementDiagnosticInfos()))); + writeImplicitField( "noOfElementDiagnosticInfos", noOfElementDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (elementDiagnosticInfos) @@ -110,19 +105,19 @@ public int getLengthInBits() { ContentFilterResult _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfElementResults) + // Implicit Field (noOfElementResults) lengthInBits += 32; // Array field if (elementResults != null) { int i = 0; - for (ExtensionObjectDefinition element : elementResults) { + for (ContentFilterElementResult element : elementResults) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= elementResults.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfElementDiagnosticInfos) + // Implicit Field (noOfElementDiagnosticInfos) lengthInBits += 32; // Array field @@ -138,23 +133,25 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ContentFilterResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfElementResults = readSimpleField("noOfElementResults", readSignedInt(readBuffer, 32)); + int noOfElementResults = readImplicitField("noOfElementResults", readSignedInt(readBuffer, 32)); - List elementResults = + List elementResults = readCountArrayField( "elementResults", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("606")), + () -> + (ContentFilterElementResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (606)), readBuffer), noOfElementResults); int noOfElementDiagnosticInfos = - readSimpleField("noOfElementDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfElementDiagnosticInfos", readSignedInt(readBuffer, 32)); List elementDiagnosticInfos = readCountArrayField( @@ -164,35 +161,24 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ContentFilterResult"); // Create the instance - return new ContentFilterResultBuilderImpl( - noOfElementResults, elementResults, noOfElementDiagnosticInfos, elementDiagnosticInfos); + return new ContentFilterResultBuilderImpl(elementResults, elementDiagnosticInfos); } public static class ContentFilterResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfElementResults; - private final List elementResults; - private final int noOfElementDiagnosticInfos; + private final List elementResults; private final List elementDiagnosticInfos; public ContentFilterResultBuilderImpl( - int noOfElementResults, - List elementResults, - int noOfElementDiagnosticInfos, + List elementResults, List elementDiagnosticInfos) { - this.noOfElementResults = noOfElementResults; this.elementResults = elementResults; - this.noOfElementDiagnosticInfos = noOfElementDiagnosticInfos; this.elementDiagnosticInfos = elementDiagnosticInfos; } public ContentFilterResult build() { ContentFilterResult contentFilterResult = - new ContentFilterResult( - noOfElementResults, - elementResults, - noOfElementDiagnosticInfos, - elementDiagnosticInfos); + new ContentFilterResult(elementResults, elementDiagnosticInfos); return contentFilterResult; } } @@ -206,9 +192,7 @@ public boolean equals(Object o) { return false; } ContentFilterResult that = (ContentFilterResult) o; - return (getNoOfElementResults() == that.getNoOfElementResults()) - && (getElementResults() == that.getElementResults()) - && (getNoOfElementDiagnosticInfos() == that.getNoOfElementDiagnosticInfos()) + return (getElementResults() == that.getElementResults()) && (getElementDiagnosticInfos() == that.getElementDiagnosticInfos()) && super.equals(that) && true; @@ -216,12 +200,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getNoOfElementResults(), - getElementResults(), - getNoOfElementDiagnosticInfos(), - getElementDiagnosticInfos()); + return Objects.hash(super.hashCode(), getElementResults(), getElementDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsRequest.java index 9a0065d7bb3..bb6a9fec220 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsRequest.java @@ -38,32 +38,29 @@ public class CreateMonitoredItemsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "751"; + public Integer getExtensionId() { + return (int) 751; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final TimestampsToReturn timestampsToReturn; - protected final int noOfItemsToCreate; - protected final List itemsToCreate; + protected final List itemsToCreate; public CreateMonitoredItemsRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, TimestampsToReturn timestampsToReturn, - int noOfItemsToCreate, - List itemsToCreate) { + List itemsToCreate) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.timestampsToReturn = timestampsToReturn; - this.noOfItemsToCreate = noOfItemsToCreate; this.itemsToCreate = itemsToCreate; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -75,11 +72,7 @@ public TimestampsToReturn getTimestampsToReturn() { return timestampsToReturn; } - public int getNoOfItemsToCreate() { - return noOfItemsToCreate; - } - - public List getItemsToCreate() { + public List getItemsToCreate() { return itemsToCreate; } @@ -106,8 +99,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) TimestampsToReturn::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfItemsToCreate) - writeSimpleField("noOfItemsToCreate", noOfItemsToCreate, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfItemsToCreate) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfItemsToCreate = + (int) ((((getItemsToCreate()) == (null)) ? -(1) : COUNT(getItemsToCreate()))); + writeImplicitField("noOfItemsToCreate", noOfItemsToCreate, writeSignedInt(writeBuffer, 32)); // Array Field (itemsToCreate) writeComplexTypeArrayField("itemsToCreate", itemsToCreate, writeBuffer); @@ -135,13 +131,13 @@ public int getLengthInBits() { // Simple field (timestampsToReturn) lengthInBits += 32; - // Simple field (noOfItemsToCreate) + // Implicit Field (noOfItemsToCreate) lengthInBits += 32; // Array field if (itemsToCreate != null) { int i = 0; - for (ExtensionObjectDefinition element : itemsToCreate) { + for (MonitoredItemCreateRequest element : itemsToCreate) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= itemsToCreate.size()); lengthInBits += element.getLengthInBits(); } @@ -151,16 +147,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateMonitoredItemsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -171,47 +168,46 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "TimestampsToReturn", readEnum(TimestampsToReturn::enumForValue, readUnsignedLong(readBuffer, 32))); - int noOfItemsToCreate = readSimpleField("noOfItemsToCreate", readSignedInt(readBuffer, 32)); + int noOfItemsToCreate = readImplicitField("noOfItemsToCreate", readSignedInt(readBuffer, 32)); - List itemsToCreate = + List itemsToCreate = readCountArrayField( "itemsToCreate", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("745")), + () -> + (MonitoredItemCreateRequest) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (745)), readBuffer), noOfItemsToCreate); readBuffer.closeContext("CreateMonitoredItemsRequest"); // Create the instance return new CreateMonitoredItemsRequestBuilderImpl( - requestHeader, subscriptionId, timestampsToReturn, noOfItemsToCreate, itemsToCreate); + requestHeader, subscriptionId, timestampsToReturn, itemsToCreate); } public static class CreateMonitoredItemsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final TimestampsToReturn timestampsToReturn; - private final int noOfItemsToCreate; - private final List itemsToCreate; + private final List itemsToCreate; public CreateMonitoredItemsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, TimestampsToReturn timestampsToReturn, - int noOfItemsToCreate, - List itemsToCreate) { + List itemsToCreate) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.timestampsToReturn = timestampsToReturn; - this.noOfItemsToCreate = noOfItemsToCreate; this.itemsToCreate = itemsToCreate; } public CreateMonitoredItemsRequest build() { CreateMonitoredItemsRequest createMonitoredItemsRequest = new CreateMonitoredItemsRequest( - requestHeader, subscriptionId, timestampsToReturn, noOfItemsToCreate, itemsToCreate); + requestHeader, subscriptionId, timestampsToReturn, itemsToCreate); return createMonitoredItemsRequest; } } @@ -228,7 +224,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getSubscriptionId() == that.getSubscriptionId()) && (getTimestampsToReturn() == that.getTimestampsToReturn()) - && (getNoOfItemsToCreate() == that.getNoOfItemsToCreate()) && (getItemsToCreate() == that.getItemsToCreate()) && super.equals(that) && true; @@ -241,7 +236,6 @@ public int hashCode() { getRequestHeader(), getSubscriptionId(), getTimestampsToReturn(), - getNoOfItemsToCreate(), getItemsToCreate()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsResponse.java index 964a43f4d30..85e970be197 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateMonitoredItemsResponse.java @@ -38,47 +38,33 @@ public class CreateMonitoredItemsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "754"; + public Integer getExtensionId() { + return (int) 754; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public CreateMonitoredItemsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (MonitoredItemCreateResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateMonitoredItemsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("748")), + () -> + (MonitoredItemCreateResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (748)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("CreateMonitoredItemsResponse"); // Create the instance - return new CreateMonitoredItemsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new CreateMonitoredItemsResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class CreateMonitoredItemsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public CreateMonitoredItemsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public CreateMonitoredItemsResponse build() { CreateMonitoredItemsResponse createMonitoredItemsResponse = - new CreateMonitoredItemsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new CreateMonitoredItemsResponse(responseHeader, results, diagnosticInfos); return createMonitoredItemsResponse; } } @@ -225,9 +212,7 @@ public boolean equals(Object o) { } CreateMonitoredItemsResponse that = (CreateMonitoredItemsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +220,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionRequest.java index 818b57f6e94..f18022ff3ba 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionRequest.java @@ -38,13 +38,13 @@ public class CreateSessionRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "461"; + public Integer getExtensionId() { + return (int) 461; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition clientDescription; + protected final RequestHeader requestHeader; + protected final ApplicationDescription clientDescription; protected final PascalString serverUri; protected final PascalString endpointUrl; protected final PascalString sessionName; @@ -54,8 +54,8 @@ public String getIdentifier() { protected final long maxResponseMessageSize; public CreateSessionRequest( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition clientDescription, + RequestHeader requestHeader, + ApplicationDescription clientDescription, PascalString serverUri, PascalString endpointUrl, PascalString sessionName, @@ -75,11 +75,11 @@ public CreateSessionRequest( this.maxResponseMessageSize = maxResponseMessageSize; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getClientDescription() { + public ApplicationDescription getClientDescription() { return clientDescription; } @@ -192,23 +192,26 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateSessionRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition clientDescription = + ApplicationDescription clientDescription = readSimpleField( "clientDescription", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("310")), + () -> + (ApplicationDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (310)), readBuffer)); PascalString serverUri = @@ -254,8 +257,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CreateSessionRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition clientDescription; + private final RequestHeader requestHeader; + private final ApplicationDescription clientDescription; private final PascalString serverUri; private final PascalString endpointUrl; private final PascalString sessionName; @@ -265,8 +268,8 @@ public static class CreateSessionRequestBuilderImpl private final long maxResponseMessageSize; public CreateSessionRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition clientDescription, + RequestHeader requestHeader, + ApplicationDescription clientDescription, PascalString serverUri, PascalString endpointUrl, PascalString sessionName, diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionResponse.java index 8f61a0581be..d6c25924780 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSessionResponse.java @@ -38,36 +38,32 @@ public class CreateSessionResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "464"; + public Integer getExtensionId() { + return (int) 464; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final NodeId sessionId; protected final NodeId authenticationToken; protected final double revisedSessionTimeout; protected final PascalByteString serverNonce; protected final PascalByteString serverCertificate; - protected final int noOfServerEndpoints; - protected final List serverEndpoints; - protected final int noOfServerSoftwareCertificates; - protected final List serverSoftwareCertificates; - protected final ExtensionObjectDefinition serverSignature; + protected final List serverEndpoints; + protected final List serverSoftwareCertificates; + protected final SignatureData serverSignature; protected final long maxRequestMessageSize; public CreateSessionResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, NodeId sessionId, NodeId authenticationToken, double revisedSessionTimeout, PascalByteString serverNonce, PascalByteString serverCertificate, - int noOfServerEndpoints, - List serverEndpoints, - int noOfServerSoftwareCertificates, - List serverSoftwareCertificates, - ExtensionObjectDefinition serverSignature, + List serverEndpoints, + List serverSoftwareCertificates, + SignatureData serverSignature, long maxRequestMessageSize) { super(); this.responseHeader = responseHeader; @@ -76,15 +72,13 @@ public CreateSessionResponse( this.revisedSessionTimeout = revisedSessionTimeout; this.serverNonce = serverNonce; this.serverCertificate = serverCertificate; - this.noOfServerEndpoints = noOfServerEndpoints; this.serverEndpoints = serverEndpoints; - this.noOfServerSoftwareCertificates = noOfServerSoftwareCertificates; this.serverSoftwareCertificates = serverSoftwareCertificates; this.serverSignature = serverSignature; this.maxRequestMessageSize = maxRequestMessageSize; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -108,23 +102,15 @@ public PascalByteString getServerCertificate() { return serverCertificate; } - public int getNoOfServerEndpoints() { - return noOfServerEndpoints; - } - - public List getServerEndpoints() { + public List getServerEndpoints() { return serverEndpoints; } - public int getNoOfServerSoftwareCertificates() { - return noOfServerSoftwareCertificates; - } - - public List getServerSoftwareCertificates() { + public List getServerSoftwareCertificates() { return serverSoftwareCertificates; } - public ExtensionObjectDefinition getServerSignature() { + public SignatureData getServerSignature() { return serverSignature; } @@ -157,14 +143,23 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (serverCertificate) writeSimpleField("serverCertificate", serverCertificate, writeComplex(writeBuffer)); - // Simple Field (noOfServerEndpoints) - writeSimpleField("noOfServerEndpoints", noOfServerEndpoints, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServerEndpoints) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServerEndpoints = + (int) ((((getServerEndpoints()) == (null)) ? -(1) : COUNT(getServerEndpoints()))); + writeImplicitField("noOfServerEndpoints", noOfServerEndpoints, writeSignedInt(writeBuffer, 32)); // Array Field (serverEndpoints) writeComplexTypeArrayField("serverEndpoints", serverEndpoints, writeBuffer); - // Simple Field (noOfServerSoftwareCertificates) - writeSimpleField( + // Implicit Field (noOfServerSoftwareCertificates) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfServerSoftwareCertificates = + (int) + ((((getServerSoftwareCertificates()) == (null)) + ? -(1) + : COUNT(getServerSoftwareCertificates()))); + writeImplicitField( "noOfServerSoftwareCertificates", noOfServerSoftwareCertificates, writeSignedInt(writeBuffer, 32)); @@ -212,25 +207,25 @@ public int getLengthInBits() { // Simple field (serverCertificate) lengthInBits += serverCertificate.getLengthInBits(); - // Simple field (noOfServerEndpoints) + // Implicit Field (noOfServerEndpoints) lengthInBits += 32; // Array field if (serverEndpoints != null) { int i = 0; - for (ExtensionObjectDefinition element : serverEndpoints) { + for (EndpointDescription element : serverEndpoints) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= serverEndpoints.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfServerSoftwareCertificates) + // Implicit Field (noOfServerSoftwareCertificates) lengthInBits += 32; // Array field if (serverSoftwareCertificates != null) { int i = 0; - for (ExtensionObjectDefinition element : serverSoftwareCertificates) { + for (SignedSoftwareCertificate element : serverSoftwareCertificates) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= serverSoftwareCertificates.size()); lengthInBits += element.getLengthInBits(); } @@ -246,16 +241,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateSessionResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); NodeId sessionId = @@ -277,32 +273,38 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "serverCertificate", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); - int noOfServerEndpoints = readSimpleField("noOfServerEndpoints", readSignedInt(readBuffer, 32)); + int noOfServerEndpoints = + readImplicitField("noOfServerEndpoints", readSignedInt(readBuffer, 32)); - List serverEndpoints = + List serverEndpoints = readCountArrayField( "serverEndpoints", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("314")), + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), readBuffer), noOfServerEndpoints); int noOfServerSoftwareCertificates = - readSimpleField("noOfServerSoftwareCertificates", readSignedInt(readBuffer, 32)); + readImplicitField("noOfServerSoftwareCertificates", readSignedInt(readBuffer, 32)); - List serverSoftwareCertificates = + List serverSoftwareCertificates = readCountArrayField( "serverSoftwareCertificates", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("346")), + () -> + (SignedSoftwareCertificate) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (346)), readBuffer), noOfServerSoftwareCertificates); - ExtensionObjectDefinition serverSignature = + SignatureData serverSignature = readSimpleField( "serverSignature", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("458")), + () -> + (SignatureData) ExtensionObjectDefinition.staticParse(readBuffer, (int) (458)), readBuffer)); long maxRequestMessageSize = @@ -317,9 +319,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit revisedSessionTimeout, serverNonce, serverCertificate, - noOfServerEndpoints, serverEndpoints, - noOfServerSoftwareCertificates, serverSoftwareCertificates, serverSignature, maxRequestMessageSize); @@ -327,31 +327,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CreateSessionResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final NodeId sessionId; private final NodeId authenticationToken; private final double revisedSessionTimeout; private final PascalByteString serverNonce; private final PascalByteString serverCertificate; - private final int noOfServerEndpoints; - private final List serverEndpoints; - private final int noOfServerSoftwareCertificates; - private final List serverSoftwareCertificates; - private final ExtensionObjectDefinition serverSignature; + private final List serverEndpoints; + private final List serverSoftwareCertificates; + private final SignatureData serverSignature; private final long maxRequestMessageSize; public CreateSessionResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, NodeId sessionId, NodeId authenticationToken, double revisedSessionTimeout, PascalByteString serverNonce, PascalByteString serverCertificate, - int noOfServerEndpoints, - List serverEndpoints, - int noOfServerSoftwareCertificates, - List serverSoftwareCertificates, - ExtensionObjectDefinition serverSignature, + List serverEndpoints, + List serverSoftwareCertificates, + SignatureData serverSignature, long maxRequestMessageSize) { this.responseHeader = responseHeader; this.sessionId = sessionId; @@ -359,9 +355,7 @@ public CreateSessionResponseBuilderImpl( this.revisedSessionTimeout = revisedSessionTimeout; this.serverNonce = serverNonce; this.serverCertificate = serverCertificate; - this.noOfServerEndpoints = noOfServerEndpoints; this.serverEndpoints = serverEndpoints; - this.noOfServerSoftwareCertificates = noOfServerSoftwareCertificates; this.serverSoftwareCertificates = serverSoftwareCertificates; this.serverSignature = serverSignature; this.maxRequestMessageSize = maxRequestMessageSize; @@ -376,9 +370,7 @@ public CreateSessionResponse build() { revisedSessionTimeout, serverNonce, serverCertificate, - noOfServerEndpoints, serverEndpoints, - noOfServerSoftwareCertificates, serverSoftwareCertificates, serverSignature, maxRequestMessageSize); @@ -401,9 +393,7 @@ public boolean equals(Object o) { && (getRevisedSessionTimeout() == that.getRevisedSessionTimeout()) && (getServerNonce() == that.getServerNonce()) && (getServerCertificate() == that.getServerCertificate()) - && (getNoOfServerEndpoints() == that.getNoOfServerEndpoints()) && (getServerEndpoints() == that.getServerEndpoints()) - && (getNoOfServerSoftwareCertificates() == that.getNoOfServerSoftwareCertificates()) && (getServerSoftwareCertificates() == that.getServerSoftwareCertificates()) && (getServerSignature() == that.getServerSignature()) && (getMaxRequestMessageSize() == that.getMaxRequestMessageSize()) @@ -421,9 +411,7 @@ public int hashCode() { getRevisedSessionTimeout(), getServerNonce(), getServerCertificate(), - getNoOfServerEndpoints(), getServerEndpoints(), - getNoOfServerSoftwareCertificates(), getServerSoftwareCertificates(), getServerSignature(), getMaxRequestMessageSize()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionRequest.java index ca7ecac877a..0e3de8c04b2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionRequest.java @@ -38,12 +38,12 @@ public class CreateSubscriptionRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "787"; + public Integer getExtensionId() { + return (int) 787; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final double requestedPublishingInterval; protected final long requestedLifetimeCount; protected final long requestedMaxKeepAliveCount; @@ -52,7 +52,7 @@ public String getIdentifier() { protected final short priority; public CreateSubscriptionRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, double requestedPublishingInterval, long requestedLifetimeCount, long requestedMaxKeepAliveCount, @@ -69,7 +69,7 @@ public CreateSubscriptionRequest( this.priority = priority; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -178,16 +178,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateSubscriptionRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); double requestedPublishingInterval = @@ -223,7 +224,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CreateSubscriptionRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final double requestedPublishingInterval; private final long requestedLifetimeCount; private final long requestedMaxKeepAliveCount; @@ -232,7 +233,7 @@ public static class CreateSubscriptionRequestBuilderImpl private final short priority; public CreateSubscriptionRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, double requestedPublishingInterval, long requestedLifetimeCount, long requestedMaxKeepAliveCount, diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionResponse.java index 551971b8e0c..f9b43e4eab2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CreateSubscriptionResponse.java @@ -38,19 +38,19 @@ public class CreateSubscriptionResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "790"; + public Integer getExtensionId() { + return (int) 790; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final long subscriptionId; protected final double revisedPublishingInterval; protected final long revisedLifetimeCount; protected final long revisedMaxKeepAliveCount; public CreateSubscriptionResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long subscriptionId, double revisedPublishingInterval, long revisedLifetimeCount, @@ -63,7 +63,7 @@ public CreateSubscriptionResponse( this.revisedMaxKeepAliveCount = revisedMaxKeepAliveCount; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -141,16 +141,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CreateSubscriptionResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -176,14 +177,14 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class CreateSubscriptionResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final long subscriptionId; private final double revisedPublishingInterval; private final long revisedLifetimeCount; private final long revisedMaxKeepAliveCount; public CreateSubscriptionResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long subscriptionId, double revisedPublishingInterval, long revisedLifetimeCount, diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CurrencyUnitType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CurrencyUnitType.java index b24026af1de..22c9f81fa1f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CurrencyUnitType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/CurrencyUnitType.java @@ -38,8 +38,8 @@ public class CurrencyUnitType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "23500"; + public Integer getExtensionId() { + return (int) 23500; } // Properties. @@ -122,7 +122,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("CurrencyUnitType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeFilter.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeFilter.java new file mode 100644 index 00000000000..37d93203673 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeFilter.java @@ -0,0 +1,190 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DataChangeFilter extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 724; + } + + // Properties. + protected final DataChangeTrigger trigger; + protected final long deadbandType; + protected final double deadbandValue; + + public DataChangeFilter(DataChangeTrigger trigger, long deadbandType, double deadbandValue) { + super(); + this.trigger = trigger; + this.deadbandType = deadbandType; + this.deadbandValue = deadbandValue; + } + + public DataChangeTrigger getTrigger() { + return trigger; + } + + public long getDeadbandType() { + return deadbandType; + } + + public double getDeadbandValue() { + return deadbandValue; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DataChangeFilter"); + + // Simple Field (trigger) + writeSimpleEnumField( + "trigger", + "DataChangeTrigger", + trigger, + writeEnum( + DataChangeTrigger::getValue, + DataChangeTrigger::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (deadbandType) + writeSimpleField("deadbandType", deadbandType, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (deadbandValue) + writeSimpleField("deadbandValue", deadbandValue, writeDouble(writeBuffer, 64)); + + writeBuffer.popContext("DataChangeFilter"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DataChangeFilter _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (trigger) + lengthInBits += 32; + + // Simple field (deadbandType) + lengthInBits += 32; + + // Simple field (deadbandValue) + lengthInBits += 64; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DataChangeFilter"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + DataChangeTrigger trigger = + readEnumField( + "trigger", + "DataChangeTrigger", + readEnum(DataChangeTrigger::enumForValue, readUnsignedLong(readBuffer, 32))); + + long deadbandType = readSimpleField("deadbandType", readUnsignedLong(readBuffer, 32)); + + double deadbandValue = readSimpleField("deadbandValue", readDouble(readBuffer, 64)); + + readBuffer.closeContext("DataChangeFilter"); + // Create the instance + return new DataChangeFilterBuilderImpl(trigger, deadbandType, deadbandValue); + } + + public static class DataChangeFilterBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final DataChangeTrigger trigger; + private final long deadbandType; + private final double deadbandValue; + + public DataChangeFilterBuilderImpl( + DataChangeTrigger trigger, long deadbandType, double deadbandValue) { + this.trigger = trigger; + this.deadbandType = deadbandType; + this.deadbandValue = deadbandValue; + } + + public DataChangeFilter build() { + DataChangeFilter dataChangeFilter = + new DataChangeFilter(trigger, deadbandType, deadbandValue); + return dataChangeFilter; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DataChangeFilter)) { + return false; + } + DataChangeFilter that = (DataChangeFilter) o; + return (getTrigger() == that.getTrigger()) + && (getDeadbandType() == that.getDeadbandType()) + && (getDeadbandValue() == that.getDeadbandValue()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getTrigger(), getDeadbandType(), getDeadbandValue()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeNotification.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeNotification.java index e3923bb984a..c8779f62d99 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeNotification.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataChangeNotification.java @@ -38,40 +38,25 @@ public class DataChangeNotification extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "811"; + public Integer getExtensionId() { + return (int) 811; } // Properties. - protected final int noOfMonitoredItems; - protected final List monitoredItems; - protected final int noOfDiagnosticInfos; + protected final List monitoredItems; protected final List diagnosticInfos; public DataChangeNotification( - int noOfMonitoredItems, - List monitoredItems, - int noOfDiagnosticInfos, - List diagnosticInfos) { + List monitoredItems, List diagnosticInfos) { super(); - this.noOfMonitoredItems = noOfMonitoredItems; this.monitoredItems = monitoredItems; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public int getNoOfMonitoredItems() { - return noOfMonitoredItems; - } - - public List getMonitoredItems() { + public List getMonitoredItems() { return monitoredItems; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -83,19 +68,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("DataChangeNotification"); - // Implicit Field (notificationLength) (Used for parsing, but its value is not stored as it's + // Implicit Field (noOfMonitoredItems) (Used for parsing, but its value is not stored as it's // implicitly given by the objects content) - int notificationLength = (int) (getLengthInBytes()); - writeImplicitField("notificationLength", notificationLength, writeSignedInt(writeBuffer, 32)); - - // Simple Field (noOfMonitoredItems) - writeSimpleField("noOfMonitoredItems", noOfMonitoredItems, writeSignedInt(writeBuffer, 32)); + int noOfMonitoredItems = + (int) ((((getMonitoredItems()) == (null)) ? -(1) : COUNT(getMonitoredItems()))); + writeImplicitField("noOfMonitoredItems", noOfMonitoredItems, writeSignedInt(writeBuffer, 32)); // Array Field (monitoredItems) writeComplexTypeArrayField("monitoredItems", monitoredItems, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -114,22 +100,19 @@ public int getLengthInBits() { DataChangeNotification _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Implicit Field (notificationLength) - lengthInBits += 32; - - // Simple field (noOfMonitoredItems) + // Implicit Field (noOfMonitoredItems) lengthInBits += 32; // Array field if (monitoredItems != null) { int i = 0; - for (ExtensionObjectDefinition element : monitoredItems) { + for (MonitoredItemNotification element : monitoredItems) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= monitoredItems.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -145,24 +128,25 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataChangeNotification"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int notificationLength = readImplicitField("notificationLength", readSignedInt(readBuffer, 32)); - - int noOfMonitoredItems = readSimpleField("noOfMonitoredItems", readSignedInt(readBuffer, 32)); + int noOfMonitoredItems = readImplicitField("noOfMonitoredItems", readSignedInt(readBuffer, 32)); - List monitoredItems = + List monitoredItems = readCountArrayField( "monitoredItems", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("808")), + () -> + (MonitoredItemNotification) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (808)), readBuffer), noOfMonitoredItems); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -172,32 +156,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DataChangeNotification"); // Create the instance - return new DataChangeNotificationBuilderImpl( - noOfMonitoredItems, monitoredItems, noOfDiagnosticInfos, diagnosticInfos); + return new DataChangeNotificationBuilderImpl(monitoredItems, diagnosticInfos); } public static class DataChangeNotificationBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfMonitoredItems; - private final List monitoredItems; - private final int noOfDiagnosticInfos; + private final List monitoredItems; private final List diagnosticInfos; public DataChangeNotificationBuilderImpl( - int noOfMonitoredItems, - List monitoredItems, - int noOfDiagnosticInfos, - List diagnosticInfos) { - this.noOfMonitoredItems = noOfMonitoredItems; + List monitoredItems, List diagnosticInfos) { this.monitoredItems = monitoredItems; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public DataChangeNotification build() { DataChangeNotification dataChangeNotification = - new DataChangeNotification( - noOfMonitoredItems, monitoredItems, noOfDiagnosticInfos, diagnosticInfos); + new DataChangeNotification(monitoredItems, diagnosticInfos); return dataChangeNotification; } } @@ -211,9 +186,7 @@ public boolean equals(Object o) { return false; } DataChangeNotification that = (DataChangeNotification) o; - return (getNoOfMonitoredItems() == that.getNoOfMonitoredItems()) - && (getMonitoredItems() == that.getMonitoredItems()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) + return (getMonitoredItems() == that.getMonitoredItems()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -221,12 +194,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getNoOfMonitoredItems(), - getMonitoredItems(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getMonitoredItems(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetMetaDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetMetaDataType.java new file mode 100644 index 00000000000..7fefc39482c --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetMetaDataType.java @@ -0,0 +1,461 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DataSetMetaDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 14525; + } + + // Properties. + protected final List namespaces; + protected final List structureDataTypes; + protected final List enumDataTypes; + protected final List simpleDataTypes; + protected final PascalString name; + protected final LocalizedText description; + protected final List fields; + protected final GuidValue dataSetClassId; + protected final ConfigurationVersionDataType configurationVersion; + + public DataSetMetaDataType( + List namespaces, + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes, + PascalString name, + LocalizedText description, + List fields, + GuidValue dataSetClassId, + ConfigurationVersionDataType configurationVersion) { + super(); + this.namespaces = namespaces; + this.structureDataTypes = structureDataTypes; + this.enumDataTypes = enumDataTypes; + this.simpleDataTypes = simpleDataTypes; + this.name = name; + this.description = description; + this.fields = fields; + this.dataSetClassId = dataSetClassId; + this.configurationVersion = configurationVersion; + } + + public List getNamespaces() { + return namespaces; + } + + public List getStructureDataTypes() { + return structureDataTypes; + } + + public List getEnumDataTypes() { + return enumDataTypes; + } + + public List getSimpleDataTypes() { + return simpleDataTypes; + } + + public PascalString getName() { + return name; + } + + public LocalizedText getDescription() { + return description; + } + + public List getFields() { + return fields; + } + + public GuidValue getDataSetClassId() { + return dataSetClassId; + } + + public ConfigurationVersionDataType getConfigurationVersion() { + return configurationVersion; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DataSetMetaDataType"); + + // Implicit Field (noOfNamespaces) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNamespaces = (int) ((((getNamespaces()) == (null)) ? -(1) : COUNT(getNamespaces()))); + writeImplicitField("noOfNamespaces", noOfNamespaces, writeSignedInt(writeBuffer, 32)); + + // Array Field (namespaces) + writeComplexTypeArrayField("namespaces", namespaces, writeBuffer); + + // Implicit Field (noOfStructureDataTypes) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfStructureDataTypes = + (int) ((((getStructureDataTypes()) == (null)) ? -(1) : COUNT(getStructureDataTypes()))); + writeImplicitField( + "noOfStructureDataTypes", noOfStructureDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (structureDataTypes) + writeComplexTypeArrayField("structureDataTypes", structureDataTypes, writeBuffer); + + // Implicit Field (noOfEnumDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEnumDataTypes = + (int) ((((getEnumDataTypes()) == (null)) ? -(1) : COUNT(getEnumDataTypes()))); + writeImplicitField("noOfEnumDataTypes", noOfEnumDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (enumDataTypes) + writeComplexTypeArrayField("enumDataTypes", enumDataTypes, writeBuffer); + + // Implicit Field (noOfSimpleDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSimpleDataTypes = + (int) ((((getSimpleDataTypes()) == (null)) ? -(1) : COUNT(getSimpleDataTypes()))); + writeImplicitField("noOfSimpleDataTypes", noOfSimpleDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (simpleDataTypes) + writeComplexTypeArrayField("simpleDataTypes", simpleDataTypes, writeBuffer); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Implicit Field (noOfFields) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfFields = (int) ((((getFields()) == (null)) ? -(1) : COUNT(getFields()))); + writeImplicitField("noOfFields", noOfFields, writeSignedInt(writeBuffer, 32)); + + // Array Field (fields) + writeComplexTypeArrayField("fields", fields, writeBuffer); + + // Simple Field (dataSetClassId) + writeSimpleField("dataSetClassId", dataSetClassId, writeComplex(writeBuffer)); + + // Simple Field (configurationVersion) + writeSimpleField("configurationVersion", configurationVersion, writeComplex(writeBuffer)); + + writeBuffer.popContext("DataSetMetaDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DataSetMetaDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfNamespaces) + lengthInBits += 32; + + // Array field + if (namespaces != null) { + int i = 0; + for (PascalString element : namespaces) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= namespaces.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfStructureDataTypes) + lengthInBits += 32; + + // Array field + if (structureDataTypes != null) { + int i = 0; + for (StructureDescription element : structureDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= structureDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfEnumDataTypes) + lengthInBits += 32; + + // Array field + if (enumDataTypes != null) { + int i = 0; + for (EnumDescription element : enumDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= enumDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfSimpleDataTypes) + lengthInBits += 32; + + // Array field + if (simpleDataTypes != null) { + int i = 0; + for (SimpleTypeDescription element : simpleDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= simpleDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Implicit Field (noOfFields) + lengthInBits += 32; + + // Array field + if (fields != null) { + int i = 0; + for (FieldMetaData element : fields) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= fields.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (dataSetClassId) + lengthInBits += dataSetClassId.getLengthInBits(); + + // Simple field (configurationVersion) + lengthInBits += configurationVersion.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DataSetMetaDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfNamespaces = readImplicitField("noOfNamespaces", readSignedInt(readBuffer, 32)); + + List namespaces = + readCountArrayField( + "namespaces", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfNamespaces); + + int noOfStructureDataTypes = + readImplicitField("noOfStructureDataTypes", readSignedInt(readBuffer, 32)); + + List structureDataTypes = + readCountArrayField( + "structureDataTypes", + readComplex( + () -> + (StructureDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15489)), + readBuffer), + noOfStructureDataTypes); + + int noOfEnumDataTypes = readImplicitField("noOfEnumDataTypes", readSignedInt(readBuffer, 32)); + + List enumDataTypes = + readCountArrayField( + "enumDataTypes", + readComplex( + () -> + (EnumDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15490)), + readBuffer), + noOfEnumDataTypes); + + int noOfSimpleDataTypes = + readImplicitField("noOfSimpleDataTypes", readSignedInt(readBuffer, 32)); + + List simpleDataTypes = + readCountArrayField( + "simpleDataTypes", + readComplex( + () -> + (SimpleTypeDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15007)), + readBuffer), + noOfSimpleDataTypes); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + int noOfFields = readImplicitField("noOfFields", readSignedInt(readBuffer, 32)); + + List fields = + readCountArrayField( + "fields", + readComplex( + () -> + (FieldMetaData) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14526)), + readBuffer), + noOfFields); + + GuidValue dataSetClassId = + readSimpleField( + "dataSetClassId", readComplex(() -> GuidValue.staticParse(readBuffer), readBuffer)); + + ConfigurationVersionDataType configurationVersion = + readSimpleField( + "configurationVersion", + readComplex( + () -> + (ConfigurationVersionDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14595)), + readBuffer)); + + readBuffer.closeContext("DataSetMetaDataType"); + // Create the instance + return new DataSetMetaDataTypeBuilderImpl( + namespaces, + structureDataTypes, + enumDataTypes, + simpleDataTypes, + name, + description, + fields, + dataSetClassId, + configurationVersion); + } + + public static class DataSetMetaDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List namespaces; + private final List structureDataTypes; + private final List enumDataTypes; + private final List simpleDataTypes; + private final PascalString name; + private final LocalizedText description; + private final List fields; + private final GuidValue dataSetClassId; + private final ConfigurationVersionDataType configurationVersion; + + public DataSetMetaDataTypeBuilderImpl( + List namespaces, + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes, + PascalString name, + LocalizedText description, + List fields, + GuidValue dataSetClassId, + ConfigurationVersionDataType configurationVersion) { + this.namespaces = namespaces; + this.structureDataTypes = structureDataTypes; + this.enumDataTypes = enumDataTypes; + this.simpleDataTypes = simpleDataTypes; + this.name = name; + this.description = description; + this.fields = fields; + this.dataSetClassId = dataSetClassId; + this.configurationVersion = configurationVersion; + } + + public DataSetMetaDataType build() { + DataSetMetaDataType dataSetMetaDataType = + new DataSetMetaDataType( + namespaces, + structureDataTypes, + enumDataTypes, + simpleDataTypes, + name, + description, + fields, + dataSetClassId, + configurationVersion); + return dataSetMetaDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DataSetMetaDataType)) { + return false; + } + DataSetMetaDataType that = (DataSetMetaDataType) o; + return (getNamespaces() == that.getNamespaces()) + && (getStructureDataTypes() == that.getStructureDataTypes()) + && (getEnumDataTypes() == that.getEnumDataTypes()) + && (getSimpleDataTypes() == that.getSimpleDataTypes()) + && (getName() == that.getName()) + && (getDescription() == that.getDescription()) + && (getFields() == that.getFields()) + && (getDataSetClassId() == that.getDataSetClassId()) + && (getConfigurationVersion() == that.getConfigurationVersion()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getNamespaces(), + getStructureDataTypes(), + getEnumDataTypes(), + getSimpleDataTypes(), + getName(), + getDescription(), + getFields(), + getDataSetClassId(), + getConfigurationVersion()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderDataType.java new file mode 100644 index 00000000000..4ee3f74a49a --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderDataType.java @@ -0,0 +1,619 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DataSetReaderDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15625; + } + + // Properties. + protected final PascalString name; + protected final boolean enabled; + protected final Variant publisherId; + protected final int writerGroupId; + protected final int dataSetWriterId; + protected final DataSetMetaDataType dataSetMetaData; + protected final DataSetFieldContentMask dataSetFieldContentMask; + protected final double messageReceiveTimeout; + protected final long keyFrameCount; + protected final PascalString headerLayoutUri; + protected final MessageSecurityMode securityMode; + protected final PascalString securityGroupId; + protected final List securityKeyServices; + protected final List dataSetReaderProperties; + protected final ExtensionObject transportSettings; + protected final ExtensionObject messageSettings; + protected final ExtensionObject subscribedDataSet; + + public DataSetReaderDataType( + PascalString name, + boolean enabled, + Variant publisherId, + int writerGroupId, + int dataSetWriterId, + DataSetMetaDataType dataSetMetaData, + DataSetFieldContentMask dataSetFieldContentMask, + double messageReceiveTimeout, + long keyFrameCount, + PascalString headerLayoutUri, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + List dataSetReaderProperties, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + ExtensionObject subscribedDataSet) { + super(); + this.name = name; + this.enabled = enabled; + this.publisherId = publisherId; + this.writerGroupId = writerGroupId; + this.dataSetWriterId = dataSetWriterId; + this.dataSetMetaData = dataSetMetaData; + this.dataSetFieldContentMask = dataSetFieldContentMask; + this.messageReceiveTimeout = messageReceiveTimeout; + this.keyFrameCount = keyFrameCount; + this.headerLayoutUri = headerLayoutUri; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.dataSetReaderProperties = dataSetReaderProperties; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.subscribedDataSet = subscribedDataSet; + } + + public PascalString getName() { + return name; + } + + public boolean getEnabled() { + return enabled; + } + + public Variant getPublisherId() { + return publisherId; + } + + public int getWriterGroupId() { + return writerGroupId; + } + + public int getDataSetWriterId() { + return dataSetWriterId; + } + + public DataSetMetaDataType getDataSetMetaData() { + return dataSetMetaData; + } + + public DataSetFieldContentMask getDataSetFieldContentMask() { + return dataSetFieldContentMask; + } + + public double getMessageReceiveTimeout() { + return messageReceiveTimeout; + } + + public long getKeyFrameCount() { + return keyFrameCount; + } + + public PascalString getHeaderLayoutUri() { + return headerLayoutUri; + } + + public MessageSecurityMode getSecurityMode() { + return securityMode; + } + + public PascalString getSecurityGroupId() { + return securityGroupId; + } + + public List getSecurityKeyServices() { + return securityKeyServices; + } + + public List getDataSetReaderProperties() { + return dataSetReaderProperties; + } + + public ExtensionObject getTransportSettings() { + return transportSettings; + } + + public ExtensionObject getMessageSettings() { + return messageSettings; + } + + public ExtensionObject getSubscribedDataSet() { + return subscribedDataSet; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DataSetReaderDataType"); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (enabled) + writeSimpleField("enabled", enabled, writeBoolean(writeBuffer)); + + // Simple Field (publisherId) + writeSimpleField("publisherId", publisherId, writeComplex(writeBuffer)); + + // Simple Field (writerGroupId) + writeSimpleField("writerGroupId", writerGroupId, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (dataSetWriterId) + writeSimpleField("dataSetWriterId", dataSetWriterId, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (dataSetMetaData) + writeSimpleField("dataSetMetaData", dataSetMetaData, writeComplex(writeBuffer)); + + // Simple Field (dataSetFieldContentMask) + writeSimpleEnumField( + "dataSetFieldContentMask", + "DataSetFieldContentMask", + dataSetFieldContentMask, + writeEnum( + DataSetFieldContentMask::getValue, + DataSetFieldContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (messageReceiveTimeout) + writeSimpleField("messageReceiveTimeout", messageReceiveTimeout, writeDouble(writeBuffer, 64)); + + // Simple Field (keyFrameCount) + writeSimpleField("keyFrameCount", keyFrameCount, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (headerLayoutUri) + writeSimpleField("headerLayoutUri", headerLayoutUri, writeComplex(writeBuffer)); + + // Simple Field (securityMode) + writeSimpleEnumField( + "securityMode", + "MessageSecurityMode", + securityMode, + writeEnum( + MessageSecurityMode::getValue, + MessageSecurityMode::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (securityGroupId) + writeSimpleField("securityGroupId", securityGroupId, writeComplex(writeBuffer)); + + // Implicit Field (noOfSecurityKeyServices) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSecurityKeyServices = + (int) ((((getSecurityKeyServices()) == (null)) ? -(1) : COUNT(getSecurityKeyServices()))); + writeImplicitField( + "noOfSecurityKeyServices", noOfSecurityKeyServices, writeSignedInt(writeBuffer, 32)); + + // Array Field (securityKeyServices) + writeComplexTypeArrayField("securityKeyServices", securityKeyServices, writeBuffer); + + // Implicit Field (noOfDataSetReaderProperties) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfDataSetReaderProperties = + (int) + ((((getDataSetReaderProperties()) == (null)) + ? -(1) + : COUNT(getDataSetReaderProperties()))); + writeImplicitField( + "noOfDataSetReaderProperties", + noOfDataSetReaderProperties, + writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetReaderProperties) + writeComplexTypeArrayField("dataSetReaderProperties", dataSetReaderProperties, writeBuffer); + + // Simple Field (transportSettings) + writeSimpleField("transportSettings", transportSettings, writeComplex(writeBuffer)); + + // Simple Field (messageSettings) + writeSimpleField("messageSettings", messageSettings, writeComplex(writeBuffer)); + + // Simple Field (subscribedDataSet) + writeSimpleField("subscribedDataSet", subscribedDataSet, writeComplex(writeBuffer)); + + writeBuffer.popContext("DataSetReaderDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DataSetReaderDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (enabled) + lengthInBits += 1; + + // Simple field (publisherId) + lengthInBits += publisherId.getLengthInBits(); + + // Simple field (writerGroupId) + lengthInBits += 16; + + // Simple field (dataSetWriterId) + lengthInBits += 16; + + // Simple field (dataSetMetaData) + lengthInBits += dataSetMetaData.getLengthInBits(); + + // Simple field (dataSetFieldContentMask) + lengthInBits += 32; + + // Simple field (messageReceiveTimeout) + lengthInBits += 64; + + // Simple field (keyFrameCount) + lengthInBits += 32; + + // Simple field (headerLayoutUri) + lengthInBits += headerLayoutUri.getLengthInBits(); + + // Simple field (securityMode) + lengthInBits += 32; + + // Simple field (securityGroupId) + lengthInBits += securityGroupId.getLengthInBits(); + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32; + + // Array field + if (securityKeyServices != null) { + int i = 0; + for (EndpointDescription element : securityKeyServices) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= securityKeyServices.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfDataSetReaderProperties) + lengthInBits += 32; + + // Array field + if (dataSetReaderProperties != null) { + int i = 0; + for (KeyValuePair element : dataSetReaderProperties) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetReaderProperties.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (transportSettings) + lengthInBits += transportSettings.getLengthInBits(); + + // Simple field (messageSettings) + lengthInBits += messageSettings.getLengthInBits(); + + // Simple field (subscribedDataSet) + lengthInBits += subscribedDataSet.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DataSetReaderDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean enabled = readSimpleField("enabled", readBoolean(readBuffer)); + + Variant publisherId = + readSimpleField( + "publisherId", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + int writerGroupId = readSimpleField("writerGroupId", readUnsignedInt(readBuffer, 16)); + + int dataSetWriterId = readSimpleField("dataSetWriterId", readUnsignedInt(readBuffer, 16)); + + DataSetMetaDataType dataSetMetaData = + readSimpleField( + "dataSetMetaData", + readComplex( + () -> + (DataSetMetaDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14525)), + readBuffer)); + + DataSetFieldContentMask dataSetFieldContentMask = + readEnumField( + "dataSetFieldContentMask", + "DataSetFieldContentMask", + readEnum(DataSetFieldContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + double messageReceiveTimeout = + readSimpleField("messageReceiveTimeout", readDouble(readBuffer, 64)); + + long keyFrameCount = readSimpleField("keyFrameCount", readUnsignedLong(readBuffer, 32)); + + PascalString headerLayoutUri = + readSimpleField( + "headerLayoutUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + MessageSecurityMode securityMode = + readEnumField( + "securityMode", + "MessageSecurityMode", + readEnum(MessageSecurityMode::enumForValue, readUnsignedLong(readBuffer, 32))); + + PascalString securityGroupId = + readSimpleField( + "securityGroupId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfSecurityKeyServices = + readImplicitField("noOfSecurityKeyServices", readSignedInt(readBuffer, 32)); + + List securityKeyServices = + readCountArrayField( + "securityKeyServices", + readComplex( + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), + readBuffer), + noOfSecurityKeyServices); + + int noOfDataSetReaderProperties = + readImplicitField("noOfDataSetReaderProperties", readSignedInt(readBuffer, 32)); + + List dataSetReaderProperties = + readCountArrayField( + "dataSetReaderProperties", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfDataSetReaderProperties); + + ExtensionObject transportSettings = + readSimpleField( + "transportSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + ExtensionObject messageSettings = + readSimpleField( + "messageSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + ExtensionObject subscribedDataSet = + readSimpleField( + "subscribedDataSet", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + readBuffer.closeContext("DataSetReaderDataType"); + // Create the instance + return new DataSetReaderDataTypeBuilderImpl( + name, + enabled, + publisherId, + writerGroupId, + dataSetWriterId, + dataSetMetaData, + dataSetFieldContentMask, + messageReceiveTimeout, + keyFrameCount, + headerLayoutUri, + securityMode, + securityGroupId, + securityKeyServices, + dataSetReaderProperties, + transportSettings, + messageSettings, + subscribedDataSet); + } + + public static class DataSetReaderDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString name; + private final boolean enabled; + private final Variant publisherId; + private final int writerGroupId; + private final int dataSetWriterId; + private final DataSetMetaDataType dataSetMetaData; + private final DataSetFieldContentMask dataSetFieldContentMask; + private final double messageReceiveTimeout; + private final long keyFrameCount; + private final PascalString headerLayoutUri; + private final MessageSecurityMode securityMode; + private final PascalString securityGroupId; + private final List securityKeyServices; + private final List dataSetReaderProperties; + private final ExtensionObject transportSettings; + private final ExtensionObject messageSettings; + private final ExtensionObject subscribedDataSet; + + public DataSetReaderDataTypeBuilderImpl( + PascalString name, + boolean enabled, + Variant publisherId, + int writerGroupId, + int dataSetWriterId, + DataSetMetaDataType dataSetMetaData, + DataSetFieldContentMask dataSetFieldContentMask, + double messageReceiveTimeout, + long keyFrameCount, + PascalString headerLayoutUri, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + List dataSetReaderProperties, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + ExtensionObject subscribedDataSet) { + this.name = name; + this.enabled = enabled; + this.publisherId = publisherId; + this.writerGroupId = writerGroupId; + this.dataSetWriterId = dataSetWriterId; + this.dataSetMetaData = dataSetMetaData; + this.dataSetFieldContentMask = dataSetFieldContentMask; + this.messageReceiveTimeout = messageReceiveTimeout; + this.keyFrameCount = keyFrameCount; + this.headerLayoutUri = headerLayoutUri; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.dataSetReaderProperties = dataSetReaderProperties; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.subscribedDataSet = subscribedDataSet; + } + + public DataSetReaderDataType build() { + DataSetReaderDataType dataSetReaderDataType = + new DataSetReaderDataType( + name, + enabled, + publisherId, + writerGroupId, + dataSetWriterId, + dataSetMetaData, + dataSetFieldContentMask, + messageReceiveTimeout, + keyFrameCount, + headerLayoutUri, + securityMode, + securityGroupId, + securityKeyServices, + dataSetReaderProperties, + transportSettings, + messageSettings, + subscribedDataSet); + return dataSetReaderDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DataSetReaderDataType)) { + return false; + } + DataSetReaderDataType that = (DataSetReaderDataType) o; + return (getName() == that.getName()) + && (getEnabled() == that.getEnabled()) + && (getPublisherId() == that.getPublisherId()) + && (getWriterGroupId() == that.getWriterGroupId()) + && (getDataSetWriterId() == that.getDataSetWriterId()) + && (getDataSetMetaData() == that.getDataSetMetaData()) + && (getDataSetFieldContentMask() == that.getDataSetFieldContentMask()) + && (getMessageReceiveTimeout() == that.getMessageReceiveTimeout()) + && (getKeyFrameCount() == that.getKeyFrameCount()) + && (getHeaderLayoutUri() == that.getHeaderLayoutUri()) + && (getSecurityMode() == that.getSecurityMode()) + && (getSecurityGroupId() == that.getSecurityGroupId()) + && (getSecurityKeyServices() == that.getSecurityKeyServices()) + && (getDataSetReaderProperties() == that.getDataSetReaderProperties()) + && (getTransportSettings() == that.getTransportSettings()) + && (getMessageSettings() == that.getMessageSettings()) + && (getSubscribedDataSet() == that.getSubscribedDataSet()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getName(), + getEnabled(), + getPublisherId(), + getWriterGroupId(), + getDataSetWriterId(), + getDataSetMetaData(), + getDataSetFieldContentMask(), + getMessageReceiveTimeout(), + getKeyFrameCount(), + getHeaderLayoutUri(), + getSecurityMode(), + getSecurityGroupId(), + getSecurityKeyServices(), + getDataSetReaderProperties(), + getTransportSettings(), + getMessageSettings(), + getSubscribedDataSet()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderMessageDataType.java index d320697f69c..c58feef271f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderMessageDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderMessageDataType.java @@ -38,8 +38,8 @@ public class DataSetReaderMessageDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15631"; + public Integer getExtensionId() { + return (int) 15631; } public DataSetReaderMessageDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataSetReaderMessageDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderTransportDataType.java index 33b469c5277..e514cbda075 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderTransportDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetReaderTransportDataType.java @@ -38,8 +38,8 @@ public class DataSetReaderTransportDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15630"; + public Integer getExtensionId() { + return (int) 15630; } public DataSetReaderTransportDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataSetReaderTransportDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterDataType.java index 916e3153386..8d95059485a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterDataType.java @@ -38,8 +38,8 @@ public class DataSetWriterDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15599"; + public Integer getExtensionId() { + return (int) 15599; } // Properties. @@ -49,8 +49,7 @@ public String getIdentifier() { protected final DataSetFieldContentMask dataSetFieldContentMask; protected final long keyFrameCount; protected final PascalString dataSetName; - protected final int noOfDataSetWriterProperties; - protected final List dataSetWriterProperties; + protected final List dataSetWriterProperties; protected final ExtensionObject transportSettings; protected final ExtensionObject messageSettings; @@ -61,8 +60,7 @@ public DataSetWriterDataType( DataSetFieldContentMask dataSetFieldContentMask, long keyFrameCount, PascalString dataSetName, - int noOfDataSetWriterProperties, - List dataSetWriterProperties, + List dataSetWriterProperties, ExtensionObject transportSettings, ExtensionObject messageSettings) { super(); @@ -72,7 +70,6 @@ public DataSetWriterDataType( this.dataSetFieldContentMask = dataSetFieldContentMask; this.keyFrameCount = keyFrameCount; this.dataSetName = dataSetName; - this.noOfDataSetWriterProperties = noOfDataSetWriterProperties; this.dataSetWriterProperties = dataSetWriterProperties; this.transportSettings = transportSettings; this.messageSettings = messageSettings; @@ -102,11 +99,7 @@ public PascalString getDataSetName() { return dataSetName; } - public int getNoOfDataSetWriterProperties() { - return noOfDataSetWriterProperties; - } - - public List getDataSetWriterProperties() { + public List getDataSetWriterProperties() { return dataSetWriterProperties; } @@ -153,8 +146,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (dataSetName) writeSimpleField("dataSetName", dataSetName, writeComplex(writeBuffer)); - // Simple Field (noOfDataSetWriterProperties) - writeSimpleField( + // Implicit Field (noOfDataSetWriterProperties) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfDataSetWriterProperties = + (int) + ((((getDataSetWriterProperties()) == (null)) + ? -(1) + : COUNT(getDataSetWriterProperties()))); + writeImplicitField( "noOfDataSetWriterProperties", noOfDataSetWriterProperties, writeSignedInt(writeBuffer, 32)); @@ -203,13 +202,13 @@ public int getLengthInBits() { // Simple field (dataSetName) lengthInBits += dataSetName.getLengthInBits(); - // Simple field (noOfDataSetWriterProperties) + // Implicit Field (noOfDataSetWriterProperties) lengthInBits += 32; // Array field if (dataSetWriterProperties != null) { int i = 0; - for (ExtensionObjectDefinition element : dataSetWriterProperties) { + for (KeyValuePair element : dataSetWriterProperties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetWriterProperties.size()); lengthInBits += element.getLengthInBits(); } @@ -225,7 +224,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataSetWriterDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -254,13 +253,14 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "dataSetName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfDataSetWriterProperties = - readSimpleField("noOfDataSetWriterProperties", readSignedInt(readBuffer, 32)); + readImplicitField("noOfDataSetWriterProperties", readSignedInt(readBuffer, 32)); - List dataSetWriterProperties = + List dataSetWriterProperties = readCountArrayField( "dataSetWriterProperties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfDataSetWriterProperties); @@ -285,7 +285,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit dataSetFieldContentMask, keyFrameCount, dataSetName, - noOfDataSetWriterProperties, dataSetWriterProperties, transportSettings, messageSettings); @@ -299,8 +298,7 @@ public static class DataSetWriterDataTypeBuilderImpl private final DataSetFieldContentMask dataSetFieldContentMask; private final long keyFrameCount; private final PascalString dataSetName; - private final int noOfDataSetWriterProperties; - private final List dataSetWriterProperties; + private final List dataSetWriterProperties; private final ExtensionObject transportSettings; private final ExtensionObject messageSettings; @@ -311,8 +309,7 @@ public DataSetWriterDataTypeBuilderImpl( DataSetFieldContentMask dataSetFieldContentMask, long keyFrameCount, PascalString dataSetName, - int noOfDataSetWriterProperties, - List dataSetWriterProperties, + List dataSetWriterProperties, ExtensionObject transportSettings, ExtensionObject messageSettings) { this.name = name; @@ -321,7 +318,6 @@ public DataSetWriterDataTypeBuilderImpl( this.dataSetFieldContentMask = dataSetFieldContentMask; this.keyFrameCount = keyFrameCount; this.dataSetName = dataSetName; - this.noOfDataSetWriterProperties = noOfDataSetWriterProperties; this.dataSetWriterProperties = dataSetWriterProperties; this.transportSettings = transportSettings; this.messageSettings = messageSettings; @@ -336,7 +332,6 @@ public DataSetWriterDataType build() { dataSetFieldContentMask, keyFrameCount, dataSetName, - noOfDataSetWriterProperties, dataSetWriterProperties, transportSettings, messageSettings); @@ -359,7 +354,6 @@ public boolean equals(Object o) { && (getDataSetFieldContentMask() == that.getDataSetFieldContentMask()) && (getKeyFrameCount() == that.getKeyFrameCount()) && (getDataSetName() == that.getDataSetName()) - && (getNoOfDataSetWriterProperties() == that.getNoOfDataSetWriterProperties()) && (getDataSetWriterProperties() == that.getDataSetWriterProperties()) && (getTransportSettings() == that.getTransportSettings()) && (getMessageSettings() == that.getMessageSettings()) @@ -377,7 +371,6 @@ public int hashCode() { getDataSetFieldContentMask(), getKeyFrameCount(), getDataSetName(), - getNoOfDataSetWriterProperties(), getDataSetWriterProperties(), getTransportSettings(), getMessageSettings()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterMessageDataType.java index a1ddcf93d80..fc972c0752a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterMessageDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterMessageDataType.java @@ -38,8 +38,8 @@ public class DataSetWriterMessageDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15607"; + public Integer getExtensionId() { + return (int) 15607; } public DataSetWriterMessageDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataSetWriterMessageDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterTransportDataType.java index 49a7d1c181b..04b0192348c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterTransportDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataSetWriterTransportDataType.java @@ -38,8 +38,8 @@ public class DataSetWriterTransportDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15600"; + public Integer getExtensionId() { + return (int) 15600; } public DataSetWriterTransportDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataSetWriterTransportDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeAttributes.java new file mode 100644 index 00000000000..fae4ed2d0f1 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeAttributes.java @@ -0,0 +1,265 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DataTypeAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 372; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final boolean isAbstract; + + public DataTypeAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean isAbstract) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.isAbstract = isAbstract; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public boolean getIsAbstract() { + return isAbstract; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DataTypeAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (isAbstract) + writeSimpleField("isAbstract", isAbstract, writeBoolean(writeBuffer)); + + writeBuffer.popContext("DataTypeAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DataTypeAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (isAbstract) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DataTypeAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean isAbstract = readSimpleField("isAbstract", readBoolean(readBuffer)); + + readBuffer.closeContext("DataTypeAttributes"); + // Create the instance + return new DataTypeAttributesBuilderImpl( + specifiedAttributes, displayName, description, writeMask, userWriteMask, isAbstract); + } + + public static class DataTypeAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final boolean isAbstract; + + public DataTypeAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean isAbstract) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.isAbstract = isAbstract; + } + + public DataTypeAttributes build() { + DataTypeAttributes dataTypeAttributes = + new DataTypeAttributes( + specifiedAttributes, displayName, description, writeMask, userWriteMask, isAbstract); + return dataTypeAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DataTypeAttributes)) { + return false; + } + DataTypeAttributes that = (DataTypeAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getIsAbstract() == that.getIsAbstract()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getIsAbstract()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDefinition.java index 244a57f7c02..a09b0590046 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDefinition.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDefinition.java @@ -38,8 +38,8 @@ public class DataTypeDefinition extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "99"; + public Integer getExtensionId() { + return (int) 99; } public DataTypeDefinition() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataTypeDefinition"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDescription.java index a330a3c47c2..2a91823b2e1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeDescription.java @@ -38,8 +38,8 @@ public class DataTypeDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14527"; + public Integer getExtensionId() { + return (int) 14527; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataTypeDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeSchemaHeader.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeSchemaHeader.java index d5db026bc1f..274ea8667f2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeSchemaHeader.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DataTypeSchemaHeader.java @@ -38,69 +38,41 @@ public class DataTypeSchemaHeader extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15536"; + public Integer getExtensionId() { + return (int) 15536; } // Properties. - protected final int noOfNamespaces; protected final List namespaces; - protected final int noOfStructureDataTypes; - protected final List structureDataTypes; - protected final int noOfEnumDataTypes; - protected final List enumDataTypes; - protected final int noOfSimpleDataTypes; - protected final List simpleDataTypes; + protected final List structureDataTypes; + protected final List enumDataTypes; + protected final List simpleDataTypes; public DataTypeSchemaHeader( - int noOfNamespaces, List namespaces, - int noOfStructureDataTypes, - List structureDataTypes, - int noOfEnumDataTypes, - List enumDataTypes, - int noOfSimpleDataTypes, - List simpleDataTypes) { + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes) { super(); - this.noOfNamespaces = noOfNamespaces; this.namespaces = namespaces; - this.noOfStructureDataTypes = noOfStructureDataTypes; this.structureDataTypes = structureDataTypes; - this.noOfEnumDataTypes = noOfEnumDataTypes; this.enumDataTypes = enumDataTypes; - this.noOfSimpleDataTypes = noOfSimpleDataTypes; this.simpleDataTypes = simpleDataTypes; } - public int getNoOfNamespaces() { - return noOfNamespaces; - } - public List getNamespaces() { return namespaces; } - public int getNoOfStructureDataTypes() { - return noOfStructureDataTypes; - } - - public List getStructureDataTypes() { + public List getStructureDataTypes() { return structureDataTypes; } - public int getNoOfEnumDataTypes() { - return noOfEnumDataTypes; - } - - public List getEnumDataTypes() { + public List getEnumDataTypes() { return enumDataTypes; } - public int getNoOfSimpleDataTypes() { - return noOfSimpleDataTypes; - } - - public List getSimpleDataTypes() { + public List getSimpleDataTypes() { return simpleDataTypes; } @@ -111,27 +83,38 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("DataTypeSchemaHeader"); - // Simple Field (noOfNamespaces) - writeSimpleField("noOfNamespaces", noOfNamespaces, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNamespaces) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNamespaces = (int) ((((getNamespaces()) == (null)) ? -(1) : COUNT(getNamespaces()))); + writeImplicitField("noOfNamespaces", noOfNamespaces, writeSignedInt(writeBuffer, 32)); // Array Field (namespaces) writeComplexTypeArrayField("namespaces", namespaces, writeBuffer); - // Simple Field (noOfStructureDataTypes) - writeSimpleField( + // Implicit Field (noOfStructureDataTypes) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfStructureDataTypes = + (int) ((((getStructureDataTypes()) == (null)) ? -(1) : COUNT(getStructureDataTypes()))); + writeImplicitField( "noOfStructureDataTypes", noOfStructureDataTypes, writeSignedInt(writeBuffer, 32)); // Array Field (structureDataTypes) writeComplexTypeArrayField("structureDataTypes", structureDataTypes, writeBuffer); - // Simple Field (noOfEnumDataTypes) - writeSimpleField("noOfEnumDataTypes", noOfEnumDataTypes, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEnumDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEnumDataTypes = + (int) ((((getEnumDataTypes()) == (null)) ? -(1) : COUNT(getEnumDataTypes()))); + writeImplicitField("noOfEnumDataTypes", noOfEnumDataTypes, writeSignedInt(writeBuffer, 32)); // Array Field (enumDataTypes) writeComplexTypeArrayField("enumDataTypes", enumDataTypes, writeBuffer); - // Simple Field (noOfSimpleDataTypes) - writeSimpleField("noOfSimpleDataTypes", noOfSimpleDataTypes, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfSimpleDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSimpleDataTypes = + (int) ((((getSimpleDataTypes()) == (null)) ? -(1) : COUNT(getSimpleDataTypes()))); + writeImplicitField("noOfSimpleDataTypes", noOfSimpleDataTypes, writeSignedInt(writeBuffer, 32)); // Array Field (simpleDataTypes) writeComplexTypeArrayField("simpleDataTypes", simpleDataTypes, writeBuffer); @@ -150,7 +133,7 @@ public int getLengthInBits() { DataTypeSchemaHeader _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfNamespaces) + // Implicit Field (noOfNamespaces) lengthInBits += 32; // Array field @@ -162,37 +145,37 @@ public int getLengthInBits() { } } - // Simple field (noOfStructureDataTypes) + // Implicit Field (noOfStructureDataTypes) lengthInBits += 32; // Array field if (structureDataTypes != null) { int i = 0; - for (DataTypeDescription element : structureDataTypes) { + for (StructureDescription element : structureDataTypes) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= structureDataTypes.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfEnumDataTypes) + // Implicit Field (noOfEnumDataTypes) lengthInBits += 32; // Array field if (enumDataTypes != null) { int i = 0; - for (DataTypeDescription element : enumDataTypes) { + for (EnumDescription element : enumDataTypes) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= enumDataTypes.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfSimpleDataTypes) + // Implicit Field (noOfSimpleDataTypes) lengthInBits += 32; // Array field if (simpleDataTypes != null) { int i = 0; - for (DataTypeDescription element : simpleDataTypes) { + for (SimpleTypeDescription element : simpleDataTypes) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= simpleDataTypes.size()); lengthInBits += element.getLengthInBits(); } @@ -202,12 +185,12 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DataTypeSchemaHeader"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfNamespaces = readSimpleField("noOfNamespaces", readSignedInt(readBuffer, 32)); + int noOfNamespaces = readImplicitField("noOfNamespaces", readSignedInt(readBuffer, 32)); List namespaces = readCountArrayField( @@ -216,96 +199,70 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfNamespaces); int noOfStructureDataTypes = - readSimpleField("noOfStructureDataTypes", readSignedInt(readBuffer, 32)); + readImplicitField("noOfStructureDataTypes", readSignedInt(readBuffer, 32)); - List structureDataTypes = + List structureDataTypes = readCountArrayField( "structureDataTypes", readComplex( () -> - (DataTypeDescription) - ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14525")), + (StructureDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15489)), readBuffer), noOfStructureDataTypes); - int noOfEnumDataTypes = readSimpleField("noOfEnumDataTypes", readSignedInt(readBuffer, 32)); + int noOfEnumDataTypes = readImplicitField("noOfEnumDataTypes", readSignedInt(readBuffer, 32)); - List enumDataTypes = + List enumDataTypes = readCountArrayField( "enumDataTypes", readComplex( () -> - (DataTypeDescription) - ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14525")), + (EnumDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15490)), readBuffer), noOfEnumDataTypes); - int noOfSimpleDataTypes = readSimpleField("noOfSimpleDataTypes", readSignedInt(readBuffer, 32)); + int noOfSimpleDataTypes = + readImplicitField("noOfSimpleDataTypes", readSignedInt(readBuffer, 32)); - List simpleDataTypes = + List simpleDataTypes = readCountArrayField( "simpleDataTypes", readComplex( () -> - (DataTypeDescription) - ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14525")), + (SimpleTypeDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15007)), readBuffer), noOfSimpleDataTypes); readBuffer.closeContext("DataTypeSchemaHeader"); // Create the instance return new DataTypeSchemaHeaderBuilderImpl( - noOfNamespaces, - namespaces, - noOfStructureDataTypes, - structureDataTypes, - noOfEnumDataTypes, - enumDataTypes, - noOfSimpleDataTypes, - simpleDataTypes); + namespaces, structureDataTypes, enumDataTypes, simpleDataTypes); } public static class DataTypeSchemaHeaderBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfNamespaces; private final List namespaces; - private final int noOfStructureDataTypes; - private final List structureDataTypes; - private final int noOfEnumDataTypes; - private final List enumDataTypes; - private final int noOfSimpleDataTypes; - private final List simpleDataTypes; + private final List structureDataTypes; + private final List enumDataTypes; + private final List simpleDataTypes; public DataTypeSchemaHeaderBuilderImpl( - int noOfNamespaces, List namespaces, - int noOfStructureDataTypes, - List structureDataTypes, - int noOfEnumDataTypes, - List enumDataTypes, - int noOfSimpleDataTypes, - List simpleDataTypes) { - this.noOfNamespaces = noOfNamespaces; + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes) { this.namespaces = namespaces; - this.noOfStructureDataTypes = noOfStructureDataTypes; this.structureDataTypes = structureDataTypes; - this.noOfEnumDataTypes = noOfEnumDataTypes; this.enumDataTypes = enumDataTypes; - this.noOfSimpleDataTypes = noOfSimpleDataTypes; this.simpleDataTypes = simpleDataTypes; } public DataTypeSchemaHeader build() { DataTypeSchemaHeader dataTypeSchemaHeader = - new DataTypeSchemaHeader( - noOfNamespaces, - namespaces, - noOfStructureDataTypes, - structureDataTypes, - noOfEnumDataTypes, - enumDataTypes, - noOfSimpleDataTypes, - simpleDataTypes); + new DataTypeSchemaHeader(namespaces, structureDataTypes, enumDataTypes, simpleDataTypes); return dataTypeSchemaHeader; } } @@ -319,13 +276,9 @@ public boolean equals(Object o) { return false; } DataTypeSchemaHeader that = (DataTypeSchemaHeader) o; - return (getNoOfNamespaces() == that.getNoOfNamespaces()) - && (getNamespaces() == that.getNamespaces()) - && (getNoOfStructureDataTypes() == that.getNoOfStructureDataTypes()) + return (getNamespaces() == that.getNamespaces()) && (getStructureDataTypes() == that.getStructureDataTypes()) - && (getNoOfEnumDataTypes() == that.getNoOfEnumDataTypes()) && (getEnumDataTypes() == that.getEnumDataTypes()) - && (getNoOfSimpleDataTypes() == that.getNoOfSimpleDataTypes()) && (getSimpleDataTypes() == that.getSimpleDataTypes()) && super.equals(that) && true; @@ -335,13 +288,9 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( super.hashCode(), - getNoOfNamespaces(), getNamespaces(), - getNoOfStructureDataTypes(), getStructureDataTypes(), - getNoOfEnumDataTypes(), getEnumDataTypes(), - getNoOfSimpleDataTypes(), getSimpleDataTypes()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransport2DataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransport2DataType.java new file mode 100644 index 00000000000..92f53d246ea --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransport2DataType.java @@ -0,0 +1,266 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DatagramConnectionTransport2DataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23614; + } + + // Properties. + protected final ExtensionObject discoveryAddress; + protected final long discoveryAnnounceRate; + protected final long discoveryMaxMessageSize; + protected final PascalString qosCategory; + protected final List datagramQos; + + public DatagramConnectionTransport2DataType( + ExtensionObject discoveryAddress, + long discoveryAnnounceRate, + long discoveryMaxMessageSize, + PascalString qosCategory, + List datagramQos) { + super(); + this.discoveryAddress = discoveryAddress; + this.discoveryAnnounceRate = discoveryAnnounceRate; + this.discoveryMaxMessageSize = discoveryMaxMessageSize; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + } + + public ExtensionObject getDiscoveryAddress() { + return discoveryAddress; + } + + public long getDiscoveryAnnounceRate() { + return discoveryAnnounceRate; + } + + public long getDiscoveryMaxMessageSize() { + return discoveryMaxMessageSize; + } + + public PascalString getQosCategory() { + return qosCategory; + } + + public List getDatagramQos() { + return datagramQos; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DatagramConnectionTransport2DataType"); + + // Simple Field (discoveryAddress) + writeSimpleField("discoveryAddress", discoveryAddress, writeComplex(writeBuffer)); + + // Simple Field (discoveryAnnounceRate) + writeSimpleField( + "discoveryAnnounceRate", discoveryAnnounceRate, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (discoveryMaxMessageSize) + writeSimpleField( + "discoveryMaxMessageSize", discoveryMaxMessageSize, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (qosCategory) + writeSimpleField("qosCategory", qosCategory, writeComplex(writeBuffer)); + + // Implicit Field (noOfDatagramQos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDatagramQos = (int) ((((getDatagramQos()) == (null)) ? -(1) : COUNT(getDatagramQos()))); + writeImplicitField("noOfDatagramQos", noOfDatagramQos, writeSignedInt(writeBuffer, 32)); + + // Array Field (datagramQos) + writeComplexTypeArrayField("datagramQos", datagramQos, writeBuffer); + + writeBuffer.popContext("DatagramConnectionTransport2DataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DatagramConnectionTransport2DataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (discoveryAddress) + lengthInBits += discoveryAddress.getLengthInBits(); + + // Simple field (discoveryAnnounceRate) + lengthInBits += 32; + + // Simple field (discoveryMaxMessageSize) + lengthInBits += 32; + + // Simple field (qosCategory) + lengthInBits += qosCategory.getLengthInBits(); + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32; + + // Array field + if (datagramQos != null) { + int i = 0; + for (ExtensionObject element : datagramQos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= datagramQos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DatagramConnectionTransport2DataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + ExtensionObject discoveryAddress = + readSimpleField( + "discoveryAddress", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + long discoveryAnnounceRate = + readSimpleField("discoveryAnnounceRate", readUnsignedLong(readBuffer, 32)); + + long discoveryMaxMessageSize = + readSimpleField("discoveryMaxMessageSize", readUnsignedLong(readBuffer, 32)); + + PascalString qosCategory = + readSimpleField( + "qosCategory", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfDatagramQos = readImplicitField("noOfDatagramQos", readSignedInt(readBuffer, 32)); + + List datagramQos = + readCountArrayField( + "datagramQos", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer), + noOfDatagramQos); + + readBuffer.closeContext("DatagramConnectionTransport2DataType"); + // Create the instance + return new DatagramConnectionTransport2DataTypeBuilderImpl( + discoveryAddress, discoveryAnnounceRate, discoveryMaxMessageSize, qosCategory, datagramQos); + } + + public static class DatagramConnectionTransport2DataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final ExtensionObject discoveryAddress; + private final long discoveryAnnounceRate; + private final long discoveryMaxMessageSize; + private final PascalString qosCategory; + private final List datagramQos; + + public DatagramConnectionTransport2DataTypeBuilderImpl( + ExtensionObject discoveryAddress, + long discoveryAnnounceRate, + long discoveryMaxMessageSize, + PascalString qosCategory, + List datagramQos) { + this.discoveryAddress = discoveryAddress; + this.discoveryAnnounceRate = discoveryAnnounceRate; + this.discoveryMaxMessageSize = discoveryMaxMessageSize; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + } + + public DatagramConnectionTransport2DataType build() { + DatagramConnectionTransport2DataType datagramConnectionTransport2DataType = + new DatagramConnectionTransport2DataType( + discoveryAddress, + discoveryAnnounceRate, + discoveryMaxMessageSize, + qosCategory, + datagramQos); + return datagramConnectionTransport2DataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DatagramConnectionTransport2DataType)) { + return false; + } + DatagramConnectionTransport2DataType that = (DatagramConnectionTransport2DataType) o; + return (getDiscoveryAddress() == that.getDiscoveryAddress()) + && (getDiscoveryAnnounceRate() == that.getDiscoveryAnnounceRate()) + && (getDiscoveryMaxMessageSize() == that.getDiscoveryMaxMessageSize()) + && (getQosCategory() == that.getQosCategory()) + && (getDatagramQos() == that.getDatagramQos()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getDiscoveryAddress(), + getDiscoveryAnnounceRate(), + getDiscoveryMaxMessageSize(), + getQosCategory(), + getDatagramQos()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransportDataType.java new file mode 100644 index 00000000000..8f503d97c41 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramConnectionTransportDataType.java @@ -0,0 +1,147 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DatagramConnectionTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 17469; + } + + // Properties. + protected final ExtensionObject discoveryAddress; + + public DatagramConnectionTransportDataType(ExtensionObject discoveryAddress) { + super(); + this.discoveryAddress = discoveryAddress; + } + + public ExtensionObject getDiscoveryAddress() { + return discoveryAddress; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DatagramConnectionTransportDataType"); + + // Simple Field (discoveryAddress) + writeSimpleField("discoveryAddress", discoveryAddress, writeComplex(writeBuffer)); + + writeBuffer.popContext("DatagramConnectionTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DatagramConnectionTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (discoveryAddress) + lengthInBits += discoveryAddress.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DatagramConnectionTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + ExtensionObject discoveryAddress = + readSimpleField( + "discoveryAddress", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + readBuffer.closeContext("DatagramConnectionTransportDataType"); + // Create the instance + return new DatagramConnectionTransportDataTypeBuilderImpl(discoveryAddress); + } + + public static class DatagramConnectionTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final ExtensionObject discoveryAddress; + + public DatagramConnectionTransportDataTypeBuilderImpl(ExtensionObject discoveryAddress) { + this.discoveryAddress = discoveryAddress; + } + + public DatagramConnectionTransportDataType build() { + DatagramConnectionTransportDataType datagramConnectionTransportDataType = + new DatagramConnectionTransportDataType(discoveryAddress); + return datagramConnectionTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DatagramConnectionTransportDataType)) { + return false; + } + DatagramConnectionTransportDataType that = (DatagramConnectionTransportDataType) o; + return (getDiscoveryAddress() == that.getDiscoveryAddress()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getDiscoveryAddress()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramDataSetReaderTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramDataSetReaderTransportDataType.java new file mode 100644 index 00000000000..6339e09bb35 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramDataSetReaderTransportDataType.java @@ -0,0 +1,235 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DatagramDataSetReaderTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23616; + } + + // Properties. + protected final ExtensionObject address; + protected final PascalString qosCategory; + protected final List datagramQos; + protected final PascalString topic; + + public DatagramDataSetReaderTransportDataType( + ExtensionObject address, + PascalString qosCategory, + List datagramQos, + PascalString topic) { + super(); + this.address = address; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + this.topic = topic; + } + + public ExtensionObject getAddress() { + return address; + } + + public PascalString getQosCategory() { + return qosCategory; + } + + public List getDatagramQos() { + return datagramQos; + } + + public PascalString getTopic() { + return topic; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DatagramDataSetReaderTransportDataType"); + + // Simple Field (address) + writeSimpleField("address", address, writeComplex(writeBuffer)); + + // Simple Field (qosCategory) + writeSimpleField("qosCategory", qosCategory, writeComplex(writeBuffer)); + + // Implicit Field (noOfDatagramQos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDatagramQos = (int) ((((getDatagramQos()) == (null)) ? -(1) : COUNT(getDatagramQos()))); + writeImplicitField("noOfDatagramQos", noOfDatagramQos, writeSignedInt(writeBuffer, 32)); + + // Array Field (datagramQos) + writeComplexTypeArrayField("datagramQos", datagramQos, writeBuffer); + + // Simple Field (topic) + writeSimpleField("topic", topic, writeComplex(writeBuffer)); + + writeBuffer.popContext("DatagramDataSetReaderTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DatagramDataSetReaderTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (address) + lengthInBits += address.getLengthInBits(); + + // Simple field (qosCategory) + lengthInBits += qosCategory.getLengthInBits(); + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32; + + // Array field + if (datagramQos != null) { + int i = 0; + for (ExtensionObject element : datagramQos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= datagramQos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (topic) + lengthInBits += topic.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DatagramDataSetReaderTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + ExtensionObject address = + readSimpleField( + "address", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + PascalString qosCategory = + readSimpleField( + "qosCategory", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfDatagramQos = readImplicitField("noOfDatagramQos", readSignedInt(readBuffer, 32)); + + List datagramQos = + readCountArrayField( + "datagramQos", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer), + noOfDatagramQos); + + PascalString topic = + readSimpleField( + "topic", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("DatagramDataSetReaderTransportDataType"); + // Create the instance + return new DatagramDataSetReaderTransportDataTypeBuilderImpl( + address, qosCategory, datagramQos, topic); + } + + public static class DatagramDataSetReaderTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final ExtensionObject address; + private final PascalString qosCategory; + private final List datagramQos; + private final PascalString topic; + + public DatagramDataSetReaderTransportDataTypeBuilderImpl( + ExtensionObject address, + PascalString qosCategory, + List datagramQos, + PascalString topic) { + this.address = address; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + this.topic = topic; + } + + public DatagramDataSetReaderTransportDataType build() { + DatagramDataSetReaderTransportDataType datagramDataSetReaderTransportDataType = + new DatagramDataSetReaderTransportDataType(address, qosCategory, datagramQos, topic); + return datagramDataSetReaderTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DatagramDataSetReaderTransportDataType)) { + return false; + } + DatagramDataSetReaderTransportDataType that = (DatagramDataSetReaderTransportDataType) o; + return (getAddress() == that.getAddress()) + && (getQosCategory() == that.getQosCategory()) + && (getDatagramQos() == that.getDatagramQos()) + && (getTopic() == that.getTopic()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getAddress(), getQosCategory(), getDatagramQos(), getTopic()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransport2DataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransport2DataType.java new file mode 100644 index 00000000000..7be188694be --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransport2DataType.java @@ -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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DatagramWriterGroupTransport2DataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23615; + } + + // Properties. + protected final short messageRepeatCount; + protected final double messageRepeatDelay; + protected final ExtensionObject address; + protected final PascalString qosCategory; + protected final List datagramQos; + protected final long discoveryAnnounceRate; + protected final PascalString topic; + + public DatagramWriterGroupTransport2DataType( + short messageRepeatCount, + double messageRepeatDelay, + ExtensionObject address, + PascalString qosCategory, + List datagramQos, + long discoveryAnnounceRate, + PascalString topic) { + super(); + this.messageRepeatCount = messageRepeatCount; + this.messageRepeatDelay = messageRepeatDelay; + this.address = address; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + this.discoveryAnnounceRate = discoveryAnnounceRate; + this.topic = topic; + } + + public short getMessageRepeatCount() { + return messageRepeatCount; + } + + public double getMessageRepeatDelay() { + return messageRepeatDelay; + } + + public ExtensionObject getAddress() { + return address; + } + + public PascalString getQosCategory() { + return qosCategory; + } + + public List getDatagramQos() { + return datagramQos; + } + + public long getDiscoveryAnnounceRate() { + return discoveryAnnounceRate; + } + + public PascalString getTopic() { + return topic; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DatagramWriterGroupTransport2DataType"); + + // Simple Field (messageRepeatCount) + writeSimpleField("messageRepeatCount", messageRepeatCount, writeUnsignedShort(writeBuffer, 8)); + + // Simple Field (messageRepeatDelay) + writeSimpleField("messageRepeatDelay", messageRepeatDelay, writeDouble(writeBuffer, 64)); + + // Simple Field (address) + writeSimpleField("address", address, writeComplex(writeBuffer)); + + // Simple Field (qosCategory) + writeSimpleField("qosCategory", qosCategory, writeComplex(writeBuffer)); + + // Implicit Field (noOfDatagramQos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDatagramQos = (int) ((((getDatagramQos()) == (null)) ? -(1) : COUNT(getDatagramQos()))); + writeImplicitField("noOfDatagramQos", noOfDatagramQos, writeSignedInt(writeBuffer, 32)); + + // Array Field (datagramQos) + writeComplexTypeArrayField("datagramQos", datagramQos, writeBuffer); + + // Simple Field (discoveryAnnounceRate) + writeSimpleField( + "discoveryAnnounceRate", discoveryAnnounceRate, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (topic) + writeSimpleField("topic", topic, writeComplex(writeBuffer)); + + writeBuffer.popContext("DatagramWriterGroupTransport2DataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DatagramWriterGroupTransport2DataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (messageRepeatCount) + lengthInBits += 8; + + // Simple field (messageRepeatDelay) + lengthInBits += 64; + + // Simple field (address) + lengthInBits += address.getLengthInBits(); + + // Simple field (qosCategory) + lengthInBits += qosCategory.getLengthInBits(); + + // Implicit Field (noOfDatagramQos) + lengthInBits += 32; + + // Array field + if (datagramQos != null) { + int i = 0; + for (ExtensionObject element : datagramQos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= datagramQos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (discoveryAnnounceRate) + lengthInBits += 32; + + // Simple field (topic) + lengthInBits += topic.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DatagramWriterGroupTransport2DataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + short messageRepeatCount = + readSimpleField("messageRepeatCount", readUnsignedShort(readBuffer, 8)); + + double messageRepeatDelay = readSimpleField("messageRepeatDelay", readDouble(readBuffer, 64)); + + ExtensionObject address = + readSimpleField( + "address", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + PascalString qosCategory = + readSimpleField( + "qosCategory", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfDatagramQos = readImplicitField("noOfDatagramQos", readSignedInt(readBuffer, 32)); + + List datagramQos = + readCountArrayField( + "datagramQos", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer), + noOfDatagramQos); + + long discoveryAnnounceRate = + readSimpleField("discoveryAnnounceRate", readUnsignedLong(readBuffer, 32)); + + PascalString topic = + readSimpleField( + "topic", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("DatagramWriterGroupTransport2DataType"); + // Create the instance + return new DatagramWriterGroupTransport2DataTypeBuilderImpl( + messageRepeatCount, + messageRepeatDelay, + address, + qosCategory, + datagramQos, + discoveryAnnounceRate, + topic); + } + + public static class DatagramWriterGroupTransport2DataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final short messageRepeatCount; + private final double messageRepeatDelay; + private final ExtensionObject address; + private final PascalString qosCategory; + private final List datagramQos; + private final long discoveryAnnounceRate; + private final PascalString topic; + + public DatagramWriterGroupTransport2DataTypeBuilderImpl( + short messageRepeatCount, + double messageRepeatDelay, + ExtensionObject address, + PascalString qosCategory, + List datagramQos, + long discoveryAnnounceRate, + PascalString topic) { + this.messageRepeatCount = messageRepeatCount; + this.messageRepeatDelay = messageRepeatDelay; + this.address = address; + this.qosCategory = qosCategory; + this.datagramQos = datagramQos; + this.discoveryAnnounceRate = discoveryAnnounceRate; + this.topic = topic; + } + + public DatagramWriterGroupTransport2DataType build() { + DatagramWriterGroupTransport2DataType datagramWriterGroupTransport2DataType = + new DatagramWriterGroupTransport2DataType( + messageRepeatCount, + messageRepeatDelay, + address, + qosCategory, + datagramQos, + discoveryAnnounceRate, + topic); + return datagramWriterGroupTransport2DataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DatagramWriterGroupTransport2DataType)) { + return false; + } + DatagramWriterGroupTransport2DataType that = (DatagramWriterGroupTransport2DataType) o; + return (getMessageRepeatCount() == that.getMessageRepeatCount()) + && (getMessageRepeatDelay() == that.getMessageRepeatDelay()) + && (getAddress() == that.getAddress()) + && (getQosCategory() == that.getQosCategory()) + && (getDatagramQos() == that.getDatagramQos()) + && (getDiscoveryAnnounceRate() == that.getDiscoveryAnnounceRate()) + && (getTopic() == that.getTopic()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getMessageRepeatCount(), + getMessageRepeatDelay(), + getAddress(), + getQosCategory(), + getDatagramQos(), + getDiscoveryAnnounceRate(), + getTopic()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransportDataType.java new file mode 100644 index 00000000000..07289282b1b --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DatagramWriterGroupTransportDataType.java @@ -0,0 +1,165 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DatagramWriterGroupTransportDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15534; + } + + // Properties. + protected final short messageRepeatCount; + protected final double messageRepeatDelay; + + public DatagramWriterGroupTransportDataType(short messageRepeatCount, double messageRepeatDelay) { + super(); + this.messageRepeatCount = messageRepeatCount; + this.messageRepeatDelay = messageRepeatDelay; + } + + public short getMessageRepeatCount() { + return messageRepeatCount; + } + + public double getMessageRepeatDelay() { + return messageRepeatDelay; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DatagramWriterGroupTransportDataType"); + + // Simple Field (messageRepeatCount) + writeSimpleField("messageRepeatCount", messageRepeatCount, writeUnsignedShort(writeBuffer, 8)); + + // Simple Field (messageRepeatDelay) + writeSimpleField("messageRepeatDelay", messageRepeatDelay, writeDouble(writeBuffer, 64)); + + writeBuffer.popContext("DatagramWriterGroupTransportDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DatagramWriterGroupTransportDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (messageRepeatCount) + lengthInBits += 8; + + // Simple field (messageRepeatDelay) + lengthInBits += 64; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DatagramWriterGroupTransportDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + short messageRepeatCount = + readSimpleField("messageRepeatCount", readUnsignedShort(readBuffer, 8)); + + double messageRepeatDelay = readSimpleField("messageRepeatDelay", readDouble(readBuffer, 64)); + + readBuffer.closeContext("DatagramWriterGroupTransportDataType"); + // Create the instance + return new DatagramWriterGroupTransportDataTypeBuilderImpl( + messageRepeatCount, messageRepeatDelay); + } + + public static class DatagramWriterGroupTransportDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final short messageRepeatCount; + private final double messageRepeatDelay; + + public DatagramWriterGroupTransportDataTypeBuilderImpl( + short messageRepeatCount, double messageRepeatDelay) { + this.messageRepeatCount = messageRepeatCount; + this.messageRepeatDelay = messageRepeatDelay; + } + + public DatagramWriterGroupTransportDataType build() { + DatagramWriterGroupTransportDataType datagramWriterGroupTransportDataType = + new DatagramWriterGroupTransportDataType(messageRepeatCount, messageRepeatDelay); + return datagramWriterGroupTransportDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DatagramWriterGroupTransportDataType)) { + return false; + } + DatagramWriterGroupTransportDataType that = (DatagramWriterGroupTransportDataType) o; + return (getMessageRepeatCount() == that.getMessageRepeatCount()) + && (getMessageRepeatDelay() == that.getMessageRepeatDelay()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getMessageRepeatCount(), getMessageRepeatDelay()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteAtTimeDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteAtTimeDetails.java new file mode 100644 index 00000000000..a0c05c73912 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteAtTimeDetails.java @@ -0,0 +1,174 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DeleteAtTimeDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 691; + } + + // Properties. + protected final NodeId nodeId; + protected final List reqTimes; + + public DeleteAtTimeDetails(NodeId nodeId, List reqTimes) { + super(); + this.nodeId = nodeId; + this.reqTimes = reqTimes; + } + + public NodeId getNodeId() { + return nodeId; + } + + public List getReqTimes() { + return reqTimes; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DeleteAtTimeDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Implicit Field (noOfReqTimes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReqTimes = (int) ((((getReqTimes()) == (null)) ? -(1) : COUNT(getReqTimes()))); + writeImplicitField("noOfReqTimes", noOfReqTimes, writeSignedInt(writeBuffer, 32)); + + // Array Field (reqTimes) + writeSimpleTypeArrayField("reqTimes", reqTimes, writeSignedLong(writeBuffer, 64)); + + writeBuffer.popContext("DeleteAtTimeDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DeleteAtTimeDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Implicit Field (noOfReqTimes) + lengthInBits += 32; + + // Array field + if (reqTimes != null) { + lengthInBits += 64 * reqTimes.size(); + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DeleteAtTimeDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int noOfReqTimes = readImplicitField("noOfReqTimes", readSignedInt(readBuffer, 32)); + + List reqTimes = + readCountArrayField("reqTimes", readSignedLong(readBuffer, 64), noOfReqTimes); + + readBuffer.closeContext("DeleteAtTimeDetails"); + // Create the instance + return new DeleteAtTimeDetailsBuilderImpl(nodeId, reqTimes); + } + + public static class DeleteAtTimeDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final List reqTimes; + + public DeleteAtTimeDetailsBuilderImpl(NodeId nodeId, List reqTimes) { + this.nodeId = nodeId; + this.reqTimes = reqTimes; + } + + public DeleteAtTimeDetails build() { + DeleteAtTimeDetails deleteAtTimeDetails = new DeleteAtTimeDetails(nodeId, reqTimes); + return deleteAtTimeDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DeleteAtTimeDetails)) { + return false; + } + DeleteAtTimeDetails that = (DeleteAtTimeDetails) o; + return (getNodeId() == that.getNodeId()) + && (getReqTimes() == that.getReqTimes()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getNodeId(), getReqTimes()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteEventDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteEventDetails.java new file mode 100644 index 00000000000..3025b42120b --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteEventDetails.java @@ -0,0 +1,181 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DeleteEventDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 694; + } + + // Properties. + protected final NodeId nodeId; + protected final List eventIds; + + public DeleteEventDetails(NodeId nodeId, List eventIds) { + super(); + this.nodeId = nodeId; + this.eventIds = eventIds; + } + + public NodeId getNodeId() { + return nodeId; + } + + public List getEventIds() { + return eventIds; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DeleteEventDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Implicit Field (noOfEventIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEventIds = (int) ((((getEventIds()) == (null)) ? -(1) : COUNT(getEventIds()))); + writeImplicitField("noOfEventIds", noOfEventIds, writeSignedInt(writeBuffer, 32)); + + // Array Field (eventIds) + writeComplexTypeArrayField("eventIds", eventIds, writeBuffer); + + writeBuffer.popContext("DeleteEventDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DeleteEventDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Implicit Field (noOfEventIds) + lengthInBits += 32; + + // Array field + if (eventIds != null) { + int i = 0; + for (PascalByteString element : eventIds) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= eventIds.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DeleteEventDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int noOfEventIds = readImplicitField("noOfEventIds", readSignedInt(readBuffer, 32)); + + List eventIds = + readCountArrayField( + "eventIds", + readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer), + noOfEventIds); + + readBuffer.closeContext("DeleteEventDetails"); + // Create the instance + return new DeleteEventDetailsBuilderImpl(nodeId, eventIds); + } + + public static class DeleteEventDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final List eventIds; + + public DeleteEventDetailsBuilderImpl(NodeId nodeId, List eventIds) { + this.nodeId = nodeId; + this.eventIds = eventIds; + } + + public DeleteEventDetails build() { + DeleteEventDetails deleteEventDetails = new DeleteEventDetails(nodeId, eventIds); + return deleteEventDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DeleteEventDetails)) { + return false; + } + DeleteEventDetails that = (DeleteEventDetails) o; + return (getNodeId() == that.getNodeId()) + && (getEventIds() == that.getEventIds()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getNodeId(), getEventIds()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsRequest.java index 8a30159a8ae..90c88532070 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsRequest.java @@ -38,29 +38,24 @@ public class DeleteMonitoredItemsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "781"; + public Integer getExtensionId() { + return (int) 781; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; - protected final int noOfMonitoredItemIds; protected final List monitoredItemIds; public DeleteMonitoredItemsRequest( - ExtensionObjectDefinition requestHeader, - long subscriptionId, - int noOfMonitoredItemIds, - List monitoredItemIds) { + RequestHeader requestHeader, long subscriptionId, List monitoredItemIds) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; - this.noOfMonitoredItemIds = noOfMonitoredItemIds; this.monitoredItemIds = monitoredItemIds; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -68,10 +63,6 @@ public long getSubscriptionId() { return subscriptionId; } - public int getNoOfMonitoredItemIds() { - return noOfMonitoredItemIds; - } - public List getMonitoredItemIds() { return monitoredItemIds; } @@ -89,8 +80,12 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (subscriptionId) writeSimpleField("subscriptionId", subscriptionId, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfMonitoredItemIds) - writeSimpleField("noOfMonitoredItemIds", noOfMonitoredItemIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfMonitoredItemIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfMonitoredItemIds = + (int) ((((getMonitoredItemIds()) == (null)) ? -(1) : COUNT(getMonitoredItemIds()))); + writeImplicitField( + "noOfMonitoredItemIds", noOfMonitoredItemIds, writeSignedInt(writeBuffer, 32)); // Array Field (monitoredItemIds) writeSimpleTypeArrayField( @@ -116,7 +111,7 @@ public int getLengthInBits() { // Simple field (subscriptionId) lengthInBits += 32; - // Simple field (noOfMonitoredItemIds) + // Implicit Field (noOfMonitoredItemIds) lengthInBits += 32; // Array field @@ -128,22 +123,23 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteMonitoredItemsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); int noOfMonitoredItemIds = - readSimpleField("noOfMonitoredItemIds", readSignedInt(readBuffer, 32)); + readImplicitField("noOfMonitoredItemIds", readSignedInt(readBuffer, 32)); List monitoredItemIds = readCountArrayField( @@ -152,31 +148,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteMonitoredItemsRequest"); // Create the instance return new DeleteMonitoredItemsRequestBuilderImpl( - requestHeader, subscriptionId, noOfMonitoredItemIds, monitoredItemIds); + requestHeader, subscriptionId, monitoredItemIds); } public static class DeleteMonitoredItemsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; - private final int noOfMonitoredItemIds; private final List monitoredItemIds; public DeleteMonitoredItemsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - long subscriptionId, - int noOfMonitoredItemIds, - List monitoredItemIds) { + RequestHeader requestHeader, long subscriptionId, List monitoredItemIds) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; - this.noOfMonitoredItemIds = noOfMonitoredItemIds; this.monitoredItemIds = monitoredItemIds; } public DeleteMonitoredItemsRequest build() { DeleteMonitoredItemsRequest deleteMonitoredItemsRequest = - new DeleteMonitoredItemsRequest( - requestHeader, subscriptionId, noOfMonitoredItemIds, monitoredItemIds); + new DeleteMonitoredItemsRequest(requestHeader, subscriptionId, monitoredItemIds); return deleteMonitoredItemsRequest; } } @@ -192,7 +182,6 @@ public boolean equals(Object o) { DeleteMonitoredItemsRequest that = (DeleteMonitoredItemsRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getSubscriptionId() == that.getSubscriptionId()) - && (getNoOfMonitoredItemIds() == that.getNoOfMonitoredItemIds()) && (getMonitoredItemIds() == that.getMonitoredItemIds()) && super.equals(that) && true; @@ -201,11 +190,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getSubscriptionId(), - getNoOfMonitoredItemIds(), - getMonitoredItemIds()); + super.hashCode(), getRequestHeader(), getSubscriptionId(), getMonitoredItemIds()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsResponse.java index 0ce6af097c2..9667e3565f5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteMonitoredItemsResponse.java @@ -38,47 +38,33 @@ public class DeleteMonitoredItemsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "784"; + public Integer getExtensionId() { + return (int) 784; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public DeleteMonitoredItemsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteMonitoredItemsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteMonitoredItemsResponse"); // Create the instance - return new DeleteMonitoredItemsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new DeleteMonitoredItemsResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class DeleteMonitoredItemsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public DeleteMonitoredItemsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public DeleteMonitoredItemsResponse build() { DeleteMonitoredItemsResponse deleteMonitoredItemsResponse = - new DeleteMonitoredItemsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new DeleteMonitoredItemsResponse(responseHeader, results, diagnosticInfos); return deleteMonitoredItemsResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } DeleteMonitoredItemsResponse that = (DeleteMonitoredItemsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesItem.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesItem.java index 67709b35e60..0b35c39f8af 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesItem.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesItem.java @@ -38,8 +38,8 @@ public class DeleteNodesItem extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "384"; + public Integer getExtensionId() { + return (int) 384; } // Properties. @@ -103,7 +103,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteNodesItem"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesRequest.java index 15d620392ed..0a05150e273 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesRequest.java @@ -38,34 +38,25 @@ public class DeleteNodesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "500"; + public Integer getExtensionId() { + return (int) 500; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfNodesToDelete; - protected final List nodesToDelete; - - public DeleteNodesRequest( - ExtensionObjectDefinition requestHeader, - int noOfNodesToDelete, - List nodesToDelete) { + protected final RequestHeader requestHeader; + protected final List nodesToDelete; + + public DeleteNodesRequest(RequestHeader requestHeader, List nodesToDelete) { super(); this.requestHeader = requestHeader; - this.noOfNodesToDelete = noOfNodesToDelete; this.nodesToDelete = nodesToDelete; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfNodesToDelete() { - return noOfNodesToDelete; - } - - public List getNodesToDelete() { + public List getNodesToDelete() { return nodesToDelete; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfNodesToDelete) - writeSimpleField("noOfNodesToDelete", noOfNodesToDelete, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToDelete) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToDelete = + (int) ((((getNodesToDelete()) == (null)) ? -(1) : COUNT(getNodesToDelete()))); + writeImplicitField("noOfNodesToDelete", noOfNodesToDelete, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToDelete) writeComplexTypeArrayField("nodesToDelete", nodesToDelete, writeBuffer); @@ -102,13 +96,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfNodesToDelete) + // Implicit Field (noOfNodesToDelete) lengthInBits += 32; // Array field if (nodesToDelete != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToDelete) { + for (DeleteNodesItem element : nodesToDelete) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToDelete.size()); lengthInBits += element.getLengthInBits(); } @@ -118,51 +112,49 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteNodesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfNodesToDelete = readSimpleField("noOfNodesToDelete", readSignedInt(readBuffer, 32)); + int noOfNodesToDelete = readImplicitField("noOfNodesToDelete", readSignedInt(readBuffer, 32)); - List nodesToDelete = + List nodesToDelete = readCountArrayField( "nodesToDelete", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("384")), + () -> + (DeleteNodesItem) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (384)), readBuffer), noOfNodesToDelete); readBuffer.closeContext("DeleteNodesRequest"); // Create the instance - return new DeleteNodesRequestBuilderImpl(requestHeader, noOfNodesToDelete, nodesToDelete); + return new DeleteNodesRequestBuilderImpl(requestHeader, nodesToDelete); } public static class DeleteNodesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfNodesToDelete; - private final List nodesToDelete; + private final RequestHeader requestHeader; + private final List nodesToDelete; public DeleteNodesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfNodesToDelete, - List nodesToDelete) { + RequestHeader requestHeader, List nodesToDelete) { this.requestHeader = requestHeader; - this.noOfNodesToDelete = noOfNodesToDelete; this.nodesToDelete = nodesToDelete; } public DeleteNodesRequest build() { - DeleteNodesRequest deleteNodesRequest = - new DeleteNodesRequest(requestHeader, noOfNodesToDelete, nodesToDelete); + DeleteNodesRequest deleteNodesRequest = new DeleteNodesRequest(requestHeader, nodesToDelete); return deleteNodesRequest; } } @@ -177,7 +169,6 @@ public boolean equals(Object o) { } DeleteNodesRequest that = (DeleteNodesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfNodesToDelete() == that.getNoOfNodesToDelete()) && (getNodesToDelete() == that.getNodesToDelete()) && super.equals(that) && true; @@ -185,8 +176,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfNodesToDelete(), getNodesToDelete()); + return Objects.hash(super.hashCode(), getRequestHeader(), getNodesToDelete()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesResponse.java index 84c763de6ff..6c5d5e3f4b2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteNodesResponse.java @@ -38,47 +38,33 @@ public class DeleteNodesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "503"; + public Integer getExtensionId() { + return (int) 503; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public DeleteNodesResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteNodesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteNodesResponse"); // Create the instance - return new DeleteNodesResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new DeleteNodesResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class DeleteNodesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public DeleteNodesResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public DeleteNodesResponse build() { DeleteNodesResponse deleteNodesResponse = - new DeleteNodesResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new DeleteNodesResponse(responseHeader, results, diagnosticInfos); return deleteNodesResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } DeleteNodesResponse that = (DeleteNodesResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteRawModifiedDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteRawModifiedDetails.java new file mode 100644 index 00000000000..c5325434f69 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteRawModifiedDetails.java @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class DeleteRawModifiedDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 688; + } + + // Properties. + protected final NodeId nodeId; + protected final boolean isDeleteModified; + protected final long startTime; + protected final long endTime; + + public DeleteRawModifiedDetails( + NodeId nodeId, boolean isDeleteModified, long startTime, long endTime) { + super(); + this.nodeId = nodeId; + this.isDeleteModified = isDeleteModified; + this.startTime = startTime; + this.endTime = endTime; + } + + public NodeId getNodeId() { + return nodeId; + } + + public boolean getIsDeleteModified() { + return isDeleteModified; + } + + public long getStartTime() { + return startTime; + } + + public long getEndTime() { + return endTime; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("DeleteRawModifiedDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (isDeleteModified) + writeSimpleField("isDeleteModified", isDeleteModified, writeBoolean(writeBuffer)); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (endTime) + writeSimpleField("endTime", endTime, writeSignedLong(writeBuffer, 64)); + + writeBuffer.popContext("DeleteRawModifiedDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + DeleteRawModifiedDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (isDeleteModified) + lengthInBits += 1; + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (endTime) + lengthInBits += 64; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("DeleteRawModifiedDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean isDeleteModified = readSimpleField("isDeleteModified", readBoolean(readBuffer)); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + long endTime = readSimpleField("endTime", readSignedLong(readBuffer, 64)); + + readBuffer.closeContext("DeleteRawModifiedDetails"); + // Create the instance + return new DeleteRawModifiedDetailsBuilderImpl(nodeId, isDeleteModified, startTime, endTime); + } + + public static class DeleteRawModifiedDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final boolean isDeleteModified; + private final long startTime; + private final long endTime; + + public DeleteRawModifiedDetailsBuilderImpl( + NodeId nodeId, boolean isDeleteModified, long startTime, long endTime) { + this.nodeId = nodeId; + this.isDeleteModified = isDeleteModified; + this.startTime = startTime; + this.endTime = endTime; + } + + public DeleteRawModifiedDetails build() { + DeleteRawModifiedDetails deleteRawModifiedDetails = + new DeleteRawModifiedDetails(nodeId, isDeleteModified, startTime, endTime); + return deleteRawModifiedDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DeleteRawModifiedDetails)) { + return false; + } + DeleteRawModifiedDetails that = (DeleteRawModifiedDetails) o; + return (getNodeId() == that.getNodeId()) + && (getIsDeleteModified() == that.getIsDeleteModified()) + && (getStartTime() == that.getStartTime()) + && (getEndTime() == that.getEndTime()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNodeId(), getIsDeleteModified(), getStartTime(), getEndTime()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesItem.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesItem.java index e84d5c71043..14c92c219e4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesItem.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesItem.java @@ -38,8 +38,8 @@ public class DeleteReferencesItem extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "387"; + public Integer getExtensionId() { + return (int) 387; } // Properties. @@ -150,7 +150,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteReferencesItem"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesRequest.java index d04a064e859..b904801d636 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesRequest.java @@ -38,34 +38,26 @@ public class DeleteReferencesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "506"; + public Integer getExtensionId() { + return (int) 506; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfReferencesToDelete; - protected final List referencesToDelete; + protected final RequestHeader requestHeader; + protected final List referencesToDelete; public DeleteReferencesRequest( - ExtensionObjectDefinition requestHeader, - int noOfReferencesToDelete, - List referencesToDelete) { + RequestHeader requestHeader, List referencesToDelete) { super(); this.requestHeader = requestHeader; - this.noOfReferencesToDelete = noOfReferencesToDelete; this.referencesToDelete = referencesToDelete; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfReferencesToDelete() { - return noOfReferencesToDelete; - } - - public List getReferencesToDelete() { + public List getReferencesToDelete() { return referencesToDelete; } @@ -79,8 +71,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfReferencesToDelete) - writeSimpleField( + // Implicit Field (noOfReferencesToDelete) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfReferencesToDelete = + (int) ((((getReferencesToDelete()) == (null)) ? -(1) : COUNT(getReferencesToDelete()))); + writeImplicitField( "noOfReferencesToDelete", noOfReferencesToDelete, writeSignedInt(writeBuffer, 32)); // Array Field (referencesToDelete) @@ -103,13 +98,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfReferencesToDelete) + // Implicit Field (noOfReferencesToDelete) lengthInBits += 32; // Array field if (referencesToDelete != null) { int i = 0; - for (ExtensionObjectDefinition element : referencesToDelete) { + for (DeleteReferencesItem element : referencesToDelete) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= referencesToDelete.size()); lengthInBits += element.getLengthInBits(); } @@ -119,53 +114,51 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteReferencesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); int noOfReferencesToDelete = - readSimpleField("noOfReferencesToDelete", readSignedInt(readBuffer, 32)); + readImplicitField("noOfReferencesToDelete", readSignedInt(readBuffer, 32)); - List referencesToDelete = + List referencesToDelete = readCountArrayField( "referencesToDelete", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("387")), + () -> + (DeleteReferencesItem) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (387)), readBuffer), noOfReferencesToDelete); readBuffer.closeContext("DeleteReferencesRequest"); // Create the instance - return new DeleteReferencesRequestBuilderImpl( - requestHeader, noOfReferencesToDelete, referencesToDelete); + return new DeleteReferencesRequestBuilderImpl(requestHeader, referencesToDelete); } public static class DeleteReferencesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfReferencesToDelete; - private final List referencesToDelete; + private final RequestHeader requestHeader; + private final List referencesToDelete; public DeleteReferencesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfReferencesToDelete, - List referencesToDelete) { + RequestHeader requestHeader, List referencesToDelete) { this.requestHeader = requestHeader; - this.noOfReferencesToDelete = noOfReferencesToDelete; this.referencesToDelete = referencesToDelete; } public DeleteReferencesRequest build() { DeleteReferencesRequest deleteReferencesRequest = - new DeleteReferencesRequest(requestHeader, noOfReferencesToDelete, referencesToDelete); + new DeleteReferencesRequest(requestHeader, referencesToDelete); return deleteReferencesRequest; } } @@ -180,7 +173,6 @@ public boolean equals(Object o) { } DeleteReferencesRequest that = (DeleteReferencesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfReferencesToDelete() == that.getNoOfReferencesToDelete()) && (getReferencesToDelete() == that.getReferencesToDelete()) && super.equals(that) && true; @@ -188,8 +180,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfReferencesToDelete(), getReferencesToDelete()); + return Objects.hash(super.hashCode(), getRequestHeader(), getReferencesToDelete()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesResponse.java index a8ea3237133..09135c210f3 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteReferencesResponse.java @@ -38,47 +38,33 @@ public class DeleteReferencesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "509"; + public Integer getExtensionId() { + return (int) 509; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public DeleteReferencesResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteReferencesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteReferencesResponse"); // Create the instance - return new DeleteReferencesResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new DeleteReferencesResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class DeleteReferencesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public DeleteReferencesResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public DeleteReferencesResponse build() { DeleteReferencesResponse deleteReferencesResponse = - new DeleteReferencesResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new DeleteReferencesResponse(responseHeader, results, diagnosticInfos); return deleteReferencesResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } DeleteReferencesResponse that = (DeleteReferencesResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsRequest.java index 979c1a7794c..2f79739d88f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsRequest.java @@ -38,33 +38,24 @@ public class DeleteSubscriptionsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "847"; + public Integer getExtensionId() { + return (int) 847; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfSubscriptionIds; + protected final RequestHeader requestHeader; protected final List subscriptionIds; - public DeleteSubscriptionsRequest( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionIds, - List subscriptionIds) { + public DeleteSubscriptionsRequest(RequestHeader requestHeader, List subscriptionIds) { super(); this.requestHeader = requestHeader; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfSubscriptionIds() { - return noOfSubscriptionIds; - } - public List getSubscriptionIds() { return subscriptionIds; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfSubscriptionIds) - writeSimpleField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfSubscriptionIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSubscriptionIds = + (int) ((((getSubscriptionIds()) == (null)) ? -(1) : COUNT(getSubscriptionIds()))); + writeImplicitField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); // Array Field (subscriptionIds) writeSimpleTypeArrayField( @@ -103,7 +97,7 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32; // Array field @@ -115,19 +109,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteSubscriptionsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfSubscriptionIds = readSimpleField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); + int noOfSubscriptionIds = + readImplicitField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); List subscriptionIds = readCountArrayField( @@ -135,28 +131,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteSubscriptionsRequest"); // Create the instance - return new DeleteSubscriptionsRequestBuilderImpl( - requestHeader, noOfSubscriptionIds, subscriptionIds); + return new DeleteSubscriptionsRequestBuilderImpl(requestHeader, subscriptionIds); } public static class DeleteSubscriptionsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfSubscriptionIds; + private final RequestHeader requestHeader; private final List subscriptionIds; public DeleteSubscriptionsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionIds, - List subscriptionIds) { + RequestHeader requestHeader, List subscriptionIds) { this.requestHeader = requestHeader; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; } public DeleteSubscriptionsRequest build() { DeleteSubscriptionsRequest deleteSubscriptionsRequest = - new DeleteSubscriptionsRequest(requestHeader, noOfSubscriptionIds, subscriptionIds); + new DeleteSubscriptionsRequest(requestHeader, subscriptionIds); return deleteSubscriptionsRequest; } } @@ -171,7 +162,6 @@ public boolean equals(Object o) { } DeleteSubscriptionsRequest that = (DeleteSubscriptionsRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfSubscriptionIds() == that.getNoOfSubscriptionIds()) && (getSubscriptionIds() == that.getSubscriptionIds()) && super.equals(that) && true; @@ -179,8 +169,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfSubscriptionIds(), getSubscriptionIds()); + return Objects.hash(super.hashCode(), getRequestHeader(), getSubscriptionIds()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsResponse.java index 90797200c12..c93095af3ae 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DeleteSubscriptionsResponse.java @@ -38,47 +38,33 @@ public class DeleteSubscriptionsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "850"; + public Integer getExtensionId() { + return (int) 850; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public DeleteSubscriptionsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DeleteSubscriptionsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("DeleteSubscriptionsResponse"); // Create the instance - return new DeleteSubscriptionsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new DeleteSubscriptionsResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class DeleteSubscriptionsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public DeleteSubscriptionsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public DeleteSubscriptionsResponse build() { DeleteSubscriptionsResponse deleteSubscriptionsResponse = - new DeleteSubscriptionsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new DeleteSubscriptionsResponse(responseHeader, results, diagnosticInfos); return deleteSubscriptionsResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } DeleteSubscriptionsResponse that = (DeleteSubscriptionsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DiscoveryConfiguration.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DiscoveryConfiguration.java index 90d0c62a40c..19a4a2eb826 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DiscoveryConfiguration.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DiscoveryConfiguration.java @@ -38,8 +38,8 @@ public class DiscoveryConfiguration extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12892"; + public Integer getExtensionId() { + return (int) 12892; } public DiscoveryConfiguration() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DiscoveryConfiguration"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DoubleComplexNumberType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DoubleComplexNumberType.java index fe7dc31cffc..52d5c009407 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DoubleComplexNumberType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/DoubleComplexNumberType.java @@ -38,8 +38,8 @@ public class DoubleComplexNumberType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12174"; + public Integer getExtensionId() { + return (int) 12174; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("DoubleComplexNumberType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EUInformation.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EUInformation.java index 6ec97640d24..1143522f4da 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EUInformation.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EUInformation.java @@ -38,8 +38,8 @@ public class EUInformation extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "889"; + public Integer getExtensionId() { + return (int) 889; } // Properties. @@ -122,7 +122,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EUInformation"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ElementOperand.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ElementOperand.java new file mode 100644 index 00000000000..6148dd6f7b8 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ElementOperand.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ElementOperand extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 594; + } + + // Properties. + protected final long index; + + public ElementOperand(long index) { + super(); + this.index = index; + } + + public long getIndex() { + return index; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ElementOperand"); + + // Simple Field (index) + writeSimpleField("index", index, writeUnsignedLong(writeBuffer, 32)); + + writeBuffer.popContext("ElementOperand"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ElementOperand _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (index) + lengthInBits += 32; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ElementOperand"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long index = readSimpleField("index", readUnsignedLong(readBuffer, 32)); + + readBuffer.closeContext("ElementOperand"); + // Create the instance + return new ElementOperandBuilderImpl(index); + } + + public static class ElementOperandBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long index; + + public ElementOperandBuilderImpl(long index) { + this.index = index; + } + + public ElementOperand build() { + ElementOperand elementOperand = new ElementOperand(index); + return elementOperand; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ElementOperand)) { + return false; + } + ElementOperand that = (ElementOperand) o; + return (getIndex() == that.getIndex()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getIndex()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointConfiguration.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointConfiguration.java index d3a0bcad7e7..4c8717fb930 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointConfiguration.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointConfiguration.java @@ -38,8 +38,8 @@ public class EndpointConfiguration extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "333"; + public Integer getExtensionId() { + return (int) 333; } // Properties. @@ -197,7 +197,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EndpointConfiguration"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointDescription.java index f172238bd38..f288e25ab7a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointDescription.java @@ -38,29 +38,27 @@ public class EndpointDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "314"; + public Integer getExtensionId() { + return (int) 314; } // Properties. protected final PascalString endpointUrl; - protected final ExtensionObjectDefinition server; + protected final ApplicationDescription server; protected final PascalByteString serverCertificate; protected final MessageSecurityMode securityMode; protected final PascalString securityPolicyUri; - protected final int noOfUserIdentityTokens; - protected final List userIdentityTokens; + protected final List userIdentityTokens; protected final PascalString transportProfileUri; protected final short securityLevel; public EndpointDescription( PascalString endpointUrl, - ExtensionObjectDefinition server, + ApplicationDescription server, PascalByteString serverCertificate, MessageSecurityMode securityMode, PascalString securityPolicyUri, - int noOfUserIdentityTokens, - List userIdentityTokens, + List userIdentityTokens, PascalString transportProfileUri, short securityLevel) { super(); @@ -69,7 +67,6 @@ public EndpointDescription( this.serverCertificate = serverCertificate; this.securityMode = securityMode; this.securityPolicyUri = securityPolicyUri; - this.noOfUserIdentityTokens = noOfUserIdentityTokens; this.userIdentityTokens = userIdentityTokens; this.transportProfileUri = transportProfileUri; this.securityLevel = securityLevel; @@ -79,7 +76,7 @@ public PascalString getEndpointUrl() { return endpointUrl; } - public ExtensionObjectDefinition getServer() { + public ApplicationDescription getServer() { return server; } @@ -95,11 +92,7 @@ public PascalString getSecurityPolicyUri() { return securityPolicyUri; } - public int getNoOfUserIdentityTokens() { - return noOfUserIdentityTokens; - } - - public List getUserIdentityTokens() { + public List getUserIdentityTokens() { return userIdentityTokens; } @@ -140,8 +133,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (securityPolicyUri) writeSimpleField("securityPolicyUri", securityPolicyUri, writeComplex(writeBuffer)); - // Simple Field (noOfUserIdentityTokens) - writeSimpleField( + // Implicit Field (noOfUserIdentityTokens) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfUserIdentityTokens = + (int) ((((getUserIdentityTokens()) == (null)) ? -(1) : COUNT(getUserIdentityTokens()))); + writeImplicitField( "noOfUserIdentityTokens", noOfUserIdentityTokens, writeSignedInt(writeBuffer, 32)); // Array Field (userIdentityTokens) @@ -182,13 +178,13 @@ public int getLengthInBits() { // Simple field (securityPolicyUri) lengthInBits += securityPolicyUri.getLengthInBits(); - // Simple field (noOfUserIdentityTokens) + // Implicit Field (noOfUserIdentityTokens) lengthInBits += 32; // Array field if (userIdentityTokens != null) { int i = 0; - for (ExtensionObjectDefinition element : userIdentityTokens) { + for (UserTokenPolicy element : userIdentityTokens) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= userIdentityTokens.size()); lengthInBits += element.getLengthInBits(); } @@ -204,7 +200,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EndpointDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -213,11 +209,13 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "endpointUrl", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - ExtensionObjectDefinition server = + ApplicationDescription server = readSimpleField( "server", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("310")), + () -> + (ApplicationDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (310)), readBuffer)); PascalByteString serverCertificate = @@ -237,13 +235,15 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfUserIdentityTokens = - readSimpleField("noOfUserIdentityTokens", readSignedInt(readBuffer, 32)); + readImplicitField("noOfUserIdentityTokens", readSignedInt(readBuffer, 32)); - List userIdentityTokens = + List userIdentityTokens = readCountArrayField( "userIdentityTokens", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("306")), + () -> + (UserTokenPolicy) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (306)), readBuffer), noOfUserIdentityTokens); @@ -262,7 +262,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit serverCertificate, securityMode, securityPolicyUri, - noOfUserIdentityTokens, userIdentityTokens, transportProfileUri, securityLevel); @@ -271,23 +270,21 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class EndpointDescriptionBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString endpointUrl; - private final ExtensionObjectDefinition server; + private final ApplicationDescription server; private final PascalByteString serverCertificate; private final MessageSecurityMode securityMode; private final PascalString securityPolicyUri; - private final int noOfUserIdentityTokens; - private final List userIdentityTokens; + private final List userIdentityTokens; private final PascalString transportProfileUri; private final short securityLevel; public EndpointDescriptionBuilderImpl( PascalString endpointUrl, - ExtensionObjectDefinition server, + ApplicationDescription server, PascalByteString serverCertificate, MessageSecurityMode securityMode, PascalString securityPolicyUri, - int noOfUserIdentityTokens, - List userIdentityTokens, + List userIdentityTokens, PascalString transportProfileUri, short securityLevel) { this.endpointUrl = endpointUrl; @@ -295,7 +292,6 @@ public EndpointDescriptionBuilderImpl( this.serverCertificate = serverCertificate; this.securityMode = securityMode; this.securityPolicyUri = securityPolicyUri; - this.noOfUserIdentityTokens = noOfUserIdentityTokens; this.userIdentityTokens = userIdentityTokens; this.transportProfileUri = transportProfileUri; this.securityLevel = securityLevel; @@ -309,7 +305,6 @@ public EndpointDescription build() { serverCertificate, securityMode, securityPolicyUri, - noOfUserIdentityTokens, userIdentityTokens, transportProfileUri, securityLevel); @@ -331,7 +326,6 @@ public boolean equals(Object o) { && (getServerCertificate() == that.getServerCertificate()) && (getSecurityMode() == that.getSecurityMode()) && (getSecurityPolicyUri() == that.getSecurityPolicyUri()) - && (getNoOfUserIdentityTokens() == that.getNoOfUserIdentityTokens()) && (getUserIdentityTokens() == that.getUserIdentityTokens()) && (getTransportProfileUri() == that.getTransportProfileUri()) && (getSecurityLevel() == that.getSecurityLevel()) @@ -348,7 +342,6 @@ public int hashCode() { getServerCertificate(), getSecurityMode(), getSecurityPolicyUri(), - getNoOfUserIdentityTokens(), getUserIdentityTokens(), getTransportProfileUri(), getSecurityLevel()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointType.java index 5f55ea37167..eaf934871b5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointType.java @@ -38,8 +38,8 @@ public class EndpointType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15530"; + public Integer getExtensionId() { + return (int) 15530; } // Properties. @@ -132,7 +132,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EndpointType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointUrlListDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointUrlListDataType.java index c2bf1f49244..ecac67cfcf4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointUrlListDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EndpointUrlListDataType.java @@ -38,24 +38,18 @@ public class EndpointUrlListDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "11945"; + public Integer getExtensionId() { + return (int) 11945; } // Properties. - protected final int noOfEndpointUrlList; protected final List endpointUrlList; - public EndpointUrlListDataType(int noOfEndpointUrlList, List endpointUrlList) { + public EndpointUrlListDataType(List endpointUrlList) { super(); - this.noOfEndpointUrlList = noOfEndpointUrlList; this.endpointUrlList = endpointUrlList; } - public int getNoOfEndpointUrlList() { - return noOfEndpointUrlList; - } - public List getEndpointUrlList() { return endpointUrlList; } @@ -67,8 +61,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("EndpointUrlListDataType"); - // Simple Field (noOfEndpointUrlList) - writeSimpleField("noOfEndpointUrlList", noOfEndpointUrlList, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEndpointUrlList) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEndpointUrlList = + (int) ((((getEndpointUrlList()) == (null)) ? -(1) : COUNT(getEndpointUrlList()))); + writeImplicitField("noOfEndpointUrlList", noOfEndpointUrlList, writeSignedInt(writeBuffer, 32)); // Array Field (endpointUrlList) writeComplexTypeArrayField("endpointUrlList", endpointUrlList, writeBuffer); @@ -87,7 +84,7 @@ public int getLengthInBits() { EndpointUrlListDataType _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfEndpointUrlList) + // Implicit Field (noOfEndpointUrlList) lengthInBits += 32; // Array field @@ -103,12 +100,13 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EndpointUrlListDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfEndpointUrlList = readSimpleField("noOfEndpointUrlList", readSignedInt(readBuffer, 32)); + int noOfEndpointUrlList = + readImplicitField("noOfEndpointUrlList", readSignedInt(readBuffer, 32)); List endpointUrlList = readCountArrayField( @@ -118,23 +116,20 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("EndpointUrlListDataType"); // Create the instance - return new EndpointUrlListDataTypeBuilderImpl(noOfEndpointUrlList, endpointUrlList); + return new EndpointUrlListDataTypeBuilderImpl(endpointUrlList); } public static class EndpointUrlListDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfEndpointUrlList; private final List endpointUrlList; - public EndpointUrlListDataTypeBuilderImpl( - int noOfEndpointUrlList, List endpointUrlList) { - this.noOfEndpointUrlList = noOfEndpointUrlList; + public EndpointUrlListDataTypeBuilderImpl(List endpointUrlList) { this.endpointUrlList = endpointUrlList; } public EndpointUrlListDataType build() { EndpointUrlListDataType endpointUrlListDataType = - new EndpointUrlListDataType(noOfEndpointUrlList, endpointUrlList); + new EndpointUrlListDataType(endpointUrlList); return endpointUrlListDataType; } } @@ -148,15 +143,12 @@ public boolean equals(Object o) { return false; } EndpointUrlListDataType that = (EndpointUrlListDataType) o; - return (getNoOfEndpointUrlList() == that.getNoOfEndpointUrlList()) - && (getEndpointUrlList() == that.getEndpointUrlList()) - && super.equals(that) - && true; + return (getEndpointUrlList() == that.getEndpointUrlList()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfEndpointUrlList(), getEndpointUrlList()); + return Objects.hash(super.hashCode(), getEndpointUrlList()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDefinition.java new file mode 100644 index 00000000000..4db8b8bb34b --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDefinition.java @@ -0,0 +1,163 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class EnumDefinition extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 102; + } + + // Properties. + protected final List fields; + + public EnumDefinition(List fields) { + super(); + this.fields = fields; + } + + public List getFields() { + return fields; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("EnumDefinition"); + + // Implicit Field (noOfFields) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfFields = (int) ((((getFields()) == (null)) ? -(1) : COUNT(getFields()))); + writeImplicitField("noOfFields", noOfFields, writeSignedInt(writeBuffer, 32)); + + // Array Field (fields) + writeComplexTypeArrayField("fields", fields, writeBuffer); + + writeBuffer.popContext("EnumDefinition"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + EnumDefinition _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfFields) + lengthInBits += 32; + + // Array field + if (fields != null) { + int i = 0; + for (EnumField element : fields) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= fields.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("EnumDefinition"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfFields = readImplicitField("noOfFields", readSignedInt(readBuffer, 32)); + + List fields = + readCountArrayField( + "fields", + readComplex( + () -> (EnumField) ExtensionObjectDefinition.staticParse(readBuffer, (int) (104)), + readBuffer), + noOfFields); + + readBuffer.closeContext("EnumDefinition"); + // Create the instance + return new EnumDefinitionBuilderImpl(fields); + } + + public static class EnumDefinitionBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List fields; + + public EnumDefinitionBuilderImpl(List fields) { + this.fields = fields; + } + + public EnumDefinition build() { + EnumDefinition enumDefinition = new EnumDefinition(fields); + return enumDefinition; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EnumDefinition)) { + return false; + } + EnumDefinition that = (EnumDefinition) o; + return (getFields() == that.getFields()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getFields()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDescription.java new file mode 100644 index 00000000000..ecd1a138288 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumDescription.java @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class EnumDescription extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15490; + } + + // Properties. + protected final NodeId dataTypeId; + protected final QualifiedName name; + protected final EnumDefinition enumDefinition; + protected final short builtInType; + + public EnumDescription( + NodeId dataTypeId, QualifiedName name, EnumDefinition enumDefinition, short builtInType) { + super(); + this.dataTypeId = dataTypeId; + this.name = name; + this.enumDefinition = enumDefinition; + this.builtInType = builtInType; + } + + public NodeId getDataTypeId() { + return dataTypeId; + } + + public QualifiedName getName() { + return name; + } + + public EnumDefinition getEnumDefinition() { + return enumDefinition; + } + + public short getBuiltInType() { + return builtInType; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("EnumDescription"); + + // Simple Field (dataTypeId) + writeSimpleField("dataTypeId", dataTypeId, writeComplex(writeBuffer)); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Simple Field (enumDefinition) + writeSimpleField("enumDefinition", enumDefinition, writeComplex(writeBuffer)); + + // Simple Field (builtInType) + writeSimpleField("builtInType", builtInType, writeUnsignedShort(writeBuffer, 8)); + + writeBuffer.popContext("EnumDescription"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + EnumDescription _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataTypeId) + lengthInBits += dataTypeId.getLengthInBits(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Simple field (enumDefinition) + lengthInBits += enumDefinition.getLengthInBits(); + + // Simple field (builtInType) + lengthInBits += 8; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("EnumDescription"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId dataTypeId = + readSimpleField( + "dataTypeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + QualifiedName name = + readSimpleField( + "name", readComplex(() -> QualifiedName.staticParse(readBuffer), readBuffer)); + + EnumDefinition enumDefinition = + readSimpleField( + "enumDefinition", + readComplex( + () -> + (EnumDefinition) ExtensionObjectDefinition.staticParse(readBuffer, (int) (102)), + readBuffer)); + + short builtInType = readSimpleField("builtInType", readUnsignedShort(readBuffer, 8)); + + readBuffer.closeContext("EnumDescription"); + // Create the instance + return new EnumDescriptionBuilderImpl(dataTypeId, name, enumDefinition, builtInType); + } + + public static class EnumDescriptionBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId dataTypeId; + private final QualifiedName name; + private final EnumDefinition enumDefinition; + private final short builtInType; + + public EnumDescriptionBuilderImpl( + NodeId dataTypeId, QualifiedName name, EnumDefinition enumDefinition, short builtInType) { + this.dataTypeId = dataTypeId; + this.name = name; + this.enumDefinition = enumDefinition; + this.builtInType = builtInType; + } + + public EnumDescription build() { + EnumDescription enumDescription = + new EnumDescription(dataTypeId, name, enumDefinition, builtInType); + return enumDescription; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EnumDescription)) { + return false; + } + EnumDescription that = (EnumDescription) o; + return (getDataTypeId() == that.getDataTypeId()) + && (getName() == that.getName()) + && (getEnumDefinition() == that.getEnumDefinition()) + && (getBuiltInType() == that.getBuiltInType()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getDataTypeId(), getName(), getEnumDefinition(), getBuiltInType()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumField.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumField.java new file mode 100644 index 00000000000..6b93df4f2ab --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumField.java @@ -0,0 +1,203 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class EnumField extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 104; + } + + // Properties. + protected final long value; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final PascalString name; + + public EnumField( + long value, LocalizedText displayName, LocalizedText description, PascalString name) { + super(); + this.value = value; + this.displayName = displayName; + this.description = description; + this.name = name; + } + + public long getValue() { + return value; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public PascalString getName() { + return name; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("EnumField"); + + // Simple Field (value) + writeSimpleField("value", value, writeSignedLong(writeBuffer, 64)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + writeBuffer.popContext("EnumField"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + EnumField _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (value) + lengthInBits += 64; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("EnumField"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long value = readSimpleField("value", readSignedLong(readBuffer, 64)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("EnumField"); + // Create the instance + return new EnumFieldBuilderImpl(value, displayName, description, name); + } + + public static class EnumFieldBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long value; + private final LocalizedText displayName; + private final LocalizedText description; + private final PascalString name; + + public EnumFieldBuilderImpl( + long value, LocalizedText displayName, LocalizedText description, PascalString name) { + this.value = value; + this.displayName = displayName; + this.description = description; + this.name = name; + } + + public EnumField build() { + EnumField enumField = new EnumField(value, displayName, description, name); + return enumField; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EnumField)) { + return false; + } + EnumField that = (EnumField) o; + return (getValue() == that.getValue()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getName() == that.getName()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getValue(), getDisplayName(), getDescription(), getName()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumValueType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumValueType.java index 75dc77597e5..3bf60e8e32c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumValueType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EnumValueType.java @@ -38,8 +38,8 @@ public class EnumValueType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "7596"; + public Integer getExtensionId() { + return (int) 7596; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EnumValueType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EphemeralKeyType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EphemeralKeyType.java index fbf53c8502f..0ae22616fbe 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EphemeralKeyType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EphemeralKeyType.java @@ -38,8 +38,8 @@ public class EphemeralKeyType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "17550"; + public Integer getExtensionId() { + return (int) 17550; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EphemeralKeyType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFieldList.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFieldList.java index 3d581acf4ee..1424bf58be0 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFieldList.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFieldList.java @@ -38,19 +38,17 @@ public class EventFieldList extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "919"; + public Integer getExtensionId() { + return (int) 919; } // Properties. protected final long clientHandle; - protected final int noOfEventFields; protected final List eventFields; - public EventFieldList(long clientHandle, int noOfEventFields, List eventFields) { + public EventFieldList(long clientHandle, List eventFields) { super(); this.clientHandle = clientHandle; - this.noOfEventFields = noOfEventFields; this.eventFields = eventFields; } @@ -58,10 +56,6 @@ public long getClientHandle() { return clientHandle; } - public int getNoOfEventFields() { - return noOfEventFields; - } - public List getEventFields() { return eventFields; } @@ -76,8 +70,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (clientHandle) writeSimpleField("clientHandle", clientHandle, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfEventFields) - writeSimpleField("noOfEventFields", noOfEventFields, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEventFields) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEventFields = (int) ((((getEventFields()) == (null)) ? -(1) : COUNT(getEventFields()))); + writeImplicitField("noOfEventFields", noOfEventFields, writeSignedInt(writeBuffer, 32)); // Array Field (eventFields) writeComplexTypeArrayField("eventFields", eventFields, writeBuffer); @@ -99,7 +95,7 @@ public int getLengthInBits() { // Simple field (clientHandle) lengthInBits += 32; - // Simple field (noOfEventFields) + // Implicit Field (noOfEventFields) lengthInBits += 32; // Array field @@ -115,14 +111,14 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EventFieldList"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); long clientHandle = readSimpleField("clientHandle", readUnsignedLong(readBuffer, 32)); - int noOfEventFields = readSimpleField("noOfEventFields", readSignedInt(readBuffer, 32)); + int noOfEventFields = readImplicitField("noOfEventFields", readSignedInt(readBuffer, 32)); List eventFields = readCountArrayField( @@ -132,25 +128,21 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("EventFieldList"); // Create the instance - return new EventFieldListBuilderImpl(clientHandle, noOfEventFields, eventFields); + return new EventFieldListBuilderImpl(clientHandle, eventFields); } public static class EventFieldListBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final long clientHandle; - private final int noOfEventFields; private final List eventFields; - public EventFieldListBuilderImpl( - long clientHandle, int noOfEventFields, List eventFields) { + public EventFieldListBuilderImpl(long clientHandle, List eventFields) { this.clientHandle = clientHandle; - this.noOfEventFields = noOfEventFields; this.eventFields = eventFields; } public EventFieldList build() { - EventFieldList eventFieldList = - new EventFieldList(clientHandle, noOfEventFields, eventFields); + EventFieldList eventFieldList = new EventFieldList(clientHandle, eventFields); return eventFieldList; } } @@ -165,7 +157,6 @@ public boolean equals(Object o) { } EventFieldList that = (EventFieldList) o; return (getClientHandle() == that.getClientHandle()) - && (getNoOfEventFields() == that.getNoOfEventFields()) && (getEventFields() == that.getEventFields()) && super.equals(that) && true; @@ -173,8 +164,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getClientHandle(), getNoOfEventFields(), getEventFields()); + return Objects.hash(super.hashCode(), getClientHandle(), getEventFields()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilter.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilter.java new file mode 100644 index 00000000000..9b67ced658e --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilter.java @@ -0,0 +1,192 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class EventFilter extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 727; + } + + // Properties. + protected final List selectClauses; + protected final ContentFilter whereClause; + + public EventFilter(List selectClauses, ContentFilter whereClause) { + super(); + this.selectClauses = selectClauses; + this.whereClause = whereClause; + } + + public List getSelectClauses() { + return selectClauses; + } + + public ContentFilter getWhereClause() { + return whereClause; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("EventFilter"); + + // Implicit Field (noOfSelectClauses) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSelectClauses = + (int) ((((getSelectClauses()) == (null)) ? -(1) : COUNT(getSelectClauses()))); + writeImplicitField("noOfSelectClauses", noOfSelectClauses, writeSignedInt(writeBuffer, 32)); + + // Array Field (selectClauses) + writeComplexTypeArrayField("selectClauses", selectClauses, writeBuffer); + + // Simple Field (whereClause) + writeSimpleField("whereClause", whereClause, writeComplex(writeBuffer)); + + writeBuffer.popContext("EventFilter"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + EventFilter _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfSelectClauses) + lengthInBits += 32; + + // Array field + if (selectClauses != null) { + int i = 0; + for (SimpleAttributeOperand element : selectClauses) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= selectClauses.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (whereClause) + lengthInBits += whereClause.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("EventFilter"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfSelectClauses = readImplicitField("noOfSelectClauses", readSignedInt(readBuffer, 32)); + + List selectClauses = + readCountArrayField( + "selectClauses", + readComplex( + () -> + (SimpleAttributeOperand) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (603)), + readBuffer), + noOfSelectClauses); + + ContentFilter whereClause = + readSimpleField( + "whereClause", + readComplex( + () -> + (ContentFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (588)), + readBuffer)); + + readBuffer.closeContext("EventFilter"); + // Create the instance + return new EventFilterBuilderImpl(selectClauses, whereClause); + } + + public static class EventFilterBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List selectClauses; + private final ContentFilter whereClause; + + public EventFilterBuilderImpl( + List selectClauses, ContentFilter whereClause) { + this.selectClauses = selectClauses; + this.whereClause = whereClause; + } + + public EventFilter build() { + EventFilter eventFilter = new EventFilter(selectClauses, whereClause); + return eventFilter; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EventFilter)) { + return false; + } + EventFilter that = (EventFilter) o; + return (getSelectClauses() == that.getSelectClauses()) + && (getWhereClause() == that.getWhereClause()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getSelectClauses(), getWhereClause()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilterResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilterResult.java new file mode 100644 index 00000000000..203d6a5e8fb --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventFilterResult.java @@ -0,0 +1,249 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class EventFilterResult extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 736; + } + + // Properties. + protected final List selectClauseResults; + protected final List selectClauseDiagnosticInfos; + protected final ContentFilterResult whereClauseResult; + + public EventFilterResult( + List selectClauseResults, + List selectClauseDiagnosticInfos, + ContentFilterResult whereClauseResult) { + super(); + this.selectClauseResults = selectClauseResults; + this.selectClauseDiagnosticInfos = selectClauseDiagnosticInfos; + this.whereClauseResult = whereClauseResult; + } + + public List getSelectClauseResults() { + return selectClauseResults; + } + + public List getSelectClauseDiagnosticInfos() { + return selectClauseDiagnosticInfos; + } + + public ContentFilterResult getWhereClauseResult() { + return whereClauseResult; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("EventFilterResult"); + + // Implicit Field (noOfSelectClauseResults) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSelectClauseResults = + (int) ((((getSelectClauseResults()) == (null)) ? -(1) : COUNT(getSelectClauseResults()))); + writeImplicitField( + "noOfSelectClauseResults", noOfSelectClauseResults, writeSignedInt(writeBuffer, 32)); + + // Array Field (selectClauseResults) + writeComplexTypeArrayField("selectClauseResults", selectClauseResults, writeBuffer); + + // Implicit Field (noOfSelectClauseDiagnosticInfos) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfSelectClauseDiagnosticInfos = + (int) + ((((getSelectClauseDiagnosticInfos()) == (null)) + ? -(1) + : COUNT(getSelectClauseDiagnosticInfos()))); + writeImplicitField( + "noOfSelectClauseDiagnosticInfos", + noOfSelectClauseDiagnosticInfos, + writeSignedInt(writeBuffer, 32)); + + // Array Field (selectClauseDiagnosticInfos) + writeComplexTypeArrayField( + "selectClauseDiagnosticInfos", selectClauseDiagnosticInfos, writeBuffer); + + // Simple Field (whereClauseResult) + writeSimpleField("whereClauseResult", whereClauseResult, writeComplex(writeBuffer)); + + writeBuffer.popContext("EventFilterResult"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + EventFilterResult _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfSelectClauseResults) + lengthInBits += 32; + + // Array field + if (selectClauseResults != null) { + int i = 0; + for (StatusCode element : selectClauseResults) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= selectClauseResults.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfSelectClauseDiagnosticInfos) + lengthInBits += 32; + + // Array field + if (selectClauseDiagnosticInfos != null) { + int i = 0; + for (DiagnosticInfo element : selectClauseDiagnosticInfos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= selectClauseDiagnosticInfos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (whereClauseResult) + lengthInBits += whereClauseResult.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("EventFilterResult"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfSelectClauseResults = + readImplicitField("noOfSelectClauseResults", readSignedInt(readBuffer, 32)); + + List selectClauseResults = + readCountArrayField( + "selectClauseResults", + readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), + noOfSelectClauseResults); + + int noOfSelectClauseDiagnosticInfos = + readImplicitField("noOfSelectClauseDiagnosticInfos", readSignedInt(readBuffer, 32)); + + List selectClauseDiagnosticInfos = + readCountArrayField( + "selectClauseDiagnosticInfos", + readComplex(() -> DiagnosticInfo.staticParse(readBuffer), readBuffer), + noOfSelectClauseDiagnosticInfos); + + ContentFilterResult whereClauseResult = + readSimpleField( + "whereClauseResult", + readComplex( + () -> + (ContentFilterResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (609)), + readBuffer)); + + readBuffer.closeContext("EventFilterResult"); + // Create the instance + return new EventFilterResultBuilderImpl( + selectClauseResults, selectClauseDiagnosticInfos, whereClauseResult); + } + + public static class EventFilterResultBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List selectClauseResults; + private final List selectClauseDiagnosticInfos; + private final ContentFilterResult whereClauseResult; + + public EventFilterResultBuilderImpl( + List selectClauseResults, + List selectClauseDiagnosticInfos, + ContentFilterResult whereClauseResult) { + this.selectClauseResults = selectClauseResults; + this.selectClauseDiagnosticInfos = selectClauseDiagnosticInfos; + this.whereClauseResult = whereClauseResult; + } + + public EventFilterResult build() { + EventFilterResult eventFilterResult = + new EventFilterResult( + selectClauseResults, selectClauseDiagnosticInfos, whereClauseResult); + return eventFilterResult; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EventFilterResult)) { + return false; + } + EventFilterResult that = (EventFilterResult) o; + return (getSelectClauseResults() == that.getSelectClauseResults()) + && (getSelectClauseDiagnosticInfos() == that.getSelectClauseDiagnosticInfos()) + && (getWhereClauseResult() == that.getWhereClauseResult()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSelectClauseResults(), + getSelectClauseDiagnosticInfos(), + getWhereClauseResult()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventNotificationList.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventNotificationList.java index a98a38904c5..d528944daac 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventNotificationList.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/EventNotificationList.java @@ -38,25 +38,19 @@ public class EventNotificationList extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "916"; + public Integer getExtensionId() { + return (int) 916; } // Properties. - protected final int noOfEvents; - protected final List events; + protected final List events; - public EventNotificationList(int noOfEvents, List events) { + public EventNotificationList(List events) { super(); - this.noOfEvents = noOfEvents; this.events = events; } - public int getNoOfEvents() { - return noOfEvents; - } - - public List getEvents() { + public List getEvents() { return events; } @@ -67,13 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("EventNotificationList"); - // Implicit Field (notificationLength) (Used for parsing, but its value is not stored as it's - // implicitly given by the objects content) - int notificationLength = (int) (getLengthInBytes()); - writeImplicitField("notificationLength", notificationLength, writeSignedInt(writeBuffer, 32)); - - // Simple Field (noOfEvents) - writeSimpleField("noOfEvents", noOfEvents, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEvents) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfEvents = (int) ((((getEvents()) == (null)) ? -(1) : COUNT(getEvents()))); + writeImplicitField("noOfEvents", noOfEvents, writeSignedInt(writeBuffer, 32)); // Array Field (events) writeComplexTypeArrayField("events", events, writeBuffer); @@ -92,16 +83,13 @@ public int getLengthInBits() { EventNotificationList _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Implicit Field (notificationLength) - lengthInBits += 32; - - // Simple field (noOfEvents) + // Implicit Field (noOfEvents) lengthInBits += 32; // Array field if (events != null) { int i = 0; - for (ExtensionObjectDefinition element : events) { + for (EventFieldList element : events) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= events.size()); lengthInBits += element.getLengthInBits(); } @@ -111,41 +99,37 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("EventNotificationList"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int notificationLength = readImplicitField("notificationLength", readSignedInt(readBuffer, 32)); - - int noOfEvents = readSimpleField("noOfEvents", readSignedInt(readBuffer, 32)); + int noOfEvents = readImplicitField("noOfEvents", readSignedInt(readBuffer, 32)); - List events = + List events = readCountArrayField( "events", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("919")), + () -> + (EventFieldList) ExtensionObjectDefinition.staticParse(readBuffer, (int) (919)), readBuffer), noOfEvents); readBuffer.closeContext("EventNotificationList"); // Create the instance - return new EventNotificationListBuilderImpl(noOfEvents, events); + return new EventNotificationListBuilderImpl(events); } public static class EventNotificationListBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfEvents; - private final List events; + private final List events; - public EventNotificationListBuilderImpl( - int noOfEvents, List events) { - this.noOfEvents = noOfEvents; + public EventNotificationListBuilderImpl(List events) { this.events = events; } public EventNotificationList build() { - EventNotificationList eventNotificationList = new EventNotificationList(noOfEvents, events); + EventNotificationList eventNotificationList = new EventNotificationList(events); return eventNotificationList; } } @@ -159,15 +143,12 @@ public boolean equals(Object o) { return false; } EventNotificationList that = (EventNotificationList) o; - return (getNoOfEvents() == that.getNoOfEvents()) - && (getEvents() == that.getEvents()) - && super.equals(that) - && true; + return (getEvents() == that.getEvents()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfEvents(), getEvents()); + return Objects.hash(super.hashCode(), getEvents()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExpandedNodeId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExpandedNodeId.java index 98c273a5755..44941d3ec5e 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExpandedNodeId.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExpandedNodeId.java @@ -78,10 +78,6 @@ public Long getServerIndex() { return serverIndex; } - public String getIdentifier() { - return String.valueOf(getNodeId().getIdentifier()); - } - public void serialize(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -96,10 +92,6 @@ public void serialize(WriteBuffer writeBuffer) throws SerializationException { // Simple Field (nodeId) writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); - // Virtual field (doesn't actually serialize anything, just makes the value available) - String identifier = getIdentifier(); - writeBuffer.writeVirtual("identifier", identifier); - // Optional Field (namespaceURI) (Can be skipped, if the value is null) writeOptionalField("namespaceURI", namespaceURI, writeComplex(writeBuffer)); @@ -129,8 +121,6 @@ public int getLengthInBits() { // Simple field (nodeId) lengthInBits += nodeId.getLengthInBits(); - // A virtual field doesn't have any in- or output. - // Optional Field (namespaceURI) if (namespaceURI != null) { lengthInBits += namespaceURI.getLengthInBits(); @@ -157,7 +147,6 @@ public static ExpandedNodeId staticParse(ReadBuffer readBuffer) throws ParseExce NodeIdTypeDefinition nodeId = readSimpleField( "nodeId", readComplex(() -> NodeIdTypeDefinition.staticParse(readBuffer), readBuffer)); - String identifier = readVirtualField("identifier", String.class, nodeId.getIdentifier()); PascalString namespaceURI = readOptionalField( diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensiblePayload.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensiblePayload.java index 9d1b23d9438..2d65f2845fd 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensiblePayload.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensiblePayload.java @@ -38,19 +38,19 @@ public class ExtensiblePayload extends Payload implements Message { // Accessors for discriminator values. - public Boolean getExtensible() { - return (boolean) true; + public Boolean getBinary() { + return (boolean) false; } // Properties. - protected final ExtensionObject payload; + protected final RootExtensionObject payload; - public ExtensiblePayload(SequenceHeader sequenceHeader, ExtensionObject payload) { + public ExtensiblePayload(SequenceHeader sequenceHeader, RootExtensionObject payload) { super(sequenceHeader); this.payload = payload; } - public ExtensionObject getPayload() { + public RootExtensionObject getPayload() { return payload; } @@ -84,16 +84,19 @@ public int getLengthInBits() { } public static PayloadBuilder staticParsePayloadBuilder( - ReadBuffer readBuffer, Boolean extensible, Long byteCount) throws ParseException { + ReadBuffer readBuffer, Boolean binary, Long byteCount) throws ParseException { readBuffer.pullContext("ExtensiblePayload"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObject payload = + RootExtensionObject payload = readSimpleField( "payload", readComplex( - () -> ExtensionObject.staticParse(readBuffer, (boolean) (false)), readBuffer)); + () -> + (RootExtensionObject) + ExtensionObject.staticParse(readBuffer, (boolean) (false)), + readBuffer)); readBuffer.closeContext("ExtensiblePayload"); // Create the instance @@ -101,9 +104,9 @@ public static PayloadBuilder staticParsePayloadBuilder( } public static class ExtensiblePayloadBuilderImpl implements Payload.PayloadBuilder { - private final ExtensionObject payload; + private final RootExtensionObject payload; - public ExtensiblePayloadBuilderImpl(ExtensionObject payload) { + public ExtensiblePayloadBuilderImpl(RootExtensionObject payload) { this.payload = payload; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObject.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObject.java index bc5eb7e321a..f9209a2b572 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObject.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObject.java @@ -35,38 +35,34 @@ // Code generated by code-generation. DO NOT EDIT. -public class ExtensionObject implements Message { +public abstract class ExtensionObject implements Message { + + // Abstract accessors for discriminator values. + public abstract Boolean getIncludeEncodingMask(); // Properties. protected final ExpandedNodeId typeId; - protected final ExtensionObjectEncodingMask encodingMask; - protected final ExtensionObjectDefinition body; - public ExtensionObject( - ExpandedNodeId typeId, - ExtensionObjectEncodingMask encodingMask, - ExtensionObjectDefinition body) { + public ExtensionObject(ExpandedNodeId typeId) { super(); this.typeId = typeId; - this.encodingMask = encodingMask; - this.body = body; } + public abstract ExtensionObjectDefinition getBody(); + public ExpandedNodeId getTypeId() { return typeId; } - public ExtensionObjectEncodingMask getEncodingMask() { - return encodingMask; - } - - public ExtensionObjectDefinition getBody() { - return body; + public int getExtensionId() { + return (int) + ((((getTypeId()) == (null)) + ? 0 + : org.apache.plc4x.java.opcua.readwrite.utils.StaticHelper.extensionId(getTypeId()))); } - public String getIdentifier() { - return String.valueOf(getTypeId().getIdentifier()); - } + protected abstract void serializeExtensionObjectChild(WriteBuffer writeBuffer) + throws SerializationException; public void serialize(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; @@ -76,15 +72,12 @@ public void serialize(WriteBuffer writeBuffer) throws SerializationException { // Simple Field (typeId) writeSimpleField("typeId", typeId, writeComplex(writeBuffer)); - // Optional Field (encodingMask) (Can be skipped, if the value is null) - writeOptionalField("encodingMask", encodingMask, writeComplex(writeBuffer)); - // Virtual field (doesn't actually serialize anything, just makes the value available) - String identifier = getIdentifier(); - writeBuffer.writeVirtual("identifier", identifier); + int extensionId = getExtensionId(); + writeBuffer.writeVirtual("extensionId", extensionId); - // Simple Field (body) - writeSimpleField("body", body, writeComplex(writeBuffer)); + // Switch field (Serialize the sub-type) + serializeExtensionObjectChild(writeBuffer); writeBuffer.popContext("ExtensionObject"); } @@ -103,15 +96,9 @@ public int getLengthInBits() { // Simple field (typeId) lengthInBits += typeId.getLengthInBits(); - // Optional Field (encodingMask) - if (encodingMask != null) { - lengthInBits += encodingMask.getLengthInBits(); - } - // A virtual field doesn't have any in- or output. - // Simple field (body) - lengthInBits += body.getLengthInBits(); + // Length of sub-type elements will be added by sub-type... return lengthInBits; } @@ -125,28 +112,44 @@ public static ExtensionObject staticParse(ReadBuffer readBuffer, Boolean include ExpandedNodeId typeId = readSimpleField( "typeId", readComplex(() -> ExpandedNodeId.staticParse(readBuffer), readBuffer)); - - ExtensionObjectEncodingMask encodingMask = - readOptionalField( - "encodingMask", - readComplex(() -> ExtensionObjectEncodingMask.staticParse(readBuffer), readBuffer), - includeEncodingMask); - String identifier = readVirtualField("identifier", String.class, typeId.getIdentifier()); - - ExtensionObjectDefinition body = - readSimpleField( - "body", - readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) (identifier)), - readBuffer)); + int extensionId = + readVirtualField( + "extensionId", + int.class, + (((typeId) == (null)) + ? 0 + : org.apache.plc4x.java.opcua.readwrite.utils.StaticHelper.extensionId(typeId))); + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + ExtensionObjectBuilder builder = null; + if (EvaluationHelper.equals(includeEncodingMask, (boolean) false)) { + builder = + RootExtensionObject.staticParseExtensionObjectBuilder( + readBuffer, extensionId, includeEncodingMask); + } else if (EvaluationHelper.equals(includeEncodingMask, (boolean) true)) { + builder = + ExtensionObjectWithMask.staticParseExtensionObjectBuilder( + readBuffer, extensionId, includeEncodingMask); + } + if (builder == null) { + throw new ParseException( + "Unsupported case for discriminated type" + + " parameters [" + + "includeEncodingMask=" + + includeEncodingMask + + "]"); + } readBuffer.closeContext("ExtensionObject"); // Create the instance - ExtensionObject _extensionObject; - _extensionObject = new ExtensionObject(typeId, encodingMask, body); + ExtensionObject _extensionObject = builder.build(typeId); return _extensionObject; } + public interface ExtensionObjectBuilder { + ExtensionObject build(ExpandedNodeId typeId); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,15 +159,12 @@ public boolean equals(Object o) { return false; } ExtensionObject that = (ExtensionObject) o; - return (getTypeId() == that.getTypeId()) - && (getEncodingMask() == that.getEncodingMask()) - && (getBody() == that.getBody()) - && true; + return (getTypeId() == that.getTypeId()) && true; } @Override public int hashCode() { - return Objects.hash(getTypeId(), getEncodingMask(), getBody()); + return Objects.hash(getTypeId()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectDefinition.java index 23aa19bcdd5..f136973f29f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectDefinition.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectDefinition.java @@ -38,7 +38,7 @@ public abstract class ExtensionObjectDefinition implements Message { // Abstract accessors for discriminator values. - public abstract String getIdentifier(); + public abstract Integer getExtensionId(); public ExtensionObjectDefinition() { super(); @@ -74,7 +74,7 @@ public int getLengthInBits() { return lengthInBits; } - public static ExtensionObjectDefinition staticParse(ReadBuffer readBuffer, String identifier) + public static ExtensionObjectDefinition staticParse(ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ExtensionObjectDefinition"); PositionAware positionAware = readBuffer; @@ -82,740 +82,1031 @@ public static ExtensionObjectDefinition staticParse(ReadBuffer readBuffer, Strin // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) ExtensionObjectDefinitionBuilder builder = null; - if (EvaluationHelper.equals(identifier, (String) "0")) { - builder = NullExtension.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12758")) { - builder = Union.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14535")) { - builder = KeyValuePair.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "16315")) { + if (EvaluationHelper.equals(extensionId, (int) 0)) { + builder = NullExtension.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12758)) { + builder = Union.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14535)) { + builder = KeyValuePair.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 16315)) { builder = AdditionalParametersType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "17550")) { - builder = - EphemeralKeyType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15530")) { - builder = EndpointType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32423")) { - builder = - BitFieldDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "18808")) { - builder = RationalNumber.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "18809")) { - builder = OpcuaVector.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "18811")) { - builder = - CartesianCoordinates.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "18813")) { - builder = Orientation.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "18815")) { - builder = Frame.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15636")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 17550)) { + builder = + EphemeralKeyType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15530)) { + builder = EndpointType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32423)) { + builder = + BitFieldDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 18808)) { + builder = RationalNumber.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 18809)) { + builder = OpcuaVector.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 18811)) { + builder = + CartesianCoordinates.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 18813)) { + builder = Orientation.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 18815)) { + builder = Frame.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15636)) { builder = IdentityMappingRuleType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "23500")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23500)) { builder = - CurrencyUnitType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32436")) { + CurrencyUnitType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32436)) { builder = - AnnotationDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32437")) { + AnnotationDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32437)) { builder = LinearConversionDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32440")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32440)) { builder = - QuantityDimension.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12556")) { + QuantityDimension.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12556)) { builder = - TrustListDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32287")) { + TrustListDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32287)) { builder = - TransactionErrorType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15536")) { + TransactionErrorType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15536)) { builder = - DataTypeSchemaHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14527")) { + DataTypeSchemaHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14527)) { builder = - DataTypeDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "24107")) { + DataTypeDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15489)) { builder = - PortableQualifiedName.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "24109")) { + StructureDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15490)) { + builder = + EnumDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15007)) { + builder = + SimpleTypeDescription.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15008)) { + builder = + UABinaryFileDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 24107)) { + builder = + PortableQualifiedName.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 24108)) { + builder = PortableNodeId.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 24109)) { builder = UnsignedRationalNumber.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14526")) { - builder = FieldMetaData.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14595")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14525)) { + builder = + DataSetMetaDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14526)) { + builder = FieldMetaData.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14595)) { builder = ConfigurationVersionDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15582")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15580)) { + builder = + PublishedDataSetDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15582)) { builder = PublishedDataSetSourceDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14275")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14275)) { builder = PublishedVariableDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15599")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15583)) { builder = - DataSetWriterDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15600")) { + PublishedDataItemsDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15584)) { + builder = + PublishedEventsDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 25271)) { + builder = + PublishedDataSetCustomSourceDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15599)) { + builder = + DataSetWriterDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15600)) { builder = DataSetWriterTransportDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15607")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15607)) { builder = DataSetWriterMessageDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15611")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15611)) { builder = - PubSubGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15613")) { + PubSubGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15482)) { + builder = + WriterGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15613)) { builder = WriterGroupTransportDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15618")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15618)) { builder = WriterGroupMessageDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15619")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15619)) { builder = PubSubConnectionDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15620")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15620)) { builder = ConnectionTransportDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15504")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15504)) { builder = NetworkAddressDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15623")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15512)) { + builder = + NetworkAddressUrlDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15522)) { + builder = + ReaderGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15623)) { builder = ReaderGroupTransportDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15624")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15624)) { builder = ReaderGroupMessageDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15630")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15625)) { + builder = + DataSetReaderDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15630)) { builder = DataSetReaderTransportDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15631")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15631)) { builder = DataSetReaderMessageDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15632")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15632)) { builder = SubscribedDataSetDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "14746")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15633)) { + builder = + TargetVariablesDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 14746)) { + builder = + FieldTargetDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15637)) { builder = - FieldTargetDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15532")) { + SubscribedDataSetMirrorDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15532)) { builder = PubSubConfigurationDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "23603")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23601)) { builder = - SecurityGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "25272")) { + StandaloneSubscribedDataSetRefDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23602)) { + builder = + StandaloneSubscribedDataSetDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23603)) { + builder = + SecurityGroupDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 25272)) { builder = PubSubKeyPushTargetDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "23605")) { - builder = QosDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "25521")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23604)) { + builder = + PubSubConfiguration2DataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15647)) { + builder = + UadpWriterGroupMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15654)) { + builder = + UadpDataSetWriterMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15655)) { + builder = + UadpDataSetReaderMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15659)) { + builder = + JsonWriterGroupMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15666)) { + builder = + JsonDataSetWriterMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15667)) { + builder = + JsonDataSetReaderMessageDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23605)) { + builder = QosDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23606)) { + builder = + TransmitQosDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23607)) { + builder = + TransmitQosPriorityDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23610)) { + builder = + ReceiveQosDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23611)) { + builder = + ReceiveQosPriorityDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 17469)) { + builder = + DatagramConnectionTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23614)) { + builder = + DatagramConnectionTransport2DataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15534)) { + builder = + DatagramWriterGroupTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23615)) { + builder = + DatagramWriterGroupTransport2DataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23616)) { + builder = + DatagramDataSetReaderTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15009)) { + builder = + BrokerConnectionTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15669)) { + builder = + BrokerWriterGroupTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15671)) { + builder = + BrokerDataSetWriterTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15672)) { + builder = + BrokerDataSetReaderTransportDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 25521)) { builder = PubSubConfigurationRefDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "23470")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 25522)) { + builder = + PubSubConfigurationValueDataType.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23470)) { builder = - AliasNameDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "24283")) { + AliasNameDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 24283)) { builder = UserManagementDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "25222")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 25222)) { builder = PriorityMappingEntryType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32661")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32661)) { builder = ReferenceDescriptionDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "32662")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32662)) { builder = ReferenceListEntryDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "98")) { - builder = - RolePermissionType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "99")) { - builder = - DataTypeDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "103")) { - builder = StructureField.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "298")) { - builder = Argument.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "7596")) { - builder = EnumValueType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12757")) { - builder = OptionSet.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "8914")) { - builder = - TimeZoneDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "310")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 98)) { + builder = + RolePermissionType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 99)) { + builder = + DataTypeDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 103)) { + builder = StructureField.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 101)) { + builder = + StructureDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 102)) { + builder = EnumDefinition.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 298)) { + builder = Argument.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 7596)) { + builder = EnumValueType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 104)) { + builder = EnumField.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12757)) { + builder = OptionSet.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 8914)) { + builder = + TimeZoneDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 310)) { builder = ApplicationDescription.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "391")) { - builder = RequestHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "394")) { - builder = ResponseHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "397")) { - builder = ServiceFault.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "15903")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 391)) { + builder = RequestHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 394)) { + builder = ResponseHeader.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 397)) { + builder = ServiceFault.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 15903)) { builder = SessionlessInvokeRequestType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "21001")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 21001)) { builder = SessionlessInvokeResponseType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "422")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 422)) { + builder = + FindServersRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 425)) { builder = - FindServersRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "425")) { + FindServersResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12191)) { builder = - FindServersResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12191")) { - builder = ServerOnNetwork.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12192")) { + ServerOnNetwork.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12192)) { builder = FindServersOnNetworkRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12193")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12193)) { builder = FindServersOnNetworkResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "306")) { - builder = UserTokenPolicy.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "314")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 306)) { builder = - EndpointDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "428")) { + UserTokenPolicy.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 314)) { builder = - GetEndpointsRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "431")) { + EndpointDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 428)) { builder = - GetEndpointsResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "434")) { + GetEndpointsRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 431)) { builder = - RegisteredServer.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "437")) { + GetEndpointsResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 434)) { builder = - RegisterServerRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "440")) { + RegisteredServer.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 437)) { + builder = + RegisterServerRequest.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 440)) { builder = RegisterServerResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12892")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12892)) { builder = DiscoveryConfiguration.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12195")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12893)) { + builder = + MdnsDiscoveryConfiguration.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12195)) { builder = RegisterServer2Request.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12196")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12196)) { builder = RegisterServer2Response.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "443")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 443)) { builder = - ChannelSecurityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "446")) { + ChannelSecurityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 446)) { builder = OpenSecureChannelRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "449")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 449)) { builder = OpenSecureChannelResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "452")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 452)) { builder = CloseSecureChannelRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "455")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 455)) { builder = CloseSecureChannelResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "346")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 346)) { builder = SignedSoftwareCertificate.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "458")) { - builder = SignatureData.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "461")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 458)) { + builder = SignatureData.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 461)) { + builder = + CreateSessionRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 464)) { builder = - CreateSessionRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "464")) { + CreateSessionResponse.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 318)) { builder = - CreateSessionResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "467")) { + UserIdentityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 321)) { + builder = + AnonymousIdentityToken.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 324)) { + builder = + UserNameIdentityToken.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 327)) { + builder = + X509IdentityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 940)) { + builder = + IssuedIdentityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 467)) { builder = ActivateSessionRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "470")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 470)) { builder = ActivateSessionResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "473")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 473)) { + builder = + CloseSessionRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 476)) { builder = - CloseSessionRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "476")) { + CloseSessionResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 479)) { + builder = CancelRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 482)) { + builder = CancelResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 351)) { + builder = NodeAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 354)) { builder = - CloseSessionResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "479")) { - builder = CancelRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "482")) { - builder = CancelResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "351")) { - builder = NodeAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "17608")) { + ObjectAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 357)) { builder = - GenericAttributeValue.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "378")) { - builder = AddNodesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "485")) { - builder = AddNodesResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "488")) { - builder = AddNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "491")) { + VariableAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 360)) { builder = - AddNodesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "381")) { + MethodAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 363)) { builder = - AddReferencesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "494")) { + ObjectTypeAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 366)) { builder = - AddReferencesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "497")) { + VariableTypeAttributes.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 369)) { builder = - AddReferencesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "384")) { - builder = DeleteNodesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "500")) { + ReferenceTypeAttributes.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 372)) { builder = - DeleteNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "503")) { + DataTypeAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 375)) { + builder = ViewAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 17608)) { builder = - DeleteNodesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "387")) { + GenericAttributeValue.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 17609)) { builder = - DeleteReferencesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "506")) { + GenericAttributes.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 378)) { + builder = AddNodesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 485)) { + builder = AddNodesResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 488)) { + builder = + AddNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 491)) { + builder = + AddNodesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 381)) { + builder = + AddReferencesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 494)) { + builder = + AddReferencesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 497)) { + builder = + AddReferencesResponse.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 384)) { + builder = + DeleteNodesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 500)) { + builder = + DeleteNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 503)) { + builder = + DeleteNodesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 387)) { + builder = + DeleteReferencesItem.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 506)) { builder = DeleteReferencesRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "509")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 509)) { builder = DeleteReferencesResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "513")) { - builder = ViewDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "516")) { - builder = - BrowseDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "520")) { - builder = - ReferenceDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "524")) { - builder = BrowseResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "527")) { - builder = BrowseRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "530")) { - builder = BrowseResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "533")) { - builder = - BrowseNextRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "536")) { - builder = - BrowseNextResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "539")) { - builder = - RelativePathElement.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "542")) { - builder = RelativePath.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "545")) { - builder = BrowsePath.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "548")) { - builder = - BrowsePathTarget.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "551")) { - builder = - BrowsePathResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "554")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 513)) { + builder = + ViewDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 516)) { + builder = + BrowseDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 520)) { + builder = + ReferenceDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 524)) { + builder = BrowseResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 527)) { + builder = BrowseRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 530)) { + builder = BrowseResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 533)) { + builder = + BrowseNextRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 536)) { + builder = + BrowseNextResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 539)) { + builder = + RelativePathElement.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 542)) { + builder = RelativePath.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 545)) { + builder = BrowsePath.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 548)) { + builder = + BrowsePathTarget.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 551)) { + builder = + BrowsePathResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 554)) { builder = TranslateBrowsePathsToNodeIdsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "557")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 557)) { builder = TranslateBrowsePathsToNodeIdsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "560")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 560)) { builder = - RegisterNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "563")) { + RegisterNodesRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 563)) { builder = - RegisterNodesResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "566")) { + RegisterNodesResponse.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 566)) { builder = UnregisterNodesRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "569")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 569)) { builder = UnregisterNodesResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "333")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 333)) { + builder = + EndpointConfiguration.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 572)) { + builder = + QueryDataDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 575)) { + builder = + NodeTypeDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 579)) { + builder = QueryDataSet.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 582)) { + builder = NodeReference.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 585)) { + builder = + ContentFilterElement.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 588)) { + builder = ContentFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 591)) { + builder = FilterOperand.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 594)) { + builder = ElementOperand.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 597)) { + builder = LiteralOperand.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 600)) { + builder = + AttributeOperand.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 603)) { + builder = + SimpleAttributeOperand.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 606)) { builder = - EndpointConfiguration.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "572")) { + ContentFilterElementResult.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 609)) { builder = - QueryDataDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "575")) { + ContentFilterResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 612)) { + builder = ParsingResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 615)) { builder = - NodeTypeDescription.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "579")) { - builder = QueryDataSet.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "582")) { - builder = NodeReference.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "585")) { + QueryFirstRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 618)) { builder = - ContentFilterElement.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "588")) { - builder = ContentFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "591")) { - builder = FilterOperand.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "606")) { + QueryFirstResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 621)) { builder = - ContentFilterElementResult.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "609")) { + QueryNextRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 624)) { + builder = + QueryNextResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 628)) { + builder = ReadValueId.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 631)) { + builder = ReadRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 634)) { + builder = ReadResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 637)) { + builder = + HistoryReadValueId.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 640)) { + builder = + HistoryReadResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 643)) { + builder = + HistoryReadDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 646)) { builder = - ContentFilterResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "612")) { - builder = ParsingResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "615")) { + ReadEventDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32801)) { builder = - QueryFirstRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "618")) { + ReadEventDetails2.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 649)) { builder = - QueryFirstResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "621")) { + ReadRawModifiedDetails.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 652)) { builder = - QueryNextRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "624")) { + ReadProcessedDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 655)) { builder = - QueryNextResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "628")) { - builder = ReadValueId.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "631")) { - builder = ReadRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "634")) { - builder = ReadResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "637")) { + ReadAtTimeDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 23499)) { builder = - HistoryReadValueId.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "640")) { + ReadAnnotationDataDetails.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 658)) { + builder = HistoryData.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 11218)) { builder = - HistoryReadResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "643")) { + ModificationInfo.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 11219)) { builder = - HistoryReadDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "658")) { - builder = HistoryData.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "11218")) { + HistoryModifiedData.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 661)) { + builder = HistoryEvent.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 32826)) { builder = - ModificationInfo.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "661")) { - builder = HistoryEvent.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "664")) { + HistoryModifiedEvent.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 664)) { builder = - HistoryReadRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "667")) { + HistoryReadRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 667)) { builder = - HistoryReadResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "670")) { - builder = WriteValue.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "673")) { - builder = WriteRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "676")) { - builder = WriteResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "679")) { + HistoryReadResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 670)) { + builder = WriteValue.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 673)) { + builder = WriteRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 676)) { + builder = WriteResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 679)) { builder = - HistoryUpdateDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "697")) { + HistoryUpdateDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 682)) { builder = - HistoryUpdateResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "700")) { + UpdateDataDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 11297)) { builder = - HistoryUpdateRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "703")) { + UpdateStructureDataDetails.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 685)) { builder = - HistoryUpdateResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "706")) { + UpdateEventDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 688)) { builder = - CallMethodRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "709")) { + DeleteRawModifiedDetails.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 691)) { builder = - CallMethodResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "712")) { - builder = CallRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "715")) { - builder = CallResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "721")) { + DeleteAtTimeDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 694)) { builder = - MonitoringFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "950")) { + DeleteEventDetails.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 697)) { + builder = + HistoryUpdateResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 700)) { + builder = + HistoryUpdateRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 703)) { + builder = + HistoryUpdateResponse.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 706)) { + builder = + CallMethodRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 709)) { + builder = + CallMethodResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 712)) { + builder = CallRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 715)) { + builder = CallResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 721)) { + builder = + MonitoringFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 724)) { + builder = + DataChangeFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 727)) { + builder = EventFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 950)) { builder = AggregateConfiguration.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "733")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 730)) { + builder = + AggregateFilter.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 733)) { builder = MonitoringFilterResult.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "742")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 736)) { + builder = + EventFilterResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 739)) { builder = - MonitoringParameters.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "745")) { + AggregateFilterResult.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 742)) { + builder = + MonitoringParameters.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 745)) { builder = MonitoredItemCreateRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "748")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 748)) { builder = MonitoredItemCreateResult.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "751")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 751)) { builder = CreateMonitoredItemsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "754")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 754)) { builder = CreateMonitoredItemsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "757")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 757)) { builder = MonitoredItemModifyRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "760")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 760)) { builder = MonitoredItemModifyResult.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "763")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 763)) { builder = ModifyMonitoredItemsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "766")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 766)) { builder = ModifyMonitoredItemsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "769")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 769)) { builder = SetMonitoringModeRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "772")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 772)) { builder = SetMonitoringModeResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "775")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 775)) { builder = - SetTriggeringRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "778")) { + SetTriggeringRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 778)) { builder = - SetTriggeringResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "781")) { + SetTriggeringResponse.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 781)) { builder = DeleteMonitoredItemsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "784")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 784)) { builder = DeleteMonitoredItemsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "787")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 787)) { builder = CreateSubscriptionRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "790")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 790)) { builder = CreateSubscriptionResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "793")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 793)) { builder = ModifySubscriptionRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "796")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 796)) { builder = ModifySubscriptionResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "799")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 799)) { builder = SetPublishingModeRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "802")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 802)) { builder = SetPublishingModeResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "805")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 805)) { + builder = + NotificationMessage.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 947)) { builder = - NotificationMessage.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "947")) { + NotificationData.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 811)) { builder = - NotificationData.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "808")) { + DataChangeNotification.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 808)) { builder = MonitoredItemNotification.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "919")) { - builder = EventFieldList.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "922")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 916)) { builder = - HistoryEventFieldList.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "823")) { + EventNotificationList.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 919)) { + builder = EventFieldList.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 922)) { + builder = + HistoryEventFieldList.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 820)) { + builder = + StatusChangeNotification.staticParseExtensionObjectDefinitionBuilder( + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 823)) { builder = SubscriptionAcknowledgement.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "826")) { - builder = PublishRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "829")) { - builder = PublishResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "832")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 826)) { + builder = PublishRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 829)) { builder = - RepublishRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "835")) { + PublishResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 832)) { builder = - RepublishResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "838")) { - builder = TransferResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "841")) { + RepublishRequest.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 835)) { + builder = + RepublishResponse.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 838)) { + builder = TransferResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 841)) { builder = TransferSubscriptionsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "844")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 844)) { builder = TransferSubscriptionsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "847")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 847)) { builder = DeleteSubscriptionsRequest.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "850")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 850)) { builder = DeleteSubscriptionsResponse.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "340")) { - builder = BuildInfo.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "855")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 340)) { + builder = BuildInfo.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 855)) { builder = RedundantServerDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "11945")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 11945)) { builder = EndpointUrlListDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "11946")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 11946)) { builder = - NetworkGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "858")) { + NetworkGroupDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 858)) { builder = SamplingIntervalDiagnosticsDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "861")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 861)) { builder = ServerDiagnosticsSummaryDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "864")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 864)) { builder = - ServerStatusDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "867")) { + ServerStatusDataType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 867)) { builder = SessionDiagnosticsDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "870")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 870)) { builder = SessionSecurityDiagnosticsDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "873")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 873)) { builder = ServiceCounterDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "301")) { - builder = StatusResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "876")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 301)) { + builder = StatusResult.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 876)) { builder = SubscriptionDiagnosticsDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "879")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 879)) { builder = ModelChangeStructureDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "899")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 899)) { builder = SemanticChangeStructureDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "886")) { - builder = Range.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "889")) { - builder = EUInformation.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12173")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 886)) { + builder = Range.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 889)) { + builder = EUInformation.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12173)) { builder = - ComplexNumberType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12174")) { + ComplexNumberType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12174)) { builder = DoubleComplexNumberType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12081")) { - builder = AxisInformation.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "12082")) { - builder = XVType.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "896")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12081)) { + builder = + AxisInformation.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 12082)) { + builder = XVType.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 896)) { builder = ProgramDiagnosticDataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "24035")) { + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 24035)) { builder = ProgramDiagnostic2DataType.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "893")) { - builder = Annotation.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "811")) { - builder = - DataChangeNotification.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "916")) { - builder = - EventNotificationList.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "820")) { - builder = - StatusChangeNotification.staticParseExtensionObjectDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "316")) { - builder = - UserIdentityToken.staticParseExtensionObjectDefinitionBuilder(readBuffer, identifier); + readBuffer, extensionId); + } else if (EvaluationHelper.equals(extensionId, (int) 893)) { + builder = Annotation.staticParseExtensionObjectDefinitionBuilder(readBuffer, extensionId); } if (builder == null) { throw new ParseException( "Unsupported case for discriminated type" + " parameters [" - + "identifier=" - + identifier + + "extensionId=" + + extensionId + "]"); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectEncodingMask.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectEncodingMask.java index 02a131c4a0c..d15c00cccd8 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectEncodingMask.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectEncodingMask.java @@ -39,13 +39,13 @@ public class ExtensionObjectEncodingMask implements Message { // Properties. protected final boolean typeIdSpecified; - protected final boolean xmlbody; + protected final boolean xmlBody; protected final boolean binaryBody; - public ExtensionObjectEncodingMask(boolean typeIdSpecified, boolean xmlbody, boolean binaryBody) { + public ExtensionObjectEncodingMask(boolean typeIdSpecified, boolean xmlBody, boolean binaryBody) { super(); this.typeIdSpecified = typeIdSpecified; - this.xmlbody = xmlbody; + this.xmlBody = xmlBody; this.binaryBody = binaryBody; } @@ -53,8 +53,8 @@ public boolean getTypeIdSpecified() { return typeIdSpecified; } - public boolean getXmlbody() { - return xmlbody; + public boolean getXmlBody() { + return xmlBody; } public boolean getBinaryBody() { @@ -72,8 +72,8 @@ public void serialize(WriteBuffer writeBuffer) throws SerializationException { // Simple Field (typeIdSpecified) writeSimpleField("typeIdSpecified", typeIdSpecified, writeBoolean(writeBuffer)); - // Simple Field (xmlbody) - writeSimpleField("xmlbody", xmlbody, writeBoolean(writeBuffer)); + // Simple Field (xmlBody) + writeSimpleField("xmlBody", xmlBody, writeBoolean(writeBuffer)); // Simple Field (binaryBody) writeSimpleField("binaryBody", binaryBody, writeBoolean(writeBuffer)); @@ -98,7 +98,7 @@ public int getLengthInBits() { // Simple field (typeIdSpecified) lengthInBits += 1; - // Simple field (xmlbody) + // Simple field (xmlBody) lengthInBits += 1; // Simple field (binaryBody) @@ -117,7 +117,7 @@ public static ExtensionObjectEncodingMask staticParse(ReadBuffer readBuffer) boolean typeIdSpecified = readSimpleField("typeIdSpecified", readBoolean(readBuffer)); - boolean xmlbody = readSimpleField("xmlbody", readBoolean(readBuffer)); + boolean xmlBody = readSimpleField("xmlBody", readBoolean(readBuffer)); boolean binaryBody = readSimpleField("binaryBody", readBoolean(readBuffer)); @@ -125,7 +125,7 @@ public static ExtensionObjectEncodingMask staticParse(ReadBuffer readBuffer) // Create the instance ExtensionObjectEncodingMask _extensionObjectEncodingMask; _extensionObjectEncodingMask = - new ExtensionObjectEncodingMask(typeIdSpecified, xmlbody, binaryBody); + new ExtensionObjectEncodingMask(typeIdSpecified, xmlBody, binaryBody); return _extensionObjectEncodingMask; } @@ -139,14 +139,14 @@ public boolean equals(Object o) { } ExtensionObjectEncodingMask that = (ExtensionObjectEncodingMask) o; return (getTypeIdSpecified() == that.getTypeIdSpecified()) - && (getXmlbody() == that.getXmlbody()) + && (getXmlBody() == that.getXmlBody()) && (getBinaryBody() == that.getBinaryBody()) && true; } @Override public int hashCode() { - return Objects.hash(getTypeIdSpecified(), getXmlbody(), getBinaryBody()); + return Objects.hash(getTypeIdSpecified(), getXmlBody(), getBinaryBody()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectWithMask.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectWithMask.java new file mode 100644 index 00000000000..e689059bcbf --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ExtensionObjectWithMask.java @@ -0,0 +1,189 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public abstract class ExtensionObjectWithMask extends ExtensionObject implements Message { + + // Accessors for discriminator values. + public Boolean getIncludeEncodingMask() { + return (boolean) true; + } + + // Abstract accessors for discriminator values. + public abstract Boolean getEncodingMaskBinaryBody(); + + public abstract Boolean getEncodingMaskXmlBody(); + + // Properties. + protected final ExtensionObjectEncodingMask encodingMask; + + public ExtensionObjectWithMask(ExpandedNodeId typeId, ExtensionObjectEncodingMask encodingMask) { + super(typeId); + this.encodingMask = encodingMask; + } + + public ExtensionObjectEncodingMask getEncodingMask() { + return encodingMask; + } + + protected abstract void serializeExtensionObjectWithMaskChild(WriteBuffer writeBuffer) + throws SerializationException; + + @Override + protected void serializeExtensionObjectChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ExtensionObjectWithMask"); + + // Simple Field (encodingMask) + writeSimpleField("encodingMask", encodingMask, writeComplex(writeBuffer)); + + // Switch field (Serialize the sub-type) + serializeExtensionObjectWithMaskChild(writeBuffer); + + writeBuffer.popContext("ExtensionObjectWithMask"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ExtensionObjectWithMask _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (encodingMask) + lengthInBits += encodingMask.getLengthInBits(); + + // Length of sub-type elements will be added by sub-type... + + return lengthInBits; + } + + public static ExtensionObjectBuilder staticParseExtensionObjectBuilder( + ReadBuffer readBuffer, Integer extensionId, Boolean includeEncodingMask) + throws ParseException { + readBuffer.pullContext("ExtensionObjectWithMask"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + ExtensionObjectEncodingMask encodingMask = + readSimpleField( + "encodingMask", + readComplex(() -> ExtensionObjectEncodingMask.staticParse(readBuffer), readBuffer)); + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + ExtensionObjectWithMaskBuilder builder = null; + if (EvaluationHelper.equals(encodingMask.getXmlBody(), (boolean) false) + && EvaluationHelper.equals(encodingMask.getBinaryBody(), (boolean) true)) { + builder = + BinaryExtensionObjectWithMask.staticParseExtensionObjectWithMaskBuilder( + readBuffer, extensionId, includeEncodingMask); + } else if (EvaluationHelper.equals(encodingMask.getXmlBody(), (boolean) false) + && EvaluationHelper.equals(encodingMask.getBinaryBody(), (boolean) false)) { + builder = + NullExtensionObjectWithMask.staticParseExtensionObjectWithMaskBuilder( + readBuffer, extensionId, includeEncodingMask); + } + if (builder == null) { + throw new ParseException( + "Unsupported case for discriminated type" + + " parameters [" + + "encodingMaskxmlBody=" + + encodingMask.getXmlBody() + + " " + + "encodingMaskbinaryBody=" + + encodingMask.getBinaryBody() + + "]"); + } + + readBuffer.closeContext("ExtensionObjectWithMask"); + // Create the instance + return new ExtensionObjectWithMaskBuilderImpl(encodingMask, builder); + } + + public interface ExtensionObjectWithMaskBuilder { + ExtensionObjectWithMask build(ExpandedNodeId typeId, ExtensionObjectEncodingMask encodingMask); + } + + public static class ExtensionObjectWithMaskBuilderImpl + implements ExtensionObject.ExtensionObjectBuilder { + private final ExtensionObjectEncodingMask encodingMask; + private final ExtensionObjectWithMaskBuilder builder; + + public ExtensionObjectWithMaskBuilderImpl( + ExtensionObjectEncodingMask encodingMask, ExtensionObjectWithMaskBuilder builder) { + this.encodingMask = encodingMask; + this.builder = builder; + } + + public ExtensionObjectWithMask build(ExpandedNodeId typeId) { + return builder.build(typeId, encodingMask); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ExtensionObjectWithMask)) { + return false; + } + ExtensionObjectWithMask that = (ExtensionObjectWithMask) o; + return (getEncodingMask() == that.getEncodingMask()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getEncodingMask()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldMetaData.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldMetaData.java index 9ca375ce690..6f81888abe2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldMetaData.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldMetaData.java @@ -38,8 +38,8 @@ public class FieldMetaData extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14526"; + public Integer getExtensionId() { + return (int) 14526; } // Properties. @@ -49,12 +49,10 @@ public String getIdentifier() { protected final short builtInType; protected final NodeId dataType; protected final int valueRank; - protected final int noOfArrayDimensions; protected final List arrayDimensions; protected final long maxStringLength; protected final GuidValue dataSetFieldId; - protected final int noOfProperties; - protected final List properties; + protected final List properties; public FieldMetaData( PascalString name, @@ -63,12 +61,10 @@ public FieldMetaData( short builtInType, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, long maxStringLength, GuidValue dataSetFieldId, - int noOfProperties, - List properties) { + List properties) { super(); this.name = name; this.description = description; @@ -76,11 +72,9 @@ public FieldMetaData( this.builtInType = builtInType; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.maxStringLength = maxStringLength; this.dataSetFieldId = dataSetFieldId; - this.noOfProperties = noOfProperties; this.properties = properties; } @@ -108,10 +102,6 @@ public int getValueRank() { return valueRank; } - public int getNoOfArrayDimensions() { - return noOfArrayDimensions; - } - public List getArrayDimensions() { return arrayDimensions; } @@ -124,11 +114,7 @@ public GuidValue getDataSetFieldId() { return dataSetFieldId; } - public int getNoOfProperties() { - return noOfProperties; - } - - public List getProperties() { + public List getProperties() { return properties; } @@ -164,8 +150,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (valueRank) writeSimpleField("valueRank", valueRank, writeSignedInt(writeBuffer, 32)); - // Simple Field (noOfArrayDimensions) - writeSimpleField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfArrayDimensions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfArrayDimensions = + (int) ((((getArrayDimensions()) == (null)) ? -(1) : COUNT(getArrayDimensions()))); + writeImplicitField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); // Array Field (arrayDimensions) writeSimpleTypeArrayField( @@ -177,8 +166,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (dataSetFieldId) writeSimpleField("dataSetFieldId", dataSetFieldId, writeComplex(writeBuffer)); - // Simple Field (noOfProperties) - writeSimpleField("noOfProperties", noOfProperties, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfProperties) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfProperties = (int) ((((getProperties()) == (null)) ? -(1) : COUNT(getProperties()))); + writeImplicitField("noOfProperties", noOfProperties, writeSignedInt(writeBuffer, 32)); // Array Field (properties) writeComplexTypeArrayField("properties", properties, writeBuffer); @@ -215,7 +206,7 @@ public int getLengthInBits() { // Simple field (valueRank) lengthInBits += 32; - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32; // Array field @@ -229,13 +220,13 @@ public int getLengthInBits() { // Simple field (dataSetFieldId) lengthInBits += dataSetFieldId.getLengthInBits(); - // Simple field (noOfProperties) + // Implicit Field (noOfProperties) lengthInBits += 32; // Array field if (properties != null) { int i = 0; - for (ExtensionObjectDefinition element : properties) { + for (KeyValuePair element : properties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= properties.size()); lengthInBits += element.getLengthInBits(); } @@ -245,7 +236,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FieldMetaData"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -271,7 +262,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit int valueRank = readSimpleField("valueRank", readSignedInt(readBuffer, 32)); - int noOfArrayDimensions = readSimpleField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); + int noOfArrayDimensions = + readImplicitField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); List arrayDimensions = readCountArrayField( @@ -283,13 +275,14 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "dataSetFieldId", readComplex(() -> GuidValue.staticParse(readBuffer), readBuffer)); - int noOfProperties = readSimpleField("noOfProperties", readSignedInt(readBuffer, 32)); + int noOfProperties = readImplicitField("noOfProperties", readSignedInt(readBuffer, 32)); - List properties = + List properties = readCountArrayField( "properties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfProperties); @@ -302,11 +295,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit builtInType, dataType, valueRank, - noOfArrayDimensions, arrayDimensions, maxStringLength, dataSetFieldId, - noOfProperties, properties); } @@ -318,12 +309,10 @@ public static class FieldMetaDataBuilderImpl private final short builtInType; private final NodeId dataType; private final int valueRank; - private final int noOfArrayDimensions; private final List arrayDimensions; private final long maxStringLength; private final GuidValue dataSetFieldId; - private final int noOfProperties; - private final List properties; + private final List properties; public FieldMetaDataBuilderImpl( PascalString name, @@ -332,23 +321,19 @@ public FieldMetaDataBuilderImpl( short builtInType, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, long maxStringLength, GuidValue dataSetFieldId, - int noOfProperties, - List properties) { + List properties) { this.name = name; this.description = description; this.fieldFlags = fieldFlags; this.builtInType = builtInType; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.maxStringLength = maxStringLength; this.dataSetFieldId = dataSetFieldId; - this.noOfProperties = noOfProperties; this.properties = properties; } @@ -361,11 +346,9 @@ public FieldMetaData build() { builtInType, dataType, valueRank, - noOfArrayDimensions, arrayDimensions, maxStringLength, dataSetFieldId, - noOfProperties, properties); return fieldMetaData; } @@ -386,11 +369,9 @@ public boolean equals(Object o) { && (getBuiltInType() == that.getBuiltInType()) && (getDataType() == that.getDataType()) && (getValueRank() == that.getValueRank()) - && (getNoOfArrayDimensions() == that.getNoOfArrayDimensions()) && (getArrayDimensions() == that.getArrayDimensions()) && (getMaxStringLength() == that.getMaxStringLength()) && (getDataSetFieldId() == that.getDataSetFieldId()) - && (getNoOfProperties() == that.getNoOfProperties()) && (getProperties() == that.getProperties()) && super.equals(that) && true; @@ -406,11 +387,9 @@ public int hashCode() { getBuiltInType(), getDataType(), getValueRank(), - getNoOfArrayDimensions(), getArrayDimensions(), getMaxStringLength(), getDataSetFieldId(), - getNoOfProperties(), getProperties()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldTargetDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldTargetDataType.java index 1ce95fa8cf3..569bcf6cfeb 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldTargetDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FieldTargetDataType.java @@ -38,8 +38,8 @@ public class FieldTargetDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14746"; + public Integer getExtensionId() { + return (int) 14746; } // Properties. @@ -171,7 +171,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FieldTargetDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FilterOperand.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FilterOperand.java index 78ed72819d9..7d2561184e2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FilterOperand.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FilterOperand.java @@ -38,8 +38,8 @@ public class FilterOperand extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "591"; + public Integer getExtensionId() { + return (int) 591; } public FilterOperand() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FilterOperand"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkRequest.java index aaa658c18d5..91905d8e6fc 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkRequest.java @@ -38,32 +38,29 @@ public class FindServersOnNetworkRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12192"; + public Integer getExtensionId() { + return (int) 12192; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long startingRecordId; protected final long maxRecordsToReturn; - protected final int noOfServerCapabilityFilter; protected final List serverCapabilityFilter; public FindServersOnNetworkRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long startingRecordId, long maxRecordsToReturn, - int noOfServerCapabilityFilter, List serverCapabilityFilter) { super(); this.requestHeader = requestHeader; this.startingRecordId = startingRecordId; this.maxRecordsToReturn = maxRecordsToReturn; - this.noOfServerCapabilityFilter = noOfServerCapabilityFilter; this.serverCapabilityFilter = serverCapabilityFilter; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -75,10 +72,6 @@ public long getMaxRecordsToReturn() { return maxRecordsToReturn; } - public int getNoOfServerCapabilityFilter() { - return noOfServerCapabilityFilter; - } - public List getServerCapabilityFilter() { return serverCapabilityFilter; } @@ -99,8 +92,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (maxRecordsToReturn) writeSimpleField("maxRecordsToReturn", maxRecordsToReturn, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfServerCapabilityFilter) - writeSimpleField( + // Implicit Field (noOfServerCapabilityFilter) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfServerCapabilityFilter = + (int) + ((((getServerCapabilityFilter()) == (null)) + ? -(1) + : COUNT(getServerCapabilityFilter()))); + writeImplicitField( "noOfServerCapabilityFilter", noOfServerCapabilityFilter, writeSignedInt(writeBuffer, 32)); // Array Field (serverCapabilityFilter) @@ -129,7 +128,7 @@ public int getLengthInBits() { // Simple field (maxRecordsToReturn) lengthInBits += 32; - // Simple field (noOfServerCapabilityFilter) + // Implicit Field (noOfServerCapabilityFilter) lengthInBits += 32; // Array field @@ -145,16 +144,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FindServersOnNetworkRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long startingRecordId = readSimpleField("startingRecordId", readUnsignedLong(readBuffer, 32)); @@ -163,7 +163,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField("maxRecordsToReturn", readUnsignedLong(readBuffer, 32)); int noOfServerCapabilityFilter = - readSimpleField("noOfServerCapabilityFilter", readSignedInt(readBuffer, 32)); + readImplicitField("noOfServerCapabilityFilter", readSignedInt(readBuffer, 32)); List serverCapabilityFilter = readCountArrayField( @@ -174,42 +174,31 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("FindServersOnNetworkRequest"); // Create the instance return new FindServersOnNetworkRequestBuilderImpl( - requestHeader, - startingRecordId, - maxRecordsToReturn, - noOfServerCapabilityFilter, - serverCapabilityFilter); + requestHeader, startingRecordId, maxRecordsToReturn, serverCapabilityFilter); } public static class FindServersOnNetworkRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long startingRecordId; private final long maxRecordsToReturn; - private final int noOfServerCapabilityFilter; private final List serverCapabilityFilter; public FindServersOnNetworkRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long startingRecordId, long maxRecordsToReturn, - int noOfServerCapabilityFilter, List serverCapabilityFilter) { this.requestHeader = requestHeader; this.startingRecordId = startingRecordId; this.maxRecordsToReturn = maxRecordsToReturn; - this.noOfServerCapabilityFilter = noOfServerCapabilityFilter; this.serverCapabilityFilter = serverCapabilityFilter; } public FindServersOnNetworkRequest build() { FindServersOnNetworkRequest findServersOnNetworkRequest = new FindServersOnNetworkRequest( - requestHeader, - startingRecordId, - maxRecordsToReturn, - noOfServerCapabilityFilter, - serverCapabilityFilter); + requestHeader, startingRecordId, maxRecordsToReturn, serverCapabilityFilter); return findServersOnNetworkRequest; } } @@ -226,7 +215,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getStartingRecordId() == that.getStartingRecordId()) && (getMaxRecordsToReturn() == that.getMaxRecordsToReturn()) - && (getNoOfServerCapabilityFilter() == that.getNoOfServerCapabilityFilter()) && (getServerCapabilityFilter() == that.getServerCapabilityFilter()) && super.equals(that) && true; @@ -239,7 +227,6 @@ public int hashCode() { getRequestHeader(), getStartingRecordId(), getMaxRecordsToReturn(), - getNoOfServerCapabilityFilter(), getServerCapabilityFilter()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkResponse.java index 0f952a6b8ad..cb3a0f9a1a5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersOnNetworkResponse.java @@ -38,29 +38,24 @@ public class FindServersOnNetworkResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12193"; + public Integer getExtensionId() { + return (int) 12193; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final long lastCounterResetTime; - protected final int noOfServers; - protected final List servers; + protected final List servers; public FindServersOnNetworkResponse( - ExtensionObjectDefinition responseHeader, - long lastCounterResetTime, - int noOfServers, - List servers) { + ResponseHeader responseHeader, long lastCounterResetTime, List servers) { super(); this.responseHeader = responseHeader; this.lastCounterResetTime = lastCounterResetTime; - this.noOfServers = noOfServers; this.servers = servers; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -68,11 +63,7 @@ public long getLastCounterResetTime() { return lastCounterResetTime; } - public int getNoOfServers() { - return noOfServers; - } - - public List getServers() { + public List getServers() { return servers; } @@ -90,8 +81,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeSimpleField( "lastCounterResetTime", lastCounterResetTime, writeSignedLong(writeBuffer, 64)); - // Simple Field (noOfServers) - writeSimpleField("noOfServers", noOfServers, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServers) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServers = (int) ((((getServers()) == (null)) ? -(1) : COUNT(getServers()))); + writeImplicitField("noOfServers", noOfServers, writeSignedInt(writeBuffer, 32)); // Array Field (servers) writeComplexTypeArrayField("servers", servers, writeBuffer); @@ -116,13 +109,13 @@ public int getLengthInBits() { // Simple field (lastCounterResetTime) lengthInBits += 64; - // Simple field (noOfServers) + // Implicit Field (noOfServers) lengthInBits += 32; // Array field if (servers != null) { int i = 0; - for (ExtensionObjectDefinition element : servers) { + for (ServerOnNetwork element : servers) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= servers.size()); lengthInBits += element.getLengthInBits(); } @@ -132,59 +125,56 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FindServersOnNetworkResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); long lastCounterResetTime = readSimpleField("lastCounterResetTime", readSignedLong(readBuffer, 64)); - int noOfServers = readSimpleField("noOfServers", readSignedInt(readBuffer, 32)); + int noOfServers = readImplicitField("noOfServers", readSignedInt(readBuffer, 32)); - List servers = + List servers = readCountArrayField( "servers", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("12191")), + () -> + (ServerOnNetwork) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (12191)), readBuffer), noOfServers); readBuffer.closeContext("FindServersOnNetworkResponse"); // Create the instance return new FindServersOnNetworkResponseBuilderImpl( - responseHeader, lastCounterResetTime, noOfServers, servers); + responseHeader, lastCounterResetTime, servers); } public static class FindServersOnNetworkResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final long lastCounterResetTime; - private final int noOfServers; - private final List servers; + private final List servers; public FindServersOnNetworkResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - long lastCounterResetTime, - int noOfServers, - List servers) { + ResponseHeader responseHeader, long lastCounterResetTime, List servers) { this.responseHeader = responseHeader; this.lastCounterResetTime = lastCounterResetTime; - this.noOfServers = noOfServers; this.servers = servers; } public FindServersOnNetworkResponse build() { FindServersOnNetworkResponse findServersOnNetworkResponse = - new FindServersOnNetworkResponse( - responseHeader, lastCounterResetTime, noOfServers, servers); + new FindServersOnNetworkResponse(responseHeader, lastCounterResetTime, servers); return findServersOnNetworkResponse; } } @@ -200,7 +190,6 @@ public boolean equals(Object o) { FindServersOnNetworkResponse that = (FindServersOnNetworkResponse) o; return (getResponseHeader() == that.getResponseHeader()) && (getLastCounterResetTime() == that.getLastCounterResetTime()) - && (getNoOfServers() == that.getNoOfServers()) && (getServers() == that.getServers()) && super.equals(that) && true; @@ -209,11 +198,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getResponseHeader(), - getLastCounterResetTime(), - getNoOfServers(), - getServers()); + super.hashCode(), getResponseHeader(), getLastCounterResetTime(), getServers()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersRequest.java index 3e793211f51..e5b79527ca2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersRequest.java @@ -38,35 +38,29 @@ public class FindServersRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "422"; + public Integer getExtensionId() { + return (int) 422; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final PascalString endpointUrl; - protected final int noOfLocaleIds; protected final List localeIds; - protected final int noOfServerUris; protected final List serverUris; public FindServersRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, - int noOfServerUris, List serverUris) { super(); this.requestHeader = requestHeader; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -74,18 +68,10 @@ public PascalString getEndpointUrl() { return endpointUrl; } - public int getNoOfLocaleIds() { - return noOfLocaleIds; - } - public List getLocaleIds() { return localeIds; } - public int getNoOfServerUris() { - return noOfServerUris; - } - public List getServerUris() { return serverUris; } @@ -103,14 +89,18 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (endpointUrl) writeSimpleField("endpointUrl", endpointUrl, writeComplex(writeBuffer)); - // Simple Field (noOfLocaleIds) - writeSimpleField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); // Array Field (localeIds) writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); - // Simple Field (noOfServerUris) - writeSimpleField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServerUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServerUris = (int) ((((getServerUris()) == (null)) ? -(1) : COUNT(getServerUris()))); + writeImplicitField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); // Array Field (serverUris) writeComplexTypeArrayField("serverUris", serverUris, writeBuffer); @@ -135,7 +125,7 @@ public int getLengthInBits() { // Simple field (endpointUrl) lengthInBits += endpointUrl.getLengthInBits(); - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32; // Array field @@ -147,7 +137,7 @@ public int getLengthInBits() { } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32; // Array field @@ -163,23 +153,24 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FindServersRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); PascalString endpointUrl = readSimpleField( "endpointUrl", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfLocaleIds = readSimpleField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); List localeIds = readCountArrayField( @@ -187,7 +178,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), noOfLocaleIds); - int noOfServerUris = readSimpleField("noOfServerUris", readSignedInt(readBuffer, 32)); + int noOfServerUris = readImplicitField("noOfServerUris", readSignedInt(readBuffer, 32)); List serverUris = readCountArrayField( @@ -197,38 +188,30 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("FindServersRequest"); // Create the instance - return new FindServersRequestBuilderImpl( - requestHeader, endpointUrl, noOfLocaleIds, localeIds, noOfServerUris, serverUris); + return new FindServersRequestBuilderImpl(requestHeader, endpointUrl, localeIds, serverUris); } public static class FindServersRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final PascalString endpointUrl; - private final int noOfLocaleIds; private final List localeIds; - private final int noOfServerUris; private final List serverUris; public FindServersRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, - int noOfServerUris, List serverUris) { this.requestHeader = requestHeader; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; } public FindServersRequest build() { FindServersRequest findServersRequest = - new FindServersRequest( - requestHeader, endpointUrl, noOfLocaleIds, localeIds, noOfServerUris, serverUris); + new FindServersRequest(requestHeader, endpointUrl, localeIds, serverUris); return findServersRequest; } } @@ -244,9 +227,7 @@ public boolean equals(Object o) { FindServersRequest that = (FindServersRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getEndpointUrl() == that.getEndpointUrl()) - && (getNoOfLocaleIds() == that.getNoOfLocaleIds()) && (getLocaleIds() == that.getLocaleIds()) - && (getNoOfServerUris() == that.getNoOfServerUris()) && (getServerUris() == that.getServerUris()) && super.equals(that) && true; @@ -255,13 +236,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getEndpointUrl(), - getNoOfLocaleIds(), - getLocaleIds(), - getNoOfServerUris(), - getServerUris()); + super.hashCode(), getRequestHeader(), getEndpointUrl(), getLocaleIds(), getServerUris()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersResponse.java index 675aece98fb..fea79816810 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/FindServersResponse.java @@ -38,34 +38,25 @@ public class FindServersResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "425"; + public Integer getExtensionId() { + return (int) 425; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfServers; - protected final List servers; - - public FindServersResponse( - ExtensionObjectDefinition responseHeader, - int noOfServers, - List servers) { + protected final ResponseHeader responseHeader; + protected final List servers; + + public FindServersResponse(ResponseHeader responseHeader, List servers) { super(); this.responseHeader = responseHeader; - this.noOfServers = noOfServers; this.servers = servers; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfServers() { - return noOfServers; - } - - public List getServers() { + public List getServers() { return servers; } @@ -79,8 +70,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfServers) - writeSimpleField("noOfServers", noOfServers, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServers) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServers = (int) ((((getServers()) == (null)) ? -(1) : COUNT(getServers()))); + writeImplicitField("noOfServers", noOfServers, writeSignedInt(writeBuffer, 32)); // Array Field (servers) writeComplexTypeArrayField("servers", servers, writeBuffer); @@ -102,13 +95,13 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfServers) + // Implicit Field (noOfServers) lengthInBits += 32; // Array field if (servers != null) { int i = 0; - for (ExtensionObjectDefinition element : servers) { + for (ApplicationDescription element : servers) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= servers.size()); lengthInBits += element.getLengthInBits(); } @@ -118,51 +111,49 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("FindServersResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfServers = readSimpleField("noOfServers", readSignedInt(readBuffer, 32)); + int noOfServers = readImplicitField("noOfServers", readSignedInt(readBuffer, 32)); - List servers = + List servers = readCountArrayField( "servers", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("310")), + () -> + (ApplicationDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (310)), readBuffer), noOfServers); readBuffer.closeContext("FindServersResponse"); // Create the instance - return new FindServersResponseBuilderImpl(responseHeader, noOfServers, servers); + return new FindServersResponseBuilderImpl(responseHeader, servers); } public static class FindServersResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfServers; - private final List servers; + private final ResponseHeader responseHeader; + private final List servers; public FindServersResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfServers, - List servers) { + ResponseHeader responseHeader, List servers) { this.responseHeader = responseHeader; - this.noOfServers = noOfServers; this.servers = servers; } public FindServersResponse build() { - FindServersResponse findServersResponse = - new FindServersResponse(responseHeader, noOfServers, servers); + FindServersResponse findServersResponse = new FindServersResponse(responseHeader, servers); return findServersResponse; } } @@ -177,7 +168,6 @@ public boolean equals(Object o) { } FindServersResponse that = (FindServersResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfServers() == that.getNoOfServers()) && (getServers() == that.getServers()) && super.equals(that) && true; @@ -185,7 +175,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getResponseHeader(), getNoOfServers(), getServers()); + return Objects.hash(super.hashCode(), getResponseHeader(), getServers()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Frame.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Frame.java index eb2cef0ffca..958f1a45326 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Frame.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Frame.java @@ -38,8 +38,8 @@ public class Frame extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "18815"; + public Integer getExtensionId() { + return (int) 18815; } public Frame() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Frame"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributeValue.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributeValue.java index b24352dc4c9..a6ec426d302 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributeValue.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributeValue.java @@ -38,8 +38,8 @@ public class GenericAttributeValue extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "17608"; + public Integer getExtensionId() { + return (int) 17608; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("GenericAttributeValue"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributes.java new file mode 100644 index 00000000000..a73dbd6f174 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GenericAttributes.java @@ -0,0 +1,287 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class GenericAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 17609; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final List attributeValues; + + public GenericAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + List attributeValues) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.attributeValues = attributeValues; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public List getAttributeValues() { + return attributeValues; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("GenericAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Implicit Field (noOfAttributeValues) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfAttributeValues = + (int) ((((getAttributeValues()) == (null)) ? -(1) : COUNT(getAttributeValues()))); + writeImplicitField("noOfAttributeValues", noOfAttributeValues, writeSignedInt(writeBuffer, 32)); + + // Array Field (attributeValues) + writeComplexTypeArrayField("attributeValues", attributeValues, writeBuffer); + + writeBuffer.popContext("GenericAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + GenericAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Implicit Field (noOfAttributeValues) + lengthInBits += 32; + + // Array field + if (attributeValues != null) { + int i = 0; + for (GenericAttributeValue element : attributeValues) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= attributeValues.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("GenericAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + int noOfAttributeValues = + readImplicitField("noOfAttributeValues", readSignedInt(readBuffer, 32)); + + List attributeValues = + readCountArrayField( + "attributeValues", + readComplex( + () -> + (GenericAttributeValue) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (17608)), + readBuffer), + noOfAttributeValues); + + readBuffer.closeContext("GenericAttributes"); + // Create the instance + return new GenericAttributesBuilderImpl( + specifiedAttributes, displayName, description, writeMask, userWriteMask, attributeValues); + } + + public static class GenericAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final List attributeValues; + + public GenericAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + List attributeValues) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.attributeValues = attributeValues; + } + + public GenericAttributes build() { + GenericAttributes genericAttributes = + new GenericAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + attributeValues); + return genericAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof GenericAttributes)) { + return false; + } + GenericAttributes that = (GenericAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getAttributeValues() == that.getAttributeValues()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getAttributeValues()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsRequest.java index 09341b0ee1f..09265fe7e27 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsRequest.java @@ -38,35 +38,29 @@ public class GetEndpointsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "428"; + public Integer getExtensionId() { + return (int) 428; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final PascalString endpointUrl; - protected final int noOfLocaleIds; protected final List localeIds; - protected final int noOfProfileUris; protected final List profileUris; public GetEndpointsRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, - int noOfProfileUris, List profileUris) { super(); this.requestHeader = requestHeader; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; - this.noOfProfileUris = noOfProfileUris; this.profileUris = profileUris; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -74,18 +68,10 @@ public PascalString getEndpointUrl() { return endpointUrl; } - public int getNoOfLocaleIds() { - return noOfLocaleIds; - } - public List getLocaleIds() { return localeIds; } - public int getNoOfProfileUris() { - return noOfProfileUris; - } - public List getProfileUris() { return profileUris; } @@ -103,14 +89,18 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (endpointUrl) writeSimpleField("endpointUrl", endpointUrl, writeComplex(writeBuffer)); - // Simple Field (noOfLocaleIds) - writeSimpleField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); // Array Field (localeIds) writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); - // Simple Field (noOfProfileUris) - writeSimpleField("noOfProfileUris", noOfProfileUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfProfileUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfProfileUris = (int) ((((getProfileUris()) == (null)) ? -(1) : COUNT(getProfileUris()))); + writeImplicitField("noOfProfileUris", noOfProfileUris, writeSignedInt(writeBuffer, 32)); // Array Field (profileUris) writeComplexTypeArrayField("profileUris", profileUris, writeBuffer); @@ -135,7 +125,7 @@ public int getLengthInBits() { // Simple field (endpointUrl) lengthInBits += endpointUrl.getLengthInBits(); - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32; // Array field @@ -147,7 +137,7 @@ public int getLengthInBits() { } } - // Simple field (noOfProfileUris) + // Implicit Field (noOfProfileUris) lengthInBits += 32; // Array field @@ -163,23 +153,24 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("GetEndpointsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); PascalString endpointUrl = readSimpleField( "endpointUrl", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfLocaleIds = readSimpleField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); List localeIds = readCountArrayField( @@ -187,7 +178,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), noOfLocaleIds); - int noOfProfileUris = readSimpleField("noOfProfileUris", readSignedInt(readBuffer, 32)); + int noOfProfileUris = readImplicitField("noOfProfileUris", readSignedInt(readBuffer, 32)); List profileUris = readCountArrayField( @@ -197,38 +188,30 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("GetEndpointsRequest"); // Create the instance - return new GetEndpointsRequestBuilderImpl( - requestHeader, endpointUrl, noOfLocaleIds, localeIds, noOfProfileUris, profileUris); + return new GetEndpointsRequestBuilderImpl(requestHeader, endpointUrl, localeIds, profileUris); } public static class GetEndpointsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final PascalString endpointUrl; - private final int noOfLocaleIds; private final List localeIds; - private final int noOfProfileUris; private final List profileUris; public GetEndpointsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, - int noOfProfileUris, List profileUris) { this.requestHeader = requestHeader; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; - this.noOfProfileUris = noOfProfileUris; this.profileUris = profileUris; } public GetEndpointsRequest build() { GetEndpointsRequest getEndpointsRequest = - new GetEndpointsRequest( - requestHeader, endpointUrl, noOfLocaleIds, localeIds, noOfProfileUris, profileUris); + new GetEndpointsRequest(requestHeader, endpointUrl, localeIds, profileUris); return getEndpointsRequest; } } @@ -244,9 +227,7 @@ public boolean equals(Object o) { GetEndpointsRequest that = (GetEndpointsRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getEndpointUrl() == that.getEndpointUrl()) - && (getNoOfLocaleIds() == that.getNoOfLocaleIds()) && (getLocaleIds() == that.getLocaleIds()) - && (getNoOfProfileUris() == that.getNoOfProfileUris()) && (getProfileUris() == that.getProfileUris()) && super.equals(that) && true; @@ -255,13 +236,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getEndpointUrl(), - getNoOfLocaleIds(), - getLocaleIds(), - getNoOfProfileUris(), - getProfileUris()); + super.hashCode(), getRequestHeader(), getEndpointUrl(), getLocaleIds(), getProfileUris()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsResponse.java index 49a60f94038..ab0b3ccf827 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/GetEndpointsResponse.java @@ -38,34 +38,25 @@ public class GetEndpointsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "431"; + public Integer getExtensionId() { + return (int) 431; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfEndpoints; - protected final List endpoints; - - public GetEndpointsResponse( - ExtensionObjectDefinition responseHeader, - int noOfEndpoints, - List endpoints) { + protected final ResponseHeader responseHeader; + protected final List endpoints; + + public GetEndpointsResponse(ResponseHeader responseHeader, List endpoints) { super(); this.responseHeader = responseHeader; - this.noOfEndpoints = noOfEndpoints; this.endpoints = endpoints; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfEndpoints() { - return noOfEndpoints; - } - - public List getEndpoints() { + public List getEndpoints() { return endpoints; } @@ -79,8 +70,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfEndpoints) - writeSimpleField("noOfEndpoints", noOfEndpoints, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEndpoints) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEndpoints = (int) ((((getEndpoints()) == (null)) ? -(1) : COUNT(getEndpoints()))); + writeImplicitField("noOfEndpoints", noOfEndpoints, writeSignedInt(writeBuffer, 32)); // Array Field (endpoints) writeComplexTypeArrayField("endpoints", endpoints, writeBuffer); @@ -102,13 +95,13 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfEndpoints) + // Implicit Field (noOfEndpoints) lengthInBits += 32; // Array field if (endpoints != null) { int i = 0; - for (ExtensionObjectDefinition element : endpoints) { + for (EndpointDescription element : endpoints) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= endpoints.size()); lengthInBits += element.getLengthInBits(); } @@ -118,51 +111,50 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("GetEndpointsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfEndpoints = readSimpleField("noOfEndpoints", readSignedInt(readBuffer, 32)); + int noOfEndpoints = readImplicitField("noOfEndpoints", readSignedInt(readBuffer, 32)); - List endpoints = + List endpoints = readCountArrayField( "endpoints", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("314")), + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), readBuffer), noOfEndpoints); readBuffer.closeContext("GetEndpointsResponse"); // Create the instance - return new GetEndpointsResponseBuilderImpl(responseHeader, noOfEndpoints, endpoints); + return new GetEndpointsResponseBuilderImpl(responseHeader, endpoints); } public static class GetEndpointsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfEndpoints; - private final List endpoints; + private final ResponseHeader responseHeader; + private final List endpoints; public GetEndpointsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfEndpoints, - List endpoints) { + ResponseHeader responseHeader, List endpoints) { this.responseHeader = responseHeader; - this.noOfEndpoints = noOfEndpoints; this.endpoints = endpoints; } public GetEndpointsResponse build() { GetEndpointsResponse getEndpointsResponse = - new GetEndpointsResponse(responseHeader, noOfEndpoints, endpoints); + new GetEndpointsResponse(responseHeader, endpoints); return getEndpointsResponse; } } @@ -177,7 +169,6 @@ public boolean equals(Object o) { } GetEndpointsResponse that = (GetEndpointsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfEndpoints() == that.getNoOfEndpoints()) && (getEndpoints() == that.getEndpoints()) && super.equals(that) && true; @@ -185,7 +176,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getResponseHeader(), getNoOfEndpoints(), getEndpoints()); + return Objects.hash(super.hashCode(), getResponseHeader(), getEndpoints()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryData.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryData.java index 0f8102aa784..693cffecaa7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryData.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryData.java @@ -38,24 +38,18 @@ public class HistoryData extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "658"; + public Integer getExtensionId() { + return (int) 658; } // Properties. - protected final int noOfDataValues; protected final List dataValues; - public HistoryData(int noOfDataValues, List dataValues) { + public HistoryData(List dataValues) { super(); - this.noOfDataValues = noOfDataValues; this.dataValues = dataValues; } - public int getNoOfDataValues() { - return noOfDataValues; - } - public List getDataValues() { return dataValues; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("HistoryData"); - // Simple Field (noOfDataValues) - writeSimpleField("noOfDataValues", noOfDataValues, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDataValues) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataValues = (int) ((((getDataValues()) == (null)) ? -(1) : COUNT(getDataValues()))); + writeImplicitField("noOfDataValues", noOfDataValues, writeSignedInt(writeBuffer, 32)); // Array Field (dataValues) writeComplexTypeArrayField("dataValues", dataValues, writeBuffer); @@ -87,7 +83,7 @@ public int getLengthInBits() { HistoryData _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfDataValues) + // Implicit Field (noOfDataValues) lengthInBits += 32; // Array field @@ -103,12 +99,12 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryData"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfDataValues = readSimpleField("noOfDataValues", readSignedInt(readBuffer, 32)); + int noOfDataValues = readImplicitField("noOfDataValues", readSignedInt(readBuffer, 32)); List dataValues = readCountArrayField( @@ -118,21 +114,19 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryData"); // Create the instance - return new HistoryDataBuilderImpl(noOfDataValues, dataValues); + return new HistoryDataBuilderImpl(dataValues); } public static class HistoryDataBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfDataValues; private final List dataValues; - public HistoryDataBuilderImpl(int noOfDataValues, List dataValues) { - this.noOfDataValues = noOfDataValues; + public HistoryDataBuilderImpl(List dataValues) { this.dataValues = dataValues; } public HistoryData build() { - HistoryData historyData = new HistoryData(noOfDataValues, dataValues); + HistoryData historyData = new HistoryData(dataValues); return historyData; } } @@ -146,15 +140,12 @@ public boolean equals(Object o) { return false; } HistoryData that = (HistoryData) o; - return (getNoOfDataValues() == that.getNoOfDataValues()) - && (getDataValues() == that.getDataValues()) - && super.equals(that) - && true; + return (getDataValues() == that.getDataValues()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfDataValues(), getDataValues()); + return Objects.hash(super.hashCode(), getDataValues()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEvent.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEvent.java index 5deddf42ba6..f7c4fb49fa2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEvent.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEvent.java @@ -38,25 +38,19 @@ public class HistoryEvent extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "661"; + public Integer getExtensionId() { + return (int) 661; } // Properties. - protected final int noOfEvents; - protected final List events; + protected final List events; - public HistoryEvent(int noOfEvents, List events) { + public HistoryEvent(List events) { super(); - this.noOfEvents = noOfEvents; this.events = events; } - public int getNoOfEvents() { - return noOfEvents; - } - - public List getEvents() { + public List getEvents() { return events; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("HistoryEvent"); - // Simple Field (noOfEvents) - writeSimpleField("noOfEvents", noOfEvents, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEvents) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfEvents = (int) ((((getEvents()) == (null)) ? -(1) : COUNT(getEvents()))); + writeImplicitField("noOfEvents", noOfEvents, writeSignedInt(writeBuffer, 32)); // Array Field (events) writeComplexTypeArrayField("events", events, writeBuffer); @@ -87,13 +83,13 @@ public int getLengthInBits() { HistoryEvent _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfEvents) + // Implicit Field (noOfEvents) lengthInBits += 32; // Array field if (events != null) { int i = 0; - for (ExtensionObjectDefinition element : events) { + for (HistoryEventFieldList element : events) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= events.size()); lengthInBits += element.getLengthInBits(); } @@ -103,38 +99,38 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryEvent"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfEvents = readSimpleField("noOfEvents", readSignedInt(readBuffer, 32)); + int noOfEvents = readImplicitField("noOfEvents", readSignedInt(readBuffer, 32)); - List events = + List events = readCountArrayField( "events", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("922")), + () -> + (HistoryEventFieldList) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (922)), readBuffer), noOfEvents); readBuffer.closeContext("HistoryEvent"); // Create the instance - return new HistoryEventBuilderImpl(noOfEvents, events); + return new HistoryEventBuilderImpl(events); } public static class HistoryEventBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfEvents; - private final List events; + private final List events; - public HistoryEventBuilderImpl(int noOfEvents, List events) { - this.noOfEvents = noOfEvents; + public HistoryEventBuilderImpl(List events) { this.events = events; } public HistoryEvent build() { - HistoryEvent historyEvent = new HistoryEvent(noOfEvents, events); + HistoryEvent historyEvent = new HistoryEvent(events); return historyEvent; } } @@ -148,15 +144,12 @@ public boolean equals(Object o) { return false; } HistoryEvent that = (HistoryEvent) o; - return (getNoOfEvents() == that.getNoOfEvents()) - && (getEvents() == that.getEvents()) - && super.equals(that) - && true; + return (getEvents() == that.getEvents()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfEvents(), getEvents()); + return Objects.hash(super.hashCode(), getEvents()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEventFieldList.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEventFieldList.java index 0ced8704ce9..9acd06a5b7a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEventFieldList.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryEventFieldList.java @@ -38,24 +38,18 @@ public class HistoryEventFieldList extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "922"; + public Integer getExtensionId() { + return (int) 922; } // Properties. - protected final int noOfEventFields; protected final List eventFields; - public HistoryEventFieldList(int noOfEventFields, List eventFields) { + public HistoryEventFieldList(List eventFields) { super(); - this.noOfEventFields = noOfEventFields; this.eventFields = eventFields; } - public int getNoOfEventFields() { - return noOfEventFields; - } - public List getEventFields() { return eventFields; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("HistoryEventFieldList"); - // Simple Field (noOfEventFields) - writeSimpleField("noOfEventFields", noOfEventFields, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfEventFields) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEventFields = (int) ((((getEventFields()) == (null)) ? -(1) : COUNT(getEventFields()))); + writeImplicitField("noOfEventFields", noOfEventFields, writeSignedInt(writeBuffer, 32)); // Array Field (eventFields) writeComplexTypeArrayField("eventFields", eventFields, writeBuffer); @@ -87,7 +83,7 @@ public int getLengthInBits() { HistoryEventFieldList _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfEventFields) + // Implicit Field (noOfEventFields) lengthInBits += 32; // Array field @@ -103,12 +99,12 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryEventFieldList"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfEventFields = readSimpleField("noOfEventFields", readSignedInt(readBuffer, 32)); + int noOfEventFields = readImplicitField("noOfEventFields", readSignedInt(readBuffer, 32)); List eventFields = readCountArrayField( @@ -118,22 +114,19 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryEventFieldList"); // Create the instance - return new HistoryEventFieldListBuilderImpl(noOfEventFields, eventFields); + return new HistoryEventFieldListBuilderImpl(eventFields); } public static class HistoryEventFieldListBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfEventFields; private final List eventFields; - public HistoryEventFieldListBuilderImpl(int noOfEventFields, List eventFields) { - this.noOfEventFields = noOfEventFields; + public HistoryEventFieldListBuilderImpl(List eventFields) { this.eventFields = eventFields; } public HistoryEventFieldList build() { - HistoryEventFieldList historyEventFieldList = - new HistoryEventFieldList(noOfEventFields, eventFields); + HistoryEventFieldList historyEventFieldList = new HistoryEventFieldList(eventFields); return historyEventFieldList; } } @@ -147,15 +140,12 @@ public boolean equals(Object o) { return false; } HistoryEventFieldList that = (HistoryEventFieldList) o; - return (getNoOfEventFields() == that.getNoOfEventFields()) - && (getEventFields() == that.getEventFields()) - && super.equals(that) - && true; + return (getEventFields() == that.getEventFields()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfEventFields(), getEventFields()); + return Objects.hash(super.hashCode(), getEventFields()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedData.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedData.java new file mode 100644 index 00000000000..6163bc876b2 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedData.java @@ -0,0 +1,209 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class HistoryModifiedData extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 11219; + } + + // Properties. + protected final List dataValues; + protected final List modificationInfos; + + public HistoryModifiedData(List dataValues, List modificationInfos) { + super(); + this.dataValues = dataValues; + this.modificationInfos = modificationInfos; + } + + public List getDataValues() { + return dataValues; + } + + public List getModificationInfos() { + return modificationInfos; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("HistoryModifiedData"); + + // Implicit Field (noOfDataValues) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataValues = (int) ((((getDataValues()) == (null)) ? -(1) : COUNT(getDataValues()))); + writeImplicitField("noOfDataValues", noOfDataValues, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataValues) + writeComplexTypeArrayField("dataValues", dataValues, writeBuffer); + + // Implicit Field (noOfModificationInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfModificationInfos = + (int) ((((getModificationInfos()) == (null)) ? -(1) : COUNT(getModificationInfos()))); + writeImplicitField( + "noOfModificationInfos", noOfModificationInfos, writeSignedInt(writeBuffer, 32)); + + // Array Field (modificationInfos) + writeComplexTypeArrayField("modificationInfos", modificationInfos, writeBuffer); + + writeBuffer.popContext("HistoryModifiedData"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + HistoryModifiedData _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfDataValues) + lengthInBits += 32; + + // Array field + if (dataValues != null) { + int i = 0; + for (DataValue element : dataValues) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataValues.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfModificationInfos) + lengthInBits += 32; + + // Array field + if (modificationInfos != null) { + int i = 0; + for (ModificationInfo element : modificationInfos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= modificationInfos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("HistoryModifiedData"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfDataValues = readImplicitField("noOfDataValues", readSignedInt(readBuffer, 32)); + + List dataValues = + readCountArrayField( + "dataValues", + readComplex(() -> DataValue.staticParse(readBuffer), readBuffer), + noOfDataValues); + + int noOfModificationInfos = + readImplicitField("noOfModificationInfos", readSignedInt(readBuffer, 32)); + + List modificationInfos = + readCountArrayField( + "modificationInfos", + readComplex( + () -> + (ModificationInfo) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (11218)), + readBuffer), + noOfModificationInfos); + + readBuffer.closeContext("HistoryModifiedData"); + // Create the instance + return new HistoryModifiedDataBuilderImpl(dataValues, modificationInfos); + } + + public static class HistoryModifiedDataBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List dataValues; + private final List modificationInfos; + + public HistoryModifiedDataBuilderImpl( + List dataValues, List modificationInfos) { + this.dataValues = dataValues; + this.modificationInfos = modificationInfos; + } + + public HistoryModifiedData build() { + HistoryModifiedData historyModifiedData = + new HistoryModifiedData(dataValues, modificationInfos); + return historyModifiedData; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof HistoryModifiedData)) { + return false; + } + HistoryModifiedData that = (HistoryModifiedData) o; + return (getDataValues() == that.getDataValues()) + && (getModificationInfos() == that.getModificationInfos()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getDataValues(), getModificationInfos()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedEvent.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedEvent.java new file mode 100644 index 00000000000..dca7a11d5ed --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryModifiedEvent.java @@ -0,0 +1,214 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class HistoryModifiedEvent extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 32826; + } + + // Properties. + protected final List events; + protected final List modificationInfos; + + public HistoryModifiedEvent( + List events, List modificationInfos) { + super(); + this.events = events; + this.modificationInfos = modificationInfos; + } + + public List getEvents() { + return events; + } + + public List getModificationInfos() { + return modificationInfos; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("HistoryModifiedEvent"); + + // Implicit Field (noOfEvents) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfEvents = (int) ((((getEvents()) == (null)) ? -(1) : COUNT(getEvents()))); + writeImplicitField("noOfEvents", noOfEvents, writeSignedInt(writeBuffer, 32)); + + // Array Field (events) + writeComplexTypeArrayField("events", events, writeBuffer); + + // Implicit Field (noOfModificationInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfModificationInfos = + (int) ((((getModificationInfos()) == (null)) ? -(1) : COUNT(getModificationInfos()))); + writeImplicitField( + "noOfModificationInfos", noOfModificationInfos, writeSignedInt(writeBuffer, 32)); + + // Array Field (modificationInfos) + writeComplexTypeArrayField("modificationInfos", modificationInfos, writeBuffer); + + writeBuffer.popContext("HistoryModifiedEvent"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + HistoryModifiedEvent _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfEvents) + lengthInBits += 32; + + // Array field + if (events != null) { + int i = 0; + for (HistoryEventFieldList element : events) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= events.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfModificationInfos) + lengthInBits += 32; + + // Array field + if (modificationInfos != null) { + int i = 0; + for (ModificationInfo element : modificationInfos) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= modificationInfos.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("HistoryModifiedEvent"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfEvents = readImplicitField("noOfEvents", readSignedInt(readBuffer, 32)); + + List events = + readCountArrayField( + "events", + readComplex( + () -> + (HistoryEventFieldList) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (922)), + readBuffer), + noOfEvents); + + int noOfModificationInfos = + readImplicitField("noOfModificationInfos", readSignedInt(readBuffer, 32)); + + List modificationInfos = + readCountArrayField( + "modificationInfos", + readComplex( + () -> + (ModificationInfo) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (11218)), + readBuffer), + noOfModificationInfos); + + readBuffer.closeContext("HistoryModifiedEvent"); + // Create the instance + return new HistoryModifiedEventBuilderImpl(events, modificationInfos); + } + + public static class HistoryModifiedEventBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List events; + private final List modificationInfos; + + public HistoryModifiedEventBuilderImpl( + List events, List modificationInfos) { + this.events = events; + this.modificationInfos = modificationInfos; + } + + public HistoryModifiedEvent build() { + HistoryModifiedEvent historyModifiedEvent = + new HistoryModifiedEvent(events, modificationInfos); + return historyModifiedEvent; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof HistoryModifiedEvent)) { + return false; + } + HistoryModifiedEvent that = (HistoryModifiedEvent) o; + return (getEvents() == that.getEvents()) + && (getModificationInfos() == that.getModificationInfos()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getEvents(), getModificationInfos()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadDetails.java index 32f370c5a43..b222508e7be 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadDetails.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadDetails.java @@ -38,8 +38,8 @@ public class HistoryReadDetails extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "643"; + public Integer getExtensionId() { + return (int) 643; } public HistoryReadDetails() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryReadDetails"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadRequest.java index fb551694fd7..3d384b859ba 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadRequest.java @@ -38,35 +38,32 @@ public class HistoryReadRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "664"; + public Integer getExtensionId() { + return (int) 664; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final ExtensionObject historyReadDetails; protected final TimestampsToReturn timestampsToReturn; protected final boolean releaseContinuationPoints; - protected final int noOfNodesToRead; - protected final List nodesToRead; + protected final List nodesToRead; public HistoryReadRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, ExtensionObject historyReadDetails, TimestampsToReturn timestampsToReturn, boolean releaseContinuationPoints, - int noOfNodesToRead, - List nodesToRead) { + List nodesToRead) { super(); this.requestHeader = requestHeader; this.historyReadDetails = historyReadDetails; this.timestampsToReturn = timestampsToReturn; this.releaseContinuationPoints = releaseContinuationPoints; - this.noOfNodesToRead = noOfNodesToRead; this.nodesToRead = nodesToRead; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -82,11 +79,7 @@ public boolean getReleaseContinuationPoints() { return releaseContinuationPoints; } - public int getNoOfNodesToRead() { - return noOfNodesToRead; - } - - public List getNodesToRead() { + public List getNodesToRead() { return nodesToRead; } @@ -120,8 +113,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeSimpleField( "releaseContinuationPoints", releaseContinuationPoints, writeBoolean(writeBuffer)); - // Simple Field (noOfNodesToRead) - writeSimpleField("noOfNodesToRead", noOfNodesToRead, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToRead) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToRead = (int) ((((getNodesToRead()) == (null)) ? -(1) : COUNT(getNodesToRead()))); + writeImplicitField("noOfNodesToRead", noOfNodesToRead, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToRead) writeComplexTypeArrayField("nodesToRead", nodesToRead, writeBuffer); @@ -155,13 +150,13 @@ public int getLengthInBits() { // Simple field (releaseContinuationPoints) lengthInBits += 1; - // Simple field (noOfNodesToRead) + // Implicit Field (noOfNodesToRead) lengthInBits += 32; // Array field if (nodesToRead != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToRead) { + for (HistoryReadValueId element : nodesToRead) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToRead.size()); lengthInBits += element.getLengthInBits(); } @@ -171,16 +166,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryReadRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); ExtensionObject historyReadDetails = @@ -201,13 +197,15 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit boolean releaseContinuationPoints = readSimpleField("releaseContinuationPoints", readBoolean(readBuffer)); - int noOfNodesToRead = readSimpleField("noOfNodesToRead", readSignedInt(readBuffer, 32)); + int noOfNodesToRead = readImplicitField("noOfNodesToRead", readSignedInt(readBuffer, 32)); - List nodesToRead = + List nodesToRead = readCountArrayField( "nodesToRead", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("637")), + () -> + (HistoryReadValueId) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (637)), readBuffer), noOfNodesToRead); @@ -218,31 +216,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit historyReadDetails, timestampsToReturn, releaseContinuationPoints, - noOfNodesToRead, nodesToRead); } public static class HistoryReadRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final ExtensionObject historyReadDetails; private final TimestampsToReturn timestampsToReturn; private final boolean releaseContinuationPoints; - private final int noOfNodesToRead; - private final List nodesToRead; + private final List nodesToRead; public HistoryReadRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, ExtensionObject historyReadDetails, TimestampsToReturn timestampsToReturn, boolean releaseContinuationPoints, - int noOfNodesToRead, - List nodesToRead) { + List nodesToRead) { this.requestHeader = requestHeader; this.historyReadDetails = historyReadDetails; this.timestampsToReturn = timestampsToReturn; this.releaseContinuationPoints = releaseContinuationPoints; - this.noOfNodesToRead = noOfNodesToRead; this.nodesToRead = nodesToRead; } @@ -253,7 +247,6 @@ public HistoryReadRequest build() { historyReadDetails, timestampsToReturn, releaseContinuationPoints, - noOfNodesToRead, nodesToRead); return historyReadRequest; } @@ -272,7 +265,6 @@ public boolean equals(Object o) { && (getHistoryReadDetails() == that.getHistoryReadDetails()) && (getTimestampsToReturn() == that.getTimestampsToReturn()) && (getReleaseContinuationPoints() == that.getReleaseContinuationPoints()) - && (getNoOfNodesToRead() == that.getNoOfNodesToRead()) && (getNodesToRead() == that.getNodesToRead()) && super.equals(that) && true; @@ -286,7 +278,6 @@ public int hashCode() { getHistoryReadDetails(), getTimestampsToReturn(), getReleaseContinuationPoints(), - getNoOfNodesToRead(), getNodesToRead()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResponse.java index ff039df8dd0..6bd0b85f037 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResponse.java @@ -38,47 +38,33 @@ public class HistoryReadResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "667"; + public Integer getExtensionId() { + return (int) 667; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public HistoryReadResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (HistoryReadResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryReadResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("640")), + () -> + (HistoryReadResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (640)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryReadResponse"); // Create the instance - return new HistoryReadResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new HistoryReadResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class HistoryReadResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public HistoryReadResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public HistoryReadResponse build() { HistoryReadResponse historyReadResponse = - new HistoryReadResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new HistoryReadResponse(responseHeader, results, diagnosticInfos); return historyReadResponse; } } @@ -225,9 +212,7 @@ public boolean equals(Object o) { } HistoryReadResponse that = (HistoryReadResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +220,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResult.java index 14b3a343a3f..23641b3911a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadResult.java @@ -38,8 +38,8 @@ public class HistoryReadResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "640"; + public Integer getExtensionId() { + return (int) 640; } // Properties. @@ -110,7 +110,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryReadResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadValueId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadValueId.java index 9099f14eda8..fc48a44f20e 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadValueId.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryReadValueId.java @@ -38,8 +38,8 @@ public class HistoryReadValueId extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "637"; + public Integer getExtensionId() { + return (int) 637; } // Properties. @@ -125,7 +125,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryReadValueId"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateDetails.java index d2b7621246e..8c85716c8be 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateDetails.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateDetails.java @@ -38,8 +38,8 @@ public class HistoryUpdateDetails extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "679"; + public Integer getExtensionId() { + return (int) 679; } public HistoryUpdateDetails() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryUpdateDetails"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateRequest.java index d412a41df83..2f256cadb3f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateRequest.java @@ -38,33 +38,25 @@ public class HistoryUpdateRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "700"; + public Integer getExtensionId() { + return (int) 700; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfHistoryUpdateDetails; + protected final RequestHeader requestHeader; protected final List historyUpdateDetails; public HistoryUpdateRequest( - ExtensionObjectDefinition requestHeader, - int noOfHistoryUpdateDetails, - List historyUpdateDetails) { + RequestHeader requestHeader, List historyUpdateDetails) { super(); this.requestHeader = requestHeader; - this.noOfHistoryUpdateDetails = noOfHistoryUpdateDetails; this.historyUpdateDetails = historyUpdateDetails; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfHistoryUpdateDetails() { - return noOfHistoryUpdateDetails; - } - public List getHistoryUpdateDetails() { return historyUpdateDetails; } @@ -79,8 +71,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfHistoryUpdateDetails) - writeSimpleField( + // Implicit Field (noOfHistoryUpdateDetails) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfHistoryUpdateDetails = + (int) ((((getHistoryUpdateDetails()) == (null)) ? -(1) : COUNT(getHistoryUpdateDetails()))); + writeImplicitField( "noOfHistoryUpdateDetails", noOfHistoryUpdateDetails, writeSignedInt(writeBuffer, 32)); // Array Field (historyUpdateDetails) @@ -103,7 +98,7 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfHistoryUpdateDetails) + // Implicit Field (noOfHistoryUpdateDetails) lengthInBits += 32; // Array field @@ -119,20 +114,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryUpdateRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); int noOfHistoryUpdateDetails = - readSimpleField("noOfHistoryUpdateDetails", readSignedInt(readBuffer, 32)); + readImplicitField("noOfHistoryUpdateDetails", readSignedInt(readBuffer, 32)); List historyUpdateDetails = readCountArrayField( @@ -143,28 +139,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryUpdateRequest"); // Create the instance - return new HistoryUpdateRequestBuilderImpl( - requestHeader, noOfHistoryUpdateDetails, historyUpdateDetails); + return new HistoryUpdateRequestBuilderImpl(requestHeader, historyUpdateDetails); } public static class HistoryUpdateRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfHistoryUpdateDetails; + private final RequestHeader requestHeader; private final List historyUpdateDetails; public HistoryUpdateRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfHistoryUpdateDetails, - List historyUpdateDetails) { + RequestHeader requestHeader, List historyUpdateDetails) { this.requestHeader = requestHeader; - this.noOfHistoryUpdateDetails = noOfHistoryUpdateDetails; this.historyUpdateDetails = historyUpdateDetails; } public HistoryUpdateRequest build() { HistoryUpdateRequest historyUpdateRequest = - new HistoryUpdateRequest(requestHeader, noOfHistoryUpdateDetails, historyUpdateDetails); + new HistoryUpdateRequest(requestHeader, historyUpdateDetails); return historyUpdateRequest; } } @@ -179,7 +170,6 @@ public boolean equals(Object o) { } HistoryUpdateRequest that = (HistoryUpdateRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfHistoryUpdateDetails() == that.getNoOfHistoryUpdateDetails()) && (getHistoryUpdateDetails() == that.getHistoryUpdateDetails()) && super.equals(that) && true; @@ -187,11 +177,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getRequestHeader(), - getNoOfHistoryUpdateDetails(), - getHistoryUpdateDetails()); + return Objects.hash(super.hashCode(), getRequestHeader(), getHistoryUpdateDetails()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResponse.java index 3c47f264aeb..19c5a753f41 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResponse.java @@ -38,47 +38,33 @@ public class HistoryUpdateResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "703"; + public Integer getExtensionId() { + return (int) 703; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public HistoryUpdateResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (HistoryUpdateResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryUpdateResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("697")), + () -> + (HistoryUpdateResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (697)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryUpdateResponse"); // Create the instance - return new HistoryUpdateResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new HistoryUpdateResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class HistoryUpdateResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public HistoryUpdateResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public HistoryUpdateResponse build() { HistoryUpdateResponse historyUpdateResponse = - new HistoryUpdateResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new HistoryUpdateResponse(responseHeader, results, diagnosticInfos); return historyUpdateResponse; } } @@ -225,9 +212,7 @@ public boolean equals(Object o) { } HistoryUpdateResponse that = (HistoryUpdateResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +220,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResult.java index f3d1d76a09a..78088619fb2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/HistoryUpdateResult.java @@ -38,28 +38,22 @@ public class HistoryUpdateResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "697"; + public Integer getExtensionId() { + return (int) 697; } // Properties. protected final StatusCode statusCode; - protected final int noOfOperationResults; protected final List operationResults; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public HistoryUpdateResult( StatusCode statusCode, - int noOfOperationResults, List operationResults, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.statusCode = statusCode; - this.noOfOperationResults = noOfOperationResults; this.operationResults = operationResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } @@ -67,18 +61,10 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfOperationResults() { - return noOfOperationResults; - } - public List getOperationResults() { return operationResults; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,21 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfOperationResults) - writeSimpleField("noOfOperationResults", noOfOperationResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfOperationResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfOperationResults = + (int) ((((getOperationResults()) == (null)) ? -(1) : COUNT(getOperationResults()))); + writeImplicitField( + "noOfOperationResults", noOfOperationResults, writeSignedInt(writeBuffer, 32)); // Array Field (operationResults) writeComplexTypeArrayField("operationResults", operationResults, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +115,7 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfOperationResults) + // Implicit Field (noOfOperationResults) lengthInBits += 32; // Array field @@ -134,7 +127,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,7 +143,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("HistoryUpdateResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -160,7 +153,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); int noOfOperationResults = - readSimpleField("noOfOperationResults", readSignedInt(readBuffer, 32)); + readImplicitField("noOfOperationResults", readSignedInt(readBuffer, 32)); List operationResults = readCountArrayField( @@ -168,7 +161,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfOperationResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -178,39 +172,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("HistoryUpdateResult"); // Create the instance - return new HistoryUpdateResultBuilderImpl( - statusCode, noOfOperationResults, operationResults, noOfDiagnosticInfos, diagnosticInfos); + return new HistoryUpdateResultBuilderImpl(statusCode, operationResults, diagnosticInfos); } public static class HistoryUpdateResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfOperationResults; private final List operationResults; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public HistoryUpdateResultBuilderImpl( StatusCode statusCode, - int noOfOperationResults, List operationResults, - int noOfDiagnosticInfos, List diagnosticInfos) { this.statusCode = statusCode; - this.noOfOperationResults = noOfOperationResults; this.operationResults = operationResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public HistoryUpdateResult build() { HistoryUpdateResult historyUpdateResult = - new HistoryUpdateResult( - statusCode, - noOfOperationResults, - operationResults, - noOfDiagnosticInfos, - diagnosticInfos); + new HistoryUpdateResult(statusCode, operationResults, diagnosticInfos); return historyUpdateResult; } } @@ -225,9 +207,7 @@ public boolean equals(Object o) { } HistoryUpdateResult that = (HistoryUpdateResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfOperationResults() == that.getNoOfOperationResults()) && (getOperationResults() == that.getOperationResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -236,12 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getStatusCode(), - getNoOfOperationResults(), - getOperationResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + super.hashCode(), getStatusCode(), getOperationResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IdentityMappingRuleType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IdentityMappingRuleType.java index 7eee5006402..10ff0fbddb7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IdentityMappingRuleType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IdentityMappingRuleType.java @@ -38,8 +38,8 @@ public class IdentityMappingRuleType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15636"; + public Integer getExtensionId() { + return (int) 15636; } // Properties. @@ -104,7 +104,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("IdentityMappingRuleType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IssuedIdentityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IssuedIdentityToken.java index 0276745882a..5f5fdc68d73 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IssuedIdentityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/IssuedIdentityToken.java @@ -35,23 +35,30 @@ // Code generated by code-generation. DO NOT EDIT. -public class IssuedIdentityToken extends UserIdentityTokenDefinition implements Message { +public class IssuedIdentityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "identity"; + public Integer getExtensionId() { + return (int) 940; } // Properties. + protected final PascalString policyId; protected final PascalByteString tokenData; protected final PascalString encryptionAlgorithm; - public IssuedIdentityToken(PascalByteString tokenData, PascalString encryptionAlgorithm) { + public IssuedIdentityToken( + PascalString policyId, PascalByteString tokenData, PascalString encryptionAlgorithm) { super(); + this.policyId = policyId; this.tokenData = tokenData; this.encryptionAlgorithm = encryptionAlgorithm; } + public PascalString getPolicyId() { + return policyId; + } + public PascalByteString getTokenData() { return tokenData; } @@ -61,12 +68,15 @@ public PascalString getEncryptionAlgorithm() { } @Override - protected void serializeUserIdentityTokenDefinitionChild(WriteBuffer writeBuffer) + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("IssuedIdentityToken"); + // Simple Field (policyId) + writeSimpleField("policyId", policyId, writeComplex(writeBuffer)); + // Simple Field (tokenData) writeSimpleField("tokenData", tokenData, writeComplex(writeBuffer)); @@ -87,6 +97,9 @@ public int getLengthInBits() { IssuedIdentityToken _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + // Simple field (policyId) + lengthInBits += policyId.getLengthInBits(); + // Simple field (tokenData) lengthInBits += tokenData.getLengthInBits(); @@ -96,12 +109,16 @@ public int getLengthInBits() { return lengthInBits; } - public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("IssuedIdentityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + PascalString policyId = + readSimpleField( + "policyId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + PascalByteString tokenData = readSimpleField( "tokenData", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); @@ -113,23 +130,25 @@ public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDef readBuffer.closeContext("IssuedIdentityToken"); // Create the instance - return new IssuedIdentityTokenBuilderImpl(tokenData, encryptionAlgorithm); + return new IssuedIdentityTokenBuilderImpl(policyId, tokenData, encryptionAlgorithm); } public static class IssuedIdentityTokenBuilderImpl - implements UserIdentityTokenDefinition.UserIdentityTokenDefinitionBuilder { + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString policyId; private final PascalByteString tokenData; private final PascalString encryptionAlgorithm; public IssuedIdentityTokenBuilderImpl( - PascalByteString tokenData, PascalString encryptionAlgorithm) { + PascalString policyId, PascalByteString tokenData, PascalString encryptionAlgorithm) { + this.policyId = policyId; this.tokenData = tokenData; this.encryptionAlgorithm = encryptionAlgorithm; } public IssuedIdentityToken build() { IssuedIdentityToken issuedIdentityToken = - new IssuedIdentityToken(tokenData, encryptionAlgorithm); + new IssuedIdentityToken(policyId, tokenData, encryptionAlgorithm); return issuedIdentityToken; } } @@ -143,7 +162,8 @@ public boolean equals(Object o) { return false; } IssuedIdentityToken that = (IssuedIdentityToken) o; - return (getTokenData() == that.getTokenData()) + return (getPolicyId() == that.getPolicyId()) + && (getTokenData() == that.getTokenData()) && (getEncryptionAlgorithm() == that.getEncryptionAlgorithm()) && super.equals(that) && true; @@ -151,7 +171,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getTokenData(), getEncryptionAlgorithm()); + return Objects.hash(super.hashCode(), getPolicyId(), getTokenData(), getEncryptionAlgorithm()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetReaderMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetReaderMessageDataType.java new file mode 100644 index 00000000000..93f6a2ea56a --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetReaderMessageDataType.java @@ -0,0 +1,192 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class JsonDataSetReaderMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15667; + } + + // Properties. + protected final JsonNetworkMessageContentMask networkMessageContentMask; + protected final JsonDataSetMessageContentMask dataSetMessageContentMask; + + public JsonDataSetReaderMessageDataType( + JsonNetworkMessageContentMask networkMessageContentMask, + JsonDataSetMessageContentMask dataSetMessageContentMask) { + super(); + this.networkMessageContentMask = networkMessageContentMask; + this.dataSetMessageContentMask = dataSetMessageContentMask; + } + + public JsonNetworkMessageContentMask getNetworkMessageContentMask() { + return networkMessageContentMask; + } + + public JsonDataSetMessageContentMask getDataSetMessageContentMask() { + return dataSetMessageContentMask; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("JsonDataSetReaderMessageDataType"); + + // Simple Field (networkMessageContentMask) + writeSimpleEnumField( + "networkMessageContentMask", + "JsonNetworkMessageContentMask", + networkMessageContentMask, + writeEnum( + JsonNetworkMessageContentMask::getValue, + JsonNetworkMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (dataSetMessageContentMask) + writeSimpleEnumField( + "dataSetMessageContentMask", + "JsonDataSetMessageContentMask", + dataSetMessageContentMask, + writeEnum( + JsonDataSetMessageContentMask::getValue, + JsonDataSetMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + writeBuffer.popContext("JsonDataSetReaderMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + JsonDataSetReaderMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (networkMessageContentMask) + lengthInBits += 32; + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("JsonDataSetReaderMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + JsonNetworkMessageContentMask networkMessageContentMask = + readEnumField( + "networkMessageContentMask", + "JsonNetworkMessageContentMask", + readEnum( + JsonNetworkMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + JsonDataSetMessageContentMask dataSetMessageContentMask = + readEnumField( + "dataSetMessageContentMask", + "JsonDataSetMessageContentMask", + readEnum( + JsonDataSetMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + readBuffer.closeContext("JsonDataSetReaderMessageDataType"); + // Create the instance + return new JsonDataSetReaderMessageDataTypeBuilderImpl( + networkMessageContentMask, dataSetMessageContentMask); + } + + public static class JsonDataSetReaderMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final JsonNetworkMessageContentMask networkMessageContentMask; + private final JsonDataSetMessageContentMask dataSetMessageContentMask; + + public JsonDataSetReaderMessageDataTypeBuilderImpl( + JsonNetworkMessageContentMask networkMessageContentMask, + JsonDataSetMessageContentMask dataSetMessageContentMask) { + this.networkMessageContentMask = networkMessageContentMask; + this.dataSetMessageContentMask = dataSetMessageContentMask; + } + + public JsonDataSetReaderMessageDataType build() { + JsonDataSetReaderMessageDataType jsonDataSetReaderMessageDataType = + new JsonDataSetReaderMessageDataType( + networkMessageContentMask, dataSetMessageContentMask); + return jsonDataSetReaderMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof JsonDataSetReaderMessageDataType)) { + return false; + } + JsonDataSetReaderMessageDataType that = (JsonDataSetReaderMessageDataType) o; + return (getNetworkMessageContentMask() == that.getNetworkMessageContentMask()) + && (getDataSetMessageContentMask() == that.getDataSetMessageContentMask()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNetworkMessageContentMask(), getDataSetMessageContentMask()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetWriterMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetWriterMessageDataType.java new file mode 100644 index 00000000000..130834203b0 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonDataSetWriterMessageDataType.java @@ -0,0 +1,157 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class JsonDataSetWriterMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15666; + } + + // Properties. + protected final JsonDataSetMessageContentMask dataSetMessageContentMask; + + public JsonDataSetWriterMessageDataType(JsonDataSetMessageContentMask dataSetMessageContentMask) { + super(); + this.dataSetMessageContentMask = dataSetMessageContentMask; + } + + public JsonDataSetMessageContentMask getDataSetMessageContentMask() { + return dataSetMessageContentMask; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("JsonDataSetWriterMessageDataType"); + + // Simple Field (dataSetMessageContentMask) + writeSimpleEnumField( + "dataSetMessageContentMask", + "JsonDataSetMessageContentMask", + dataSetMessageContentMask, + writeEnum( + JsonDataSetMessageContentMask::getValue, + JsonDataSetMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + writeBuffer.popContext("JsonDataSetWriterMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + JsonDataSetWriterMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("JsonDataSetWriterMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + JsonDataSetMessageContentMask dataSetMessageContentMask = + readEnumField( + "dataSetMessageContentMask", + "JsonDataSetMessageContentMask", + readEnum( + JsonDataSetMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + readBuffer.closeContext("JsonDataSetWriterMessageDataType"); + // Create the instance + return new JsonDataSetWriterMessageDataTypeBuilderImpl(dataSetMessageContentMask); + } + + public static class JsonDataSetWriterMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final JsonDataSetMessageContentMask dataSetMessageContentMask; + + public JsonDataSetWriterMessageDataTypeBuilderImpl( + JsonDataSetMessageContentMask dataSetMessageContentMask) { + this.dataSetMessageContentMask = dataSetMessageContentMask; + } + + public JsonDataSetWriterMessageDataType build() { + JsonDataSetWriterMessageDataType jsonDataSetWriterMessageDataType = + new JsonDataSetWriterMessageDataType(dataSetMessageContentMask); + return jsonDataSetWriterMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof JsonDataSetWriterMessageDataType)) { + return false; + } + JsonDataSetWriterMessageDataType that = (JsonDataSetWriterMessageDataType) o; + return (getDataSetMessageContentMask() == that.getDataSetMessageContentMask()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getDataSetMessageContentMask()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonWriterGroupMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonWriterGroupMessageDataType.java new file mode 100644 index 00000000000..30fce1dd4d0 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/JsonWriterGroupMessageDataType.java @@ -0,0 +1,157 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class JsonWriterGroupMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15659; + } + + // Properties. + protected final JsonNetworkMessageContentMask networkMessageContentMask; + + public JsonWriterGroupMessageDataType(JsonNetworkMessageContentMask networkMessageContentMask) { + super(); + this.networkMessageContentMask = networkMessageContentMask; + } + + public JsonNetworkMessageContentMask getNetworkMessageContentMask() { + return networkMessageContentMask; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("JsonWriterGroupMessageDataType"); + + // Simple Field (networkMessageContentMask) + writeSimpleEnumField( + "networkMessageContentMask", + "JsonNetworkMessageContentMask", + networkMessageContentMask, + writeEnum( + JsonNetworkMessageContentMask::getValue, + JsonNetworkMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + writeBuffer.popContext("JsonWriterGroupMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + JsonWriterGroupMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (networkMessageContentMask) + lengthInBits += 32; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("JsonWriterGroupMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + JsonNetworkMessageContentMask networkMessageContentMask = + readEnumField( + "networkMessageContentMask", + "JsonNetworkMessageContentMask", + readEnum( + JsonNetworkMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + readBuffer.closeContext("JsonWriterGroupMessageDataType"); + // Create the instance + return new JsonWriterGroupMessageDataTypeBuilderImpl(networkMessageContentMask); + } + + public static class JsonWriterGroupMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final JsonNetworkMessageContentMask networkMessageContentMask; + + public JsonWriterGroupMessageDataTypeBuilderImpl( + JsonNetworkMessageContentMask networkMessageContentMask) { + this.networkMessageContentMask = networkMessageContentMask; + } + + public JsonWriterGroupMessageDataType build() { + JsonWriterGroupMessageDataType jsonWriterGroupMessageDataType = + new JsonWriterGroupMessageDataType(networkMessageContentMask); + return jsonWriterGroupMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof JsonWriterGroupMessageDataType)) { + return false; + } + JsonWriterGroupMessageDataType that = (JsonWriterGroupMessageDataType) o; + return (getNetworkMessageContentMask() == that.getNetworkMessageContentMask()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getNetworkMessageContentMask()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/KeyValuePair.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/KeyValuePair.java index 46bb1c37154..6d980958ce0 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/KeyValuePair.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/KeyValuePair.java @@ -38,8 +38,8 @@ public class KeyValuePair extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14535"; + public Integer getExtensionId() { + return (int) 14535; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("KeyValuePair"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LinearConversionDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LinearConversionDataType.java index 96b8dd54960..d8327b68282 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LinearConversionDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LinearConversionDataType.java @@ -38,8 +38,8 @@ public class LinearConversionDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32437"; + public Integer getExtensionId() { + return (int) 32437; } // Properties. @@ -122,7 +122,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("LinearConversionDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LiteralOperand.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LiteralOperand.java new file mode 100644 index 00000000000..9ea86e7bd90 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/LiteralOperand.java @@ -0,0 +1,142 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class LiteralOperand extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 597; + } + + // Properties. + protected final Variant value; + + public LiteralOperand(Variant value) { + super(); + this.value = value; + } + + public Variant getValue() { + return value; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("LiteralOperand"); + + // Simple Field (value) + writeSimpleField("value", value, writeComplex(writeBuffer)); + + writeBuffer.popContext("LiteralOperand"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + LiteralOperand _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (value) + lengthInBits += value.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("LiteralOperand"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + Variant value = + readSimpleField("value", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("LiteralOperand"); + // Create the instance + return new LiteralOperandBuilderImpl(value); + } + + public static class LiteralOperandBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final Variant value; + + public LiteralOperandBuilderImpl(Variant value) { + this.value = value; + } + + public LiteralOperand build() { + LiteralOperand literalOperand = new LiteralOperand(value); + return literalOperand; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof LiteralOperand)) { + return false; + } + LiteralOperand that = (LiteralOperand) o; + return (getValue() == that.getValue()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getValue()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MdnsDiscoveryConfiguration.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MdnsDiscoveryConfiguration.java new file mode 100644 index 00000000000..e9130f4c75e --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MdnsDiscoveryConfiguration.java @@ -0,0 +1,188 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class MdnsDiscoveryConfiguration extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 12893; + } + + // Properties. + protected final PascalString mdnsServerName; + protected final List serverCapabilities; + + public MdnsDiscoveryConfiguration( + PascalString mdnsServerName, List serverCapabilities) { + super(); + this.mdnsServerName = mdnsServerName; + this.serverCapabilities = serverCapabilities; + } + + public PascalString getMdnsServerName() { + return mdnsServerName; + } + + public List getServerCapabilities() { + return serverCapabilities; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("MdnsDiscoveryConfiguration"); + + // Simple Field (mdnsServerName) + writeSimpleField("mdnsServerName", mdnsServerName, writeComplex(writeBuffer)); + + // Implicit Field (noOfServerCapabilities) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfServerCapabilities = + (int) ((((getServerCapabilities()) == (null)) ? -(1) : COUNT(getServerCapabilities()))); + writeImplicitField( + "noOfServerCapabilities", noOfServerCapabilities, writeSignedInt(writeBuffer, 32)); + + // Array Field (serverCapabilities) + writeComplexTypeArrayField("serverCapabilities", serverCapabilities, writeBuffer); + + writeBuffer.popContext("MdnsDiscoveryConfiguration"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + MdnsDiscoveryConfiguration _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (mdnsServerName) + lengthInBits += mdnsServerName.getLengthInBits(); + + // Implicit Field (noOfServerCapabilities) + lengthInBits += 32; + + // Array field + if (serverCapabilities != null) { + int i = 0; + for (PascalString element : serverCapabilities) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= serverCapabilities.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("MdnsDiscoveryConfiguration"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString mdnsServerName = + readSimpleField( + "mdnsServerName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfServerCapabilities = + readImplicitField("noOfServerCapabilities", readSignedInt(readBuffer, 32)); + + List serverCapabilities = + readCountArrayField( + "serverCapabilities", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfServerCapabilities); + + readBuffer.closeContext("MdnsDiscoveryConfiguration"); + // Create the instance + return new MdnsDiscoveryConfigurationBuilderImpl(mdnsServerName, serverCapabilities); + } + + public static class MdnsDiscoveryConfigurationBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString mdnsServerName; + private final List serverCapabilities; + + public MdnsDiscoveryConfigurationBuilderImpl( + PascalString mdnsServerName, List serverCapabilities) { + this.mdnsServerName = mdnsServerName; + this.serverCapabilities = serverCapabilities; + } + + public MdnsDiscoveryConfiguration build() { + MdnsDiscoveryConfiguration mdnsDiscoveryConfiguration = + new MdnsDiscoveryConfiguration(mdnsServerName, serverCapabilities); + return mdnsDiscoveryConfiguration; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof MdnsDiscoveryConfiguration)) { + return false; + } + MdnsDiscoveryConfiguration that = (MdnsDiscoveryConfiguration) o; + return (getMdnsServerName() == that.getMdnsServerName()) + && (getServerCapabilities() == that.getServerCapabilities()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getMdnsServerName(), getServerCapabilities()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MessagePDU.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MessagePDU.java index f19ffc70272..088cecb4192 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MessagePDU.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MessagePDU.java @@ -108,7 +108,7 @@ public int getLengthInBits() { return lengthInBits; } - public static MessagePDU staticParse(ReadBuffer readBuffer, Boolean response) + public static MessagePDU staticParse(ReadBuffer readBuffer, Boolean response, Boolean binary) throws ParseException { readBuffer.pullContext("MessagePDU"); PositionAware positionAware = readBuffer; @@ -126,29 +126,34 @@ public static MessagePDU staticParse(ReadBuffer readBuffer, Boolean response) MessagePDUBuilder builder = null; if (EvaluationHelper.equals(messageType, (String) "HEL") && EvaluationHelper.equals(response, (boolean) false)) { - builder = OpcuaHelloRequest.staticParseMessagePDUBuilder(readBuffer, response); + builder = OpcuaHelloRequest.staticParseMessagePDUBuilder(readBuffer, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "ACK") && EvaluationHelper.equals(response, (boolean) true)) { - builder = OpcuaAcknowledgeResponse.staticParseMessagePDUBuilder(readBuffer, response); + builder = OpcuaAcknowledgeResponse.staticParseMessagePDUBuilder(readBuffer, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "OPN") && EvaluationHelper.equals(response, (boolean) false)) { - builder = OpcuaOpenRequest.staticParseMessagePDUBuilder(readBuffer, totalLength, response); + builder = + OpcuaOpenRequest.staticParseMessagePDUBuilder(readBuffer, totalLength, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "OPN") && EvaluationHelper.equals(response, (boolean) true)) { - builder = OpcuaOpenResponse.staticParseMessagePDUBuilder(readBuffer, totalLength, response); + builder = + OpcuaOpenResponse.staticParseMessagePDUBuilder(readBuffer, totalLength, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "CLO") && EvaluationHelper.equals(response, (boolean) false)) { - builder = OpcuaCloseRequest.staticParseMessagePDUBuilder(readBuffer, response); + builder = OpcuaCloseRequest.staticParseMessagePDUBuilder(readBuffer, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "MSG") && EvaluationHelper.equals(response, (boolean) false)) { - builder = OpcuaMessageRequest.staticParseMessagePDUBuilder(readBuffer, totalLength, response); + builder = + OpcuaMessageRequest.staticParseMessagePDUBuilder( + readBuffer, totalLength, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "MSG") && EvaluationHelper.equals(response, (boolean) true)) { builder = - OpcuaMessageResponse.staticParseMessagePDUBuilder(readBuffer, totalLength, response); + OpcuaMessageResponse.staticParseMessagePDUBuilder( + readBuffer, totalLength, response, binary); } else if (EvaluationHelper.equals(messageType, (String) "ERR") && EvaluationHelper.equals(response, (boolean) true)) { - builder = OpcuaMessageError.staticParseMessagePDUBuilder(readBuffer, response); + builder = OpcuaMessageError.staticParseMessagePDUBuilder(readBuffer, response, binary); } if (builder == null) { throw new ParseException( diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MethodAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MethodAttributes.java new file mode 100644 index 00000000000..8ffc0896daf --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MethodAttributes.java @@ -0,0 +1,297 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class MethodAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 360; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final boolean userExecutable; + protected final boolean executable; + + public MethodAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean userExecutable, + boolean executable) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.userExecutable = userExecutable; + this.executable = executable; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public boolean getUserExecutable() { + return userExecutable; + } + + public boolean getExecutable() { + return executable; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("MethodAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 6)); + + // Simple Field (userExecutable) + writeSimpleField("userExecutable", userExecutable, writeBoolean(writeBuffer)); + + // Simple Field (executable) + writeSimpleField("executable", executable, writeBoolean(writeBuffer)); + + writeBuffer.popContext("MethodAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + MethodAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 6; + + // Simple field (userExecutable) + lengthInBits += 1; + + // Simple field (executable) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("MethodAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 6), (byte) 0x00); + + boolean userExecutable = readSimpleField("userExecutable", readBoolean(readBuffer)); + + boolean executable = readSimpleField("executable", readBoolean(readBuffer)); + + readBuffer.closeContext("MethodAttributes"); + // Create the instance + return new MethodAttributesBuilderImpl( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + userExecutable, + executable); + } + + public static class MethodAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final boolean userExecutable; + private final boolean executable; + + public MethodAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean userExecutable, + boolean executable) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.userExecutable = userExecutable; + this.executable = executable; + } + + public MethodAttributes build() { + MethodAttributes methodAttributes = + new MethodAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + userExecutable, + executable); + return methodAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof MethodAttributes)) { + return false; + } + MethodAttributes that = (MethodAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getUserExecutable() == that.getUserExecutable()) + && (getExecutable() == that.getExecutable()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getUserExecutable(), + getExecutable()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModelChangeStructureDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModelChangeStructureDataType.java index fcd0b2de77a..d6c63ea777c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModelChangeStructureDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModelChangeStructureDataType.java @@ -38,8 +38,8 @@ public class ModelChangeStructureDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "879"; + public Integer getExtensionId() { + return (int) 879; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModelChangeStructureDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModificationInfo.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModificationInfo.java index 59d70c6af4e..2395b8313a9 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModificationInfo.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModificationInfo.java @@ -38,8 +38,8 @@ public class ModificationInfo extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "11218"; + public Integer getExtensionId() { + return (int) 11218; } // Properties. @@ -117,7 +117,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModificationInfo"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsRequest.java index c410d7a4e69..010ab3c83ad 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsRequest.java @@ -38,32 +38,29 @@ public class ModifyMonitoredItemsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "763"; + public Integer getExtensionId() { + return (int) 763; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final TimestampsToReturn timestampsToReturn; - protected final int noOfItemsToModify; - protected final List itemsToModify; + protected final List itemsToModify; public ModifyMonitoredItemsRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, TimestampsToReturn timestampsToReturn, - int noOfItemsToModify, - List itemsToModify) { + List itemsToModify) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.timestampsToReturn = timestampsToReturn; - this.noOfItemsToModify = noOfItemsToModify; this.itemsToModify = itemsToModify; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -75,11 +72,7 @@ public TimestampsToReturn getTimestampsToReturn() { return timestampsToReturn; } - public int getNoOfItemsToModify() { - return noOfItemsToModify; - } - - public List getItemsToModify() { + public List getItemsToModify() { return itemsToModify; } @@ -106,8 +99,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) TimestampsToReturn::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfItemsToModify) - writeSimpleField("noOfItemsToModify", noOfItemsToModify, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfItemsToModify) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfItemsToModify = + (int) ((((getItemsToModify()) == (null)) ? -(1) : COUNT(getItemsToModify()))); + writeImplicitField("noOfItemsToModify", noOfItemsToModify, writeSignedInt(writeBuffer, 32)); // Array Field (itemsToModify) writeComplexTypeArrayField("itemsToModify", itemsToModify, writeBuffer); @@ -135,13 +131,13 @@ public int getLengthInBits() { // Simple field (timestampsToReturn) lengthInBits += 32; - // Simple field (noOfItemsToModify) + // Implicit Field (noOfItemsToModify) lengthInBits += 32; // Array field if (itemsToModify != null) { int i = 0; - for (ExtensionObjectDefinition element : itemsToModify) { + for (MonitoredItemModifyRequest element : itemsToModify) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= itemsToModify.size()); lengthInBits += element.getLengthInBits(); } @@ -151,16 +147,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModifyMonitoredItemsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -171,47 +168,46 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "TimestampsToReturn", readEnum(TimestampsToReturn::enumForValue, readUnsignedLong(readBuffer, 32))); - int noOfItemsToModify = readSimpleField("noOfItemsToModify", readSignedInt(readBuffer, 32)); + int noOfItemsToModify = readImplicitField("noOfItemsToModify", readSignedInt(readBuffer, 32)); - List itemsToModify = + List itemsToModify = readCountArrayField( "itemsToModify", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("757")), + () -> + (MonitoredItemModifyRequest) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (757)), readBuffer), noOfItemsToModify); readBuffer.closeContext("ModifyMonitoredItemsRequest"); // Create the instance return new ModifyMonitoredItemsRequestBuilderImpl( - requestHeader, subscriptionId, timestampsToReturn, noOfItemsToModify, itemsToModify); + requestHeader, subscriptionId, timestampsToReturn, itemsToModify); } public static class ModifyMonitoredItemsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final TimestampsToReturn timestampsToReturn; - private final int noOfItemsToModify; - private final List itemsToModify; + private final List itemsToModify; public ModifyMonitoredItemsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, TimestampsToReturn timestampsToReturn, - int noOfItemsToModify, - List itemsToModify) { + List itemsToModify) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.timestampsToReturn = timestampsToReturn; - this.noOfItemsToModify = noOfItemsToModify; this.itemsToModify = itemsToModify; } public ModifyMonitoredItemsRequest build() { ModifyMonitoredItemsRequest modifyMonitoredItemsRequest = new ModifyMonitoredItemsRequest( - requestHeader, subscriptionId, timestampsToReturn, noOfItemsToModify, itemsToModify); + requestHeader, subscriptionId, timestampsToReturn, itemsToModify); return modifyMonitoredItemsRequest; } } @@ -228,7 +224,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getSubscriptionId() == that.getSubscriptionId()) && (getTimestampsToReturn() == that.getTimestampsToReturn()) - && (getNoOfItemsToModify() == that.getNoOfItemsToModify()) && (getItemsToModify() == that.getItemsToModify()) && super.equals(that) && true; @@ -241,7 +236,6 @@ public int hashCode() { getRequestHeader(), getSubscriptionId(), getTimestampsToReturn(), - getNoOfItemsToModify(), getItemsToModify()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsResponse.java index eebec90aec4..aaae4efc7e3 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifyMonitoredItemsResponse.java @@ -38,47 +38,33 @@ public class ModifyMonitoredItemsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "766"; + public Integer getExtensionId() { + return (int) 766; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public ModifyMonitoredItemsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (MonitoredItemModifyResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModifyMonitoredItemsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("760")), + () -> + (MonitoredItemModifyResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (760)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ModifyMonitoredItemsResponse"); // Create the instance - return new ModifyMonitoredItemsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new ModifyMonitoredItemsResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class ModifyMonitoredItemsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public ModifyMonitoredItemsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public ModifyMonitoredItemsResponse build() { ModifyMonitoredItemsResponse modifyMonitoredItemsResponse = - new ModifyMonitoredItemsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new ModifyMonitoredItemsResponse(responseHeader, results, diagnosticInfos); return modifyMonitoredItemsResponse; } } @@ -225,9 +212,7 @@ public boolean equals(Object o) { } ModifyMonitoredItemsResponse that = (ModifyMonitoredItemsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +220,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionRequest.java index 5345ef06782..a383de614e3 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionRequest.java @@ -38,12 +38,12 @@ public class ModifySubscriptionRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "793"; + public Integer getExtensionId() { + return (int) 793; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final double requestedPublishingInterval; protected final long requestedLifetimeCount; @@ -52,7 +52,7 @@ public String getIdentifier() { protected final short priority; public ModifySubscriptionRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, double requestedPublishingInterval, long requestedLifetimeCount, @@ -69,7 +69,7 @@ public ModifySubscriptionRequest( this.priority = priority; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -172,16 +172,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModifySubscriptionRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -214,7 +215,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class ModifySubscriptionRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final double requestedPublishingInterval; private final long requestedLifetimeCount; @@ -223,7 +224,7 @@ public static class ModifySubscriptionRequestBuilderImpl private final short priority; public ModifySubscriptionRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, double requestedPublishingInterval, long requestedLifetimeCount, diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionResponse.java index cfaa266536a..c5dd5f6a6e9 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ModifySubscriptionResponse.java @@ -38,18 +38,18 @@ public class ModifySubscriptionResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "796"; + public Integer getExtensionId() { + return (int) 796; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final double revisedPublishingInterval; protected final long revisedLifetimeCount; protected final long revisedMaxKeepAliveCount; public ModifySubscriptionResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, double revisedPublishingInterval, long revisedLifetimeCount, long revisedMaxKeepAliveCount) { @@ -60,7 +60,7 @@ public ModifySubscriptionResponse( this.revisedMaxKeepAliveCount = revisedMaxKeepAliveCount; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -128,16 +128,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ModifySubscriptionResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); double revisedPublishingInterval = @@ -157,13 +158,13 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class ModifySubscriptionResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final double revisedPublishingInterval; private final long revisedLifetimeCount; private final long revisedMaxKeepAliveCount; public ModifySubscriptionResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, double revisedPublishingInterval, long revisedLifetimeCount, long revisedMaxKeepAliveCount) { diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateRequest.java index 130a364d35e..afd323fc4fe 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateRequest.java @@ -38,26 +38,26 @@ public class MonitoredItemCreateRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "745"; + public Integer getExtensionId() { + return (int) 745; } // Properties. - protected final ExtensionObjectDefinition itemToMonitor; + protected final ReadValueId itemToMonitor; protected final MonitoringMode monitoringMode; - protected final ExtensionObjectDefinition requestedParameters; + protected final MonitoringParameters requestedParameters; public MonitoredItemCreateRequest( - ExtensionObjectDefinition itemToMonitor, + ReadValueId itemToMonitor, MonitoringMode monitoringMode, - ExtensionObjectDefinition requestedParameters) { + MonitoringParameters requestedParameters) { super(); this.itemToMonitor = itemToMonitor; this.monitoringMode = monitoringMode; this.requestedParameters = requestedParameters; } - public ExtensionObjectDefinition getItemToMonitor() { + public ReadValueId getItemToMonitor() { return itemToMonitor; } @@ -65,7 +65,7 @@ public MonitoringMode getMonitoringMode() { return monitoringMode; } - public ExtensionObjectDefinition getRequestedParameters() { + public MonitoringParameters getRequestedParameters() { return requestedParameters; } @@ -117,16 +117,16 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoredItemCreateRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition itemToMonitor = + ReadValueId itemToMonitor = readSimpleField( "itemToMonitor", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("628")), + () -> (ReadValueId) ExtensionObjectDefinition.staticParse(readBuffer, (int) (628)), readBuffer)); MonitoringMode monitoringMode = @@ -135,11 +135,13 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "MonitoringMode", readEnum(MonitoringMode::enumForValue, readUnsignedLong(readBuffer, 32))); - ExtensionObjectDefinition requestedParameters = + MonitoringParameters requestedParameters = readSimpleField( "requestedParameters", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("742")), + () -> + (MonitoringParameters) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (742)), readBuffer)); readBuffer.closeContext("MonitoredItemCreateRequest"); @@ -150,14 +152,14 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class MonitoredItemCreateRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition itemToMonitor; + private final ReadValueId itemToMonitor; private final MonitoringMode monitoringMode; - private final ExtensionObjectDefinition requestedParameters; + private final MonitoringParameters requestedParameters; public MonitoredItemCreateRequestBuilderImpl( - ExtensionObjectDefinition itemToMonitor, + ReadValueId itemToMonitor, MonitoringMode monitoringMode, - ExtensionObjectDefinition requestedParameters) { + MonitoringParameters requestedParameters) { this.itemToMonitor = itemToMonitor; this.monitoringMode = monitoringMode; this.requestedParameters = requestedParameters; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateResult.java index 8fb0dcdf503..09464a4e832 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemCreateResult.java @@ -38,8 +38,8 @@ public class MonitoredItemCreateResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "748"; + public Integer getExtensionId() { + return (int) 748; } // Properties. @@ -139,7 +139,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoredItemCreateResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyRequest.java index cf7f0b2349d..df83905e424 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyRequest.java @@ -38,16 +38,16 @@ public class MonitoredItemModifyRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "757"; + public Integer getExtensionId() { + return (int) 757; } // Properties. protected final long monitoredItemId; - protected final ExtensionObjectDefinition requestedParameters; + protected final MonitoringParameters requestedParameters; public MonitoredItemModifyRequest( - long monitoredItemId, ExtensionObjectDefinition requestedParameters) { + long monitoredItemId, MonitoringParameters requestedParameters) { super(); this.monitoredItemId = monitoredItemId; this.requestedParameters = requestedParameters; @@ -57,7 +57,7 @@ public long getMonitoredItemId() { return monitoredItemId; } - public ExtensionObjectDefinition getRequestedParameters() { + public MonitoringParameters getRequestedParameters() { return requestedParameters; } @@ -98,18 +98,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoredItemModifyRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); long monitoredItemId = readSimpleField("monitoredItemId", readUnsignedLong(readBuffer, 32)); - ExtensionObjectDefinition requestedParameters = + MonitoringParameters requestedParameters = readSimpleField( "requestedParameters", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("742")), + () -> + (MonitoringParameters) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (742)), readBuffer)); readBuffer.closeContext("MonitoredItemModifyRequest"); @@ -120,10 +122,10 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class MonitoredItemModifyRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final long monitoredItemId; - private final ExtensionObjectDefinition requestedParameters; + private final MonitoringParameters requestedParameters; public MonitoredItemModifyRequestBuilderImpl( - long monitoredItemId, ExtensionObjectDefinition requestedParameters) { + long monitoredItemId, MonitoringParameters requestedParameters) { this.monitoredItemId = monitoredItemId; this.requestedParameters = requestedParameters; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyResult.java index 41bb5c75bec..da029ac49ae 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemModifyResult.java @@ -38,8 +38,8 @@ public class MonitoredItemModifyResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "760"; + public Integer getExtensionId() { + return (int) 760; } // Properties. @@ -126,7 +126,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoredItemModifyResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemNotification.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemNotification.java index 06a9be922b2..0f55d7f12b4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemNotification.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoredItemNotification.java @@ -38,8 +38,8 @@ public class MonitoredItemNotification extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "808"; + public Integer getExtensionId() { + return (int) 808; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoredItemNotification"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilter.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilter.java index 2da8e9f5a0c..bedfd805efb 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilter.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilter.java @@ -38,8 +38,8 @@ public class MonitoringFilter extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "721"; + public Integer getExtensionId() { + return (int) 721; } public MonitoringFilter() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoringFilter"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilterResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilterResult.java index b912ee9ca5e..e680ab1720a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilterResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringFilterResult.java @@ -38,8 +38,8 @@ public class MonitoringFilterResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "733"; + public Integer getExtensionId() { + return (int) 733; } public MonitoringFilterResult() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoringFilterResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringParameters.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringParameters.java index 2d19b37038c..63238241cb3 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringParameters.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/MonitoringParameters.java @@ -38,8 +38,8 @@ public class MonitoringParameters extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "742"; + public Integer getExtensionId() { + return (int) 742; } // Properties. @@ -144,7 +144,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("MonitoringParameters"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressDataType.java index eba7f6fe849..a3d0ef55527 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressDataType.java @@ -38,8 +38,8 @@ public class NetworkAddressDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15504"; + public Integer getExtensionId() { + return (int) 15504; } // Properties. @@ -85,7 +85,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NetworkAddressDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressUrlDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressUrlDataType.java new file mode 100644 index 00000000000..11381835478 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkAddressUrlDataType.java @@ -0,0 +1,165 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class NetworkAddressUrlDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15512; + } + + // Properties. + protected final PascalString networkInterface; + protected final PascalString url; + + public NetworkAddressUrlDataType(PascalString networkInterface, PascalString url) { + super(); + this.networkInterface = networkInterface; + this.url = url; + } + + public PascalString getNetworkInterface() { + return networkInterface; + } + + public PascalString getUrl() { + return url; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("NetworkAddressUrlDataType"); + + // Simple Field (networkInterface) + writeSimpleField("networkInterface", networkInterface, writeComplex(writeBuffer)); + + // Simple Field (url) + writeSimpleField("url", url, writeComplex(writeBuffer)); + + writeBuffer.popContext("NetworkAddressUrlDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + NetworkAddressUrlDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (networkInterface) + lengthInBits += networkInterface.getLengthInBits(); + + // Simple field (url) + lengthInBits += url.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("NetworkAddressUrlDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString networkInterface = + readSimpleField( + "networkInterface", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + PascalString url = + readSimpleField("url", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("NetworkAddressUrlDataType"); + // Create the instance + return new NetworkAddressUrlDataTypeBuilderImpl(networkInterface, url); + } + + public static class NetworkAddressUrlDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString networkInterface; + private final PascalString url; + + public NetworkAddressUrlDataTypeBuilderImpl(PascalString networkInterface, PascalString url) { + this.networkInterface = networkInterface; + this.url = url; + } + + public NetworkAddressUrlDataType build() { + NetworkAddressUrlDataType networkAddressUrlDataType = + new NetworkAddressUrlDataType(networkInterface, url); + return networkAddressUrlDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof NetworkAddressUrlDataType)) { + return false; + } + NetworkAddressUrlDataType that = (NetworkAddressUrlDataType) o; + return (getNetworkInterface() == that.getNetworkInterface()) + && (getUrl() == that.getUrl()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getNetworkInterface(), getUrl()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkGroupDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkGroupDataType.java index 41a89d7b3dc..c4ee5704446 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkGroupDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NetworkGroupDataType.java @@ -38,20 +38,17 @@ public class NetworkGroupDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "11946"; + public Integer getExtensionId() { + return (int) 11946; } // Properties. protected final PascalString serverUri; - protected final int noOfNetworkPaths; - protected final List networkPaths; + protected final List networkPaths; - public NetworkGroupDataType( - PascalString serverUri, int noOfNetworkPaths, List networkPaths) { + public NetworkGroupDataType(PascalString serverUri, List networkPaths) { super(); this.serverUri = serverUri; - this.noOfNetworkPaths = noOfNetworkPaths; this.networkPaths = networkPaths; } @@ -59,11 +56,7 @@ public PascalString getServerUri() { return serverUri; } - public int getNoOfNetworkPaths() { - return noOfNetworkPaths; - } - - public List getNetworkPaths() { + public List getNetworkPaths() { return networkPaths; } @@ -77,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (serverUri) writeSimpleField("serverUri", serverUri, writeComplex(writeBuffer)); - // Simple Field (noOfNetworkPaths) - writeSimpleField("noOfNetworkPaths", noOfNetworkPaths, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNetworkPaths) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNetworkPaths = + (int) ((((getNetworkPaths()) == (null)) ? -(1) : COUNT(getNetworkPaths()))); + writeImplicitField("noOfNetworkPaths", noOfNetworkPaths, writeSignedInt(writeBuffer, 32)); // Array Field (networkPaths) writeComplexTypeArrayField("networkPaths", networkPaths, writeBuffer); @@ -100,13 +96,13 @@ public int getLengthInBits() { // Simple field (serverUri) lengthInBits += serverUri.getLengthInBits(); - // Simple field (noOfNetworkPaths) + // Implicit Field (noOfNetworkPaths) lengthInBits += 32; // Array field if (networkPaths != null) { int i = 0; - for (ExtensionObjectDefinition element : networkPaths) { + for (EndpointUrlListDataType element : networkPaths) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= networkPaths.size()); lengthInBits += element.getLengthInBits(); } @@ -116,7 +112,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NetworkGroupDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -125,39 +121,36 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "serverUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfNetworkPaths = readSimpleField("noOfNetworkPaths", readSignedInt(readBuffer, 32)); + int noOfNetworkPaths = readImplicitField("noOfNetworkPaths", readSignedInt(readBuffer, 32)); - List networkPaths = + List networkPaths = readCountArrayField( "networkPaths", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("11945")), + () -> + (EndpointUrlListDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (11945)), readBuffer), noOfNetworkPaths); readBuffer.closeContext("NetworkGroupDataType"); // Create the instance - return new NetworkGroupDataTypeBuilderImpl(serverUri, noOfNetworkPaths, networkPaths); + return new NetworkGroupDataTypeBuilderImpl(serverUri, networkPaths); } public static class NetworkGroupDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString serverUri; - private final int noOfNetworkPaths; - private final List networkPaths; + private final List networkPaths; public NetworkGroupDataTypeBuilderImpl( - PascalString serverUri, - int noOfNetworkPaths, - List networkPaths) { + PascalString serverUri, List networkPaths) { this.serverUri = serverUri; - this.noOfNetworkPaths = noOfNetworkPaths; this.networkPaths = networkPaths; } public NetworkGroupDataType build() { - NetworkGroupDataType networkGroupDataType = - new NetworkGroupDataType(serverUri, noOfNetworkPaths, networkPaths); + NetworkGroupDataType networkGroupDataType = new NetworkGroupDataType(serverUri, networkPaths); return networkGroupDataType; } } @@ -172,7 +165,6 @@ public boolean equals(Object o) { } NetworkGroupDataType that = (NetworkGroupDataType) o; return (getServerUri() == that.getServerUri()) - && (getNoOfNetworkPaths() == that.getNoOfNetworkPaths()) && (getNetworkPaths() == that.getNetworkPaths()) && super.equals(that) && true; @@ -180,7 +172,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getServerUri(), getNoOfNetworkPaths(), getNetworkPaths()); + return Objects.hash(super.hashCode(), getServerUri(), getNetworkPaths()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeAttributes.java index 888f56724be..809f327f477 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeAttributes.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeAttributes.java @@ -38,8 +38,8 @@ public class NodeAttributes extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "351"; + public Integer getExtensionId() { + return (int) 351; } // Properties. @@ -139,7 +139,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NodeAttributes"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeId.java index df478dd9844..af9b0859b44 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeId.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeId.java @@ -49,10 +49,6 @@ public NodeIdTypeDefinition getNodeId() { return nodeId; } - public String getId() { - return String.valueOf(getNodeId().getIdentifier()); - } - public void serialize(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -64,10 +60,6 @@ public void serialize(WriteBuffer writeBuffer) throws SerializationException { // Simple Field (nodeId) writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); - // Virtual field (doesn't actually serialize anything, just makes the value available) - String id = getId(); - writeBuffer.writeVirtual("id", id); - writeBuffer.popContext("NodeId"); } @@ -88,8 +80,6 @@ public int getLengthInBits() { // Simple field (nodeId) lengthInBits += nodeId.getLengthInBits(); - // A virtual field doesn't have any in- or output. - return lengthInBits; } @@ -103,7 +93,6 @@ public static NodeId staticParse(ReadBuffer readBuffer) throws ParseException { NodeIdTypeDefinition nodeId = readSimpleField( "nodeId", readComplex(() -> NodeIdTypeDefinition.staticParse(readBuffer), readBuffer)); - String id = readVirtualField("id", String.class, nodeId.getIdentifier()); readBuffer.closeContext("NodeId"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdByteString.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdByteString.java index d2d80437a7d..e9521e95cf6 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdByteString.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdByteString.java @@ -64,6 +64,10 @@ public String getIdentifier() { return String.valueOf(getId().getStringValue()); } + public short getNamespace() { + return (short) (getNamespaceIndex()); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -81,6 +85,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdByteString"); } @@ -103,6 +111,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -118,6 +128,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder readSimpleField( "id", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); String identifier = readVirtualField("identifier", String.class, id.getStringValue()); + short namespace = readVirtualField("namespace", short.class, namespaceIndex); readBuffer.closeContext("NodeIdByteString"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdFourByte.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdFourByte.java index 67a4cf95046..effc2d9e227 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdFourByte.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdFourByte.java @@ -64,6 +64,10 @@ public String getIdentifier() { return String.valueOf(getId()); } + public short getNamespace() { + return (short) (getNamespaceIndex()); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -81,6 +85,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdFourByte"); } @@ -103,6 +111,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -116,6 +126,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder int id = readSimpleField("id", readUnsignedInt(readBuffer, 16)); String identifier = readVirtualField("identifier", String.class, id); + short namespace = readVirtualField("namespace", short.class, namespaceIndex); readBuffer.closeContext("NodeIdFourByte"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdGuid.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdGuid.java index 3df366f018d..58f934df0b1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdGuid.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdGuid.java @@ -64,6 +64,10 @@ public String getIdentifier() { return String.valueOf(getId()); } + public short getNamespace() { + return (short) (getNamespaceIndex()); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -81,6 +85,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdGuid"); } @@ -105,6 +113,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -118,6 +128,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder byte[] id = readBuffer.readByteArray("id", Math.toIntExact(16)); String identifier = readVirtualField("identifier", String.class, id); + short namespace = readVirtualField("namespace", short.class, namespaceIndex); readBuffer.closeContext("NodeIdGuid"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdNumeric.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdNumeric.java index c00daa406bb..20708999aff 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdNumeric.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdNumeric.java @@ -64,6 +64,10 @@ public String getIdentifier() { return String.valueOf(getId()); } + public short getNamespace() { + return (short) (getNamespaceIndex()); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -81,6 +85,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdNumeric"); } @@ -103,6 +111,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -116,6 +126,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder long id = readSimpleField("id", readUnsignedLong(readBuffer, 32)); String identifier = readVirtualField("identifier", String.class, id); + short namespace = readVirtualField("namespace", short.class, namespaceIndex); readBuffer.closeContext("NodeIdNumeric"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdString.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdString.java index ce718b1fc1a..eadede11fb2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdString.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdString.java @@ -64,6 +64,10 @@ public String getIdentifier() { return String.valueOf(getId().getStringValue()); } + public short getNamespace() { + return (short) (getNamespaceIndex()); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -81,6 +85,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdString"); } @@ -103,6 +111,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -117,6 +127,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder PascalString id = readSimpleField("id", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); String identifier = readVirtualField("identifier", String.class, id.getStringValue()); + short namespace = readVirtualField("namespace", short.class, namespaceIndex); readBuffer.closeContext("NodeIdString"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTwoByte.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTwoByte.java index 955ca03a4ec..e17f6c5a882 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTwoByte.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTwoByte.java @@ -58,6 +58,10 @@ public String getIdentifier() { return String.valueOf(getId()); } + public short getNamespace() { + return (short) (-(1)); + } + @Override protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -72,6 +76,10 @@ protected void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) String identifier = getIdentifier(); writeBuffer.writeVirtual("identifier", identifier); + // Virtual field (doesn't actually serialize anything, just makes the value available) + short namespace = getNamespace(); + writeBuffer.writeVirtual("namespace", namespace); + writeBuffer.popContext("NodeIdTwoByte"); } @@ -91,6 +99,8 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. + // A virtual field doesn't have any in- or output. + return lengthInBits; } @@ -102,6 +112,7 @@ public static NodeIdTypeDefinitionBuilder staticParseNodeIdTypeDefinitionBuilder short id = readSimpleField("id", readUnsignedShort(readBuffer, 8)); String identifier = readVirtualField("identifier", String.class, id); + short namespace = readVirtualField("namespace", short.class, -(1)); readBuffer.closeContext("NodeIdTwoByte"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTypeDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTypeDefinition.java index 87bea002111..42f7373b095 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTypeDefinition.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeIdTypeDefinition.java @@ -46,6 +46,8 @@ public NodeIdTypeDefinition() { public abstract String getIdentifier(); + public abstract short getNamespace(); + protected abstract void serializeNodeIdTypeDefinitionChild(WriteBuffer writeBuffer) throws SerializationException; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeReference.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeReference.java index eb00420220c..f3d1921da0f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeReference.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeReference.java @@ -38,28 +38,22 @@ public class NodeReference extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "582"; + public Integer getExtensionId() { + return (int) 582; } // Properties. protected final NodeId nodeId; protected final NodeId referenceTypeId; protected final boolean isForward; - protected final int noOfReferencedNodeIds; protected final List referencedNodeIds; public NodeReference( - NodeId nodeId, - NodeId referenceTypeId, - boolean isForward, - int noOfReferencedNodeIds, - List referencedNodeIds) { + NodeId nodeId, NodeId referenceTypeId, boolean isForward, List referencedNodeIds) { super(); this.nodeId = nodeId; this.referenceTypeId = referenceTypeId; this.isForward = isForward; - this.noOfReferencedNodeIds = noOfReferencedNodeIds; this.referencedNodeIds = referencedNodeIds; } @@ -75,10 +69,6 @@ public boolean getIsForward() { return isForward; } - public int getNoOfReferencedNodeIds() { - return noOfReferencedNodeIds; - } - public List getReferencedNodeIds() { return referencedNodeIds; } @@ -102,8 +92,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (isForward) writeSimpleField("isForward", isForward, writeBoolean(writeBuffer)); - // Simple Field (noOfReferencedNodeIds) - writeSimpleField( + // Implicit Field (noOfReferencedNodeIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReferencedNodeIds = + (int) ((((getReferencedNodeIds()) == (null)) ? -(1) : COUNT(getReferencedNodeIds()))); + writeImplicitField( "noOfReferencedNodeIds", noOfReferencedNodeIds, writeSignedInt(writeBuffer, 32)); // Array Field (referencedNodeIds) @@ -135,7 +128,7 @@ public int getLengthInBits() { // Simple field (isForward) lengthInBits += 1; - // Simple field (noOfReferencedNodeIds) + // Implicit Field (noOfReferencedNodeIds) lengthInBits += 32; // Array field @@ -151,7 +144,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NodeReference"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -169,7 +162,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit boolean isForward = readSimpleField("isForward", readBoolean(readBuffer)); int noOfReferencedNodeIds = - readSimpleField("noOfReferencedNodeIds", readSignedInt(readBuffer, 32)); + readImplicitField("noOfReferencedNodeIds", readSignedInt(readBuffer, 32)); List referencedNodeIds = readCountArrayField( @@ -179,8 +172,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("NodeReference"); // Create the instance - return new NodeReferenceBuilderImpl( - nodeId, referenceTypeId, isForward, noOfReferencedNodeIds, referencedNodeIds); + return new NodeReferenceBuilderImpl(nodeId, referenceTypeId, isForward, referencedNodeIds); } public static class NodeReferenceBuilderImpl @@ -188,26 +180,19 @@ public static class NodeReferenceBuilderImpl private final NodeId nodeId; private final NodeId referenceTypeId; private final boolean isForward; - private final int noOfReferencedNodeIds; private final List referencedNodeIds; public NodeReferenceBuilderImpl( - NodeId nodeId, - NodeId referenceTypeId, - boolean isForward, - int noOfReferencedNodeIds, - List referencedNodeIds) { + NodeId nodeId, NodeId referenceTypeId, boolean isForward, List referencedNodeIds) { this.nodeId = nodeId; this.referenceTypeId = referenceTypeId; this.isForward = isForward; - this.noOfReferencedNodeIds = noOfReferencedNodeIds; this.referencedNodeIds = referencedNodeIds; } public NodeReference build() { NodeReference nodeReference = - new NodeReference( - nodeId, referenceTypeId, isForward, noOfReferencedNodeIds, referencedNodeIds); + new NodeReference(nodeId, referenceTypeId, isForward, referencedNodeIds); return nodeReference; } } @@ -224,7 +209,6 @@ public boolean equals(Object o) { return (getNodeId() == that.getNodeId()) && (getReferenceTypeId() == that.getReferenceTypeId()) && (getIsForward() == that.getIsForward()) - && (getNoOfReferencedNodeIds() == that.getNoOfReferencedNodeIds()) && (getReferencedNodeIds() == that.getReferencedNodeIds()) && super.equals(that) && true; @@ -237,7 +221,6 @@ public int hashCode() { getNodeId(), getReferenceTypeId(), getIsForward(), - getNoOfReferencedNodeIds(), getReferencedNodeIds()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeTypeDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeTypeDescription.java index 4c4f8f5f60a..5da829a101e 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeTypeDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NodeTypeDescription.java @@ -38,25 +38,22 @@ public class NodeTypeDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "575"; + public Integer getExtensionId() { + return (int) 575; } // Properties. protected final ExpandedNodeId typeDefinitionNode; protected final boolean includeSubTypes; - protected final int noOfDataToReturn; - protected final List dataToReturn; + protected final List dataToReturn; public NodeTypeDescription( ExpandedNodeId typeDefinitionNode, boolean includeSubTypes, - int noOfDataToReturn, - List dataToReturn) { + List dataToReturn) { super(); this.typeDefinitionNode = typeDefinitionNode; this.includeSubTypes = includeSubTypes; - this.noOfDataToReturn = noOfDataToReturn; this.dataToReturn = dataToReturn; } @@ -68,11 +65,7 @@ public boolean getIncludeSubTypes() { return includeSubTypes; } - public int getNoOfDataToReturn() { - return noOfDataToReturn; - } - - public List getDataToReturn() { + public List getDataToReturn() { return dataToReturn; } @@ -92,8 +85,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (includeSubTypes) writeSimpleField("includeSubTypes", includeSubTypes, writeBoolean(writeBuffer)); - // Simple Field (noOfDataToReturn) - writeSimpleField("noOfDataToReturn", noOfDataToReturn, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDataToReturn) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataToReturn = + (int) ((((getDataToReturn()) == (null)) ? -(1) : COUNT(getDataToReturn()))); + writeImplicitField("noOfDataToReturn", noOfDataToReturn, writeSignedInt(writeBuffer, 32)); // Array Field (dataToReturn) writeComplexTypeArrayField("dataToReturn", dataToReturn, writeBuffer); @@ -121,13 +117,13 @@ public int getLengthInBits() { // Simple field (includeSubTypes) lengthInBits += 1; - // Simple field (noOfDataToReturn) + // Implicit Field (noOfDataToReturn) lengthInBits += 32; // Array field if (dataToReturn != null) { int i = 0; - for (ExtensionObjectDefinition element : dataToReturn) { + for (QueryDataDescription element : dataToReturn) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataToReturn.size()); lengthInBits += element.getLengthInBits(); } @@ -137,7 +133,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NodeTypeDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -152,44 +148,41 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit boolean includeSubTypes = readSimpleField("includeSubTypes", readBoolean(readBuffer)); - int noOfDataToReturn = readSimpleField("noOfDataToReturn", readSignedInt(readBuffer, 32)); + int noOfDataToReturn = readImplicitField("noOfDataToReturn", readSignedInt(readBuffer, 32)); - List dataToReturn = + List dataToReturn = readCountArrayField( "dataToReturn", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("572")), + () -> + (QueryDataDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (572)), readBuffer), noOfDataToReturn); readBuffer.closeContext("NodeTypeDescription"); // Create the instance - return new NodeTypeDescriptionBuilderImpl( - typeDefinitionNode, includeSubTypes, noOfDataToReturn, dataToReturn); + return new NodeTypeDescriptionBuilderImpl(typeDefinitionNode, includeSubTypes, dataToReturn); } public static class NodeTypeDescriptionBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final ExpandedNodeId typeDefinitionNode; private final boolean includeSubTypes; - private final int noOfDataToReturn; - private final List dataToReturn; + private final List dataToReturn; public NodeTypeDescriptionBuilderImpl( ExpandedNodeId typeDefinitionNode, boolean includeSubTypes, - int noOfDataToReturn, - List dataToReturn) { + List dataToReturn) { this.typeDefinitionNode = typeDefinitionNode; this.includeSubTypes = includeSubTypes; - this.noOfDataToReturn = noOfDataToReturn; this.dataToReturn = dataToReturn; } public NodeTypeDescription build() { NodeTypeDescription nodeTypeDescription = - new NodeTypeDescription( - typeDefinitionNode, includeSubTypes, noOfDataToReturn, dataToReturn); + new NodeTypeDescription(typeDefinitionNode, includeSubTypes, dataToReturn); return nodeTypeDescription; } } @@ -205,7 +198,6 @@ public boolean equals(Object o) { NodeTypeDescription that = (NodeTypeDescription) o; return (getTypeDefinitionNode() == that.getTypeDefinitionNode()) && (getIncludeSubTypes() == that.getIncludeSubTypes()) - && (getNoOfDataToReturn() == that.getNoOfDataToReturn()) && (getDataToReturn() == that.getDataToReturn()) && super.equals(that) && true; @@ -214,11 +206,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getTypeDefinitionNode(), - getIncludeSubTypes(), - getNoOfDataToReturn(), - getDataToReturn()); + super.hashCode(), getTypeDefinitionNode(), getIncludeSubTypes(), getDataToReturn()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationData.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationData.java index b7fd6d0c844..97fda1b88ff 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationData.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationData.java @@ -38,8 +38,8 @@ public class NotificationData extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "947"; + public Integer getExtensionId() { + return (int) 947; } public NotificationData() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NotificationData"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationMessage.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationMessage.java index 9924be11a68..99b6d1227cb 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationMessage.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NotificationMessage.java @@ -38,25 +38,20 @@ public class NotificationMessage extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "805"; + public Integer getExtensionId() { + return (int) 805; } // Properties. protected final long sequenceNumber; protected final long publishTime; - protected final int noOfNotificationData; protected final List notificationData; public NotificationMessage( - long sequenceNumber, - long publishTime, - int noOfNotificationData, - List notificationData) { + long sequenceNumber, long publishTime, List notificationData) { super(); this.sequenceNumber = sequenceNumber; this.publishTime = publishTime; - this.noOfNotificationData = noOfNotificationData; this.notificationData = notificationData; } @@ -68,10 +63,6 @@ public long getPublishTime() { return publishTime; } - public int getNoOfNotificationData() { - return noOfNotificationData; - } - public List getNotificationData() { return notificationData; } @@ -89,8 +80,12 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (publishTime) writeSimpleField("publishTime", publishTime, writeSignedLong(writeBuffer, 64)); - // Simple Field (noOfNotificationData) - writeSimpleField("noOfNotificationData", noOfNotificationData, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNotificationData) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNotificationData = + (int) ((((getNotificationData()) == (null)) ? -(1) : COUNT(getNotificationData()))); + writeImplicitField( + "noOfNotificationData", noOfNotificationData, writeSignedInt(writeBuffer, 32)); // Array Field (notificationData) writeComplexTypeArrayField("notificationData", notificationData, writeBuffer); @@ -115,7 +110,7 @@ public int getLengthInBits() { // Simple field (publishTime) lengthInBits += 64; - // Simple field (noOfNotificationData) + // Implicit Field (noOfNotificationData) lengthInBits += 32; // Array field @@ -131,7 +126,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NotificationMessage"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -141,7 +136,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit long publishTime = readSimpleField("publishTime", readSignedLong(readBuffer, 64)); int noOfNotificationData = - readSimpleField("noOfNotificationData", readSignedInt(readBuffer, 32)); + readImplicitField("noOfNotificationData", readSignedInt(readBuffer, 32)); List notificationData = readCountArrayField( @@ -152,32 +147,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("NotificationMessage"); // Create the instance - return new NotificationMessageBuilderImpl( - sequenceNumber, publishTime, noOfNotificationData, notificationData); + return new NotificationMessageBuilderImpl(sequenceNumber, publishTime, notificationData); } public static class NotificationMessageBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final long sequenceNumber; private final long publishTime; - private final int noOfNotificationData; private final List notificationData; public NotificationMessageBuilderImpl( - long sequenceNumber, - long publishTime, - int noOfNotificationData, - List notificationData) { + long sequenceNumber, long publishTime, List notificationData) { this.sequenceNumber = sequenceNumber; this.publishTime = publishTime; - this.noOfNotificationData = noOfNotificationData; this.notificationData = notificationData; } public NotificationMessage build() { NotificationMessage notificationMessage = - new NotificationMessage( - sequenceNumber, publishTime, noOfNotificationData, notificationData); + new NotificationMessage(sequenceNumber, publishTime, notificationData); return notificationMessage; } } @@ -193,7 +181,6 @@ public boolean equals(Object o) { NotificationMessage that = (NotificationMessage) o; return (getSequenceNumber() == that.getSequenceNumber()) && (getPublishTime() == that.getPublishTime()) - && (getNoOfNotificationData() == that.getNoOfNotificationData()) && (getNotificationData() == that.getNotificationData()) && super.equals(that) && true; @@ -202,11 +189,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getSequenceNumber(), - getPublishTime(), - getNoOfNotificationData(), - getNotificationData()); + super.hashCode(), getSequenceNumber(), getPublishTime(), getNotificationData()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtension.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtension.java index 334ae2461a6..4baadf013d4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtension.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtension.java @@ -38,8 +38,8 @@ public class NullExtension extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "0"; + public Integer getExtensionId() { + return (int) 0; } public NullExtension() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("NullExtension"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtensionObjectWithMask.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtensionObjectWithMask.java new file mode 100644 index 00000000000..af7d0489e6c --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/NullExtensionObjectWithMask.java @@ -0,0 +1,142 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class NullExtensionObjectWithMask extends ExtensionObjectWithMask implements Message { + + // Accessors for discriminator values. + public Boolean getEncodingMaskXmlBody() { + return (boolean) false; + } + + public Boolean getEncodingMaskBinaryBody() { + return (boolean) false; + } + + public NullExtensionObjectWithMask( + ExpandedNodeId typeId, ExtensionObjectEncodingMask encodingMask) { + super(typeId, encodingMask); + } + + public ExtensionObjectDefinition getBody() { + return (ExtensionObjectDefinition) (null); + } + + @Override + protected void serializeExtensionObjectWithMaskChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("NullExtensionObjectWithMask"); + + // Virtual field (doesn't actually serialize anything, just makes the value available) + ExtensionObjectDefinition body = getBody(); + writeBuffer.writeVirtual("body", body); + + writeBuffer.popContext("NullExtensionObjectWithMask"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + NullExtensionObjectWithMask _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // A virtual field doesn't have any in- or output. + + return lengthInBits; + } + + public static ExtensionObjectWithMaskBuilder staticParseExtensionObjectWithMaskBuilder( + ReadBuffer readBuffer, Integer extensionId, Boolean includeEncodingMask) + throws ParseException { + readBuffer.pullContext("NullExtensionObjectWithMask"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + ExtensionObjectDefinition body = + readVirtualField("body", ExtensionObjectDefinition.class, null); + + readBuffer.closeContext("NullExtensionObjectWithMask"); + // Create the instance + return new NullExtensionObjectWithMaskBuilderImpl(); + } + + public static class NullExtensionObjectWithMaskBuilderImpl + implements ExtensionObjectWithMask.ExtensionObjectWithMaskBuilder { + + public NullExtensionObjectWithMaskBuilderImpl() {} + + public NullExtensionObjectWithMask build( + ExpandedNodeId typeId, ExtensionObjectEncodingMask encodingMask) { + NullExtensionObjectWithMask nullExtensionObjectWithMask = + new NullExtensionObjectWithMask(typeId, encodingMask); + return nullExtensionObjectWithMask; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof NullExtensionObjectWithMask)) { + return false; + } + NullExtensionObjectWithMask that = (NullExtensionObjectWithMask) o; + return super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectAttributes.java new file mode 100644 index 00000000000..74540caf113 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectAttributes.java @@ -0,0 +1,261 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ObjectAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 354; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final short eventNotifier; + + public ObjectAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + short eventNotifier) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.eventNotifier = eventNotifier; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public short getEventNotifier() { + return eventNotifier; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ObjectAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (eventNotifier) + writeSimpleField("eventNotifier", eventNotifier, writeUnsignedShort(writeBuffer, 8)); + + writeBuffer.popContext("ObjectAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ObjectAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Simple field (eventNotifier) + lengthInBits += 8; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ObjectAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + short eventNotifier = readSimpleField("eventNotifier", readUnsignedShort(readBuffer, 8)); + + readBuffer.closeContext("ObjectAttributes"); + // Create the instance + return new ObjectAttributesBuilderImpl( + specifiedAttributes, displayName, description, writeMask, userWriteMask, eventNotifier); + } + + public static class ObjectAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final short eventNotifier; + + public ObjectAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + short eventNotifier) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.eventNotifier = eventNotifier; + } + + public ObjectAttributes build() { + ObjectAttributes objectAttributes = + new ObjectAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + eventNotifier); + return objectAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ObjectAttributes)) { + return false; + } + ObjectAttributes that = (ObjectAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getEventNotifier() == that.getEventNotifier()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getEventNotifier()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectTypeAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectTypeAttributes.java new file mode 100644 index 00000000000..2dde2896766 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ObjectTypeAttributes.java @@ -0,0 +1,265 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ObjectTypeAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 363; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final boolean isAbstract; + + public ObjectTypeAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean isAbstract) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.isAbstract = isAbstract; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public boolean getIsAbstract() { + return isAbstract; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ObjectTypeAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (isAbstract) + writeSimpleField("isAbstract", isAbstract, writeBoolean(writeBuffer)); + + writeBuffer.popContext("ObjectTypeAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ObjectTypeAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (isAbstract) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ObjectTypeAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean isAbstract = readSimpleField("isAbstract", readBoolean(readBuffer)); + + readBuffer.closeContext("ObjectTypeAttributes"); + // Create the instance + return new ObjectTypeAttributesBuilderImpl( + specifiedAttributes, displayName, description, writeMask, userWriteMask, isAbstract); + } + + public static class ObjectTypeAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final boolean isAbstract; + + public ObjectTypeAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean isAbstract) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.isAbstract = isAbstract; + } + + public ObjectTypeAttributes build() { + ObjectTypeAttributes objectTypeAttributes = + new ObjectTypeAttributes( + specifiedAttributes, displayName, description, writeMask, userWriteMask, isAbstract); + return objectTypeAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ObjectTypeAttributes)) { + return false; + } + ObjectTypeAttributes that = (ObjectTypeAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getIsAbstract() == that.getIsAbstract()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getIsAbstract()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAPU.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAPU.java index 66ce614a69a..daac63e4759 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAPU.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAPU.java @@ -81,8 +81,8 @@ public int getLengthInBits() { return lengthInBits; } - public static OpcuaAPU staticParse(ReadBuffer readBuffer, Boolean response) - throws ParseException { + public static OpcuaAPU staticParse( + ReadBuffer readBuffer, Boolean response, Boolean binaryEncoding) throws ParseException { readBuffer.pullContext("OpcuaAPU"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -90,7 +90,11 @@ public static OpcuaAPU staticParse(ReadBuffer readBuffer, Boolean response) MessagePDU message = readSimpleField( "message", - readComplex(() -> MessagePDU.staticParse(readBuffer, (boolean) (response)), readBuffer), + readComplex( + () -> + MessagePDU.staticParse( + readBuffer, (boolean) (response), (boolean) (binaryEncoding)), + readBuffer), WithOption.WithByteOrder(ByteOrder.LITTLE_ENDIAN)); readBuffer.closeContext("OpcuaAPU"); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAcknowledgeResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAcknowledgeResponse.java index a6cc5ba109b..c5ca9bd4876 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAcknowledgeResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaAcknowledgeResponse.java @@ -100,7 +100,7 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Boolean response) throws ParseException { + ReadBuffer readBuffer, Boolean response, Boolean binary) throws ParseException { readBuffer.pullContext("OpcuaAcknowledgeResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaCloseRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaCloseRequest.java index 22c0b2d5fc5..5115ccfd8a9 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaCloseRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaCloseRequest.java @@ -100,7 +100,7 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Boolean response) throws ParseException { + ReadBuffer readBuffer, Boolean response, Boolean binary) throws ParseException { readBuffer.pullContext("OpcuaCloseRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -114,7 +114,8 @@ public static MessagePDUBuilder staticParseMessagePDUBuilder( readSimpleField( "message", readComplex( - () -> Payload.staticParse(readBuffer, (boolean) (false), (long) (0L)), readBuffer)); + () -> Payload.staticParse(readBuffer, (boolean) (binary), (long) (0L)), + readBuffer)); readBuffer.closeContext("OpcuaCloseRequest"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaHelloRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaHelloRequest.java index abd736e9608..e0e07c3544d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaHelloRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaHelloRequest.java @@ -113,7 +113,7 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Boolean response) throws ParseException { + ReadBuffer readBuffer, Boolean response, Boolean binary) throws ParseException { readBuffer.pullContext("OpcuaHelloRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageError.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageError.java index 59302a1b863..c376ff4134c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageError.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageError.java @@ -105,7 +105,7 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Boolean response) throws ParseException { + ReadBuffer readBuffer, Boolean response, Boolean binary) throws ParseException { readBuffer.pullContext("OpcuaMessageError"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageRequest.java index 5742dda7713..ca5dfbc8953 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageRequest.java @@ -100,7 +100,8 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Long totalLength, Boolean response) throws ParseException { + ReadBuffer readBuffer, Long totalLength, Boolean response, Boolean binary) + throws ParseException { readBuffer.pullContext("OpcuaMessageRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -117,7 +118,7 @@ public static MessagePDUBuilder staticParseMessagePDUBuilder( () -> Payload.staticParse( readBuffer, - (boolean) (false), + (boolean) (binary), (long) (((totalLength) - (securityHeader.getLengthInBytes())) - (16L))), readBuffer)); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageResponse.java index 8a04e76de74..16adb423c5b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaMessageResponse.java @@ -100,7 +100,8 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Long totalLength, Boolean response) throws ParseException { + ReadBuffer readBuffer, Long totalLength, Boolean response, Boolean binary) + throws ParseException { readBuffer.pullContext("OpcuaMessageResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -117,7 +118,7 @@ public static MessagePDUBuilder staticParseMessagePDUBuilder( () -> Payload.staticParse( readBuffer, - (boolean) (false), + (boolean) (binary), (long) (((totalLength) - (securityHeader.getLengthInBytes())) - (16L))), readBuffer)); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenRequest.java index 8b1ae66411c..21a240ea0e2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenRequest.java @@ -100,7 +100,8 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Long totalLength, Boolean response) throws ParseException { + ReadBuffer readBuffer, Long totalLength, Boolean response, Boolean binary) + throws ParseException { readBuffer.pullContext("OpcuaOpenRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -119,7 +120,7 @@ public static MessagePDUBuilder staticParseMessagePDUBuilder( () -> Payload.staticParse( readBuffer, - (boolean) (false), + (boolean) (binary), (long) (((totalLength) - (openRequest.getLengthInBytes())) - (16L))), readBuffer)); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenResponse.java index 42129a66d9b..d7a0adc989d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaOpenResponse.java @@ -100,7 +100,8 @@ public int getLengthInBits() { } public static MessagePDUBuilder staticParseMessagePDUBuilder( - ReadBuffer readBuffer, Long totalLength, Boolean response) throws ParseException { + ReadBuffer readBuffer, Long totalLength, Boolean response, Boolean binary) + throws ParseException { readBuffer.pullContext("OpcuaOpenResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -119,7 +120,7 @@ public static MessagePDUBuilder staticParseMessagePDUBuilder( () -> Payload.staticParse( readBuffer, - (boolean) (false), + (boolean) (binary), (long) (((totalLength) - (openResponse.getLengthInBytes())) - (16L))), readBuffer)); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaVector.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaVector.java index 4bca95dc6f7..81377c4eb6c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaVector.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpcuaVector.java @@ -38,8 +38,8 @@ public class OpcuaVector extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "18809"; + public Integer getExtensionId() { + return (int) 18809; } public OpcuaVector() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("OpcuaVector"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelRequest.java index bd0bd85366b..29f433e1c1a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelRequest.java @@ -38,12 +38,12 @@ public class OpenSecureChannelRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "446"; + public Integer getExtensionId() { + return (int) 446; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long clientProtocolVersion; protected final SecurityTokenRequestType requestType; protected final MessageSecurityMode securityMode; @@ -51,7 +51,7 @@ public String getIdentifier() { protected final long requestedLifetime; public OpenSecureChannelRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long clientProtocolVersion, SecurityTokenRequestType requestType, MessageSecurityMode securityMode, @@ -66,7 +66,7 @@ public OpenSecureChannelRequest( this.requestedLifetime = requestedLifetime; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -166,16 +166,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("OpenSecureChannelRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long clientProtocolVersion = @@ -212,7 +213,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class OpenSecureChannelRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long clientProtocolVersion; private final SecurityTokenRequestType requestType; private final MessageSecurityMode securityMode; @@ -220,7 +221,7 @@ public static class OpenSecureChannelRequestBuilderImpl private final long requestedLifetime; public OpenSecureChannelRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long clientProtocolVersion, SecurityTokenRequestType requestType, MessageSecurityMode securityMode, diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelResponse.java index 9582d9ace7a..28d164cb0f1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OpenSecureChannelResponse.java @@ -38,20 +38,20 @@ public class OpenSecureChannelResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "449"; + public Integer getExtensionId() { + return (int) 449; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final long serverProtocolVersion; - protected final ExtensionObjectDefinition securityToken; + protected final ChannelSecurityToken securityToken; protected final PascalByteString serverNonce; public OpenSecureChannelResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long serverProtocolVersion, - ExtensionObjectDefinition securityToken, + ChannelSecurityToken securityToken, PascalByteString serverNonce) { super(); this.responseHeader = responseHeader; @@ -60,7 +60,7 @@ public OpenSecureChannelResponse( this.serverNonce = serverNonce; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -68,7 +68,7 @@ public long getServerProtocolVersion() { return serverProtocolVersion; } - public ExtensionObjectDefinition getSecurityToken() { + public ChannelSecurityToken getSecurityToken() { return securityToken; } @@ -126,26 +126,29 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("OpenSecureChannelResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); long serverProtocolVersion = readSimpleField("serverProtocolVersion", readUnsignedLong(readBuffer, 32)); - ExtensionObjectDefinition securityToken = + ChannelSecurityToken securityToken = readSimpleField( "securityToken", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("443")), + () -> + (ChannelSecurityToken) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (443)), readBuffer)); PascalByteString serverNonce = @@ -160,15 +163,15 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class OpenSecureChannelResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final long serverProtocolVersion; - private final ExtensionObjectDefinition securityToken; + private final ChannelSecurityToken securityToken; private final PascalByteString serverNonce; public OpenSecureChannelResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long serverProtocolVersion, - ExtensionObjectDefinition securityToken, + ChannelSecurityToken securityToken, PascalByteString serverNonce) { this.responseHeader = responseHeader; this.serverProtocolVersion = serverProtocolVersion; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OptionSet.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OptionSet.java index 0ee09edb382..4c3fbe7ba71 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OptionSet.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/OptionSet.java @@ -38,8 +38,8 @@ public class OptionSet extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12757"; + public Integer getExtensionId() { + return (int) 12757; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("OptionSet"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Orientation.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Orientation.java index f1ee9fac8e6..437a141227e 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Orientation.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Orientation.java @@ -38,8 +38,8 @@ public class Orientation extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "18813"; + public Integer getExtensionId() { + return (int) 18813; } public Orientation() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Orientation"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ParsingResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ParsingResult.java index 2d9ca08ea2a..b98230bf0db 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ParsingResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ParsingResult.java @@ -38,28 +38,22 @@ public class ParsingResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "612"; + public Integer getExtensionId() { + return (int) 612; } // Properties. protected final StatusCode statusCode; - protected final int noOfDataStatusCodes; protected final List dataStatusCodes; - protected final int noOfDataDiagnosticInfos; protected final List dataDiagnosticInfos; public ParsingResult( StatusCode statusCode, - int noOfDataStatusCodes, List dataStatusCodes, - int noOfDataDiagnosticInfos, List dataDiagnosticInfos) { super(); this.statusCode = statusCode; - this.noOfDataStatusCodes = noOfDataStatusCodes; this.dataStatusCodes = dataStatusCodes; - this.noOfDataDiagnosticInfos = noOfDataDiagnosticInfos; this.dataDiagnosticInfos = dataDiagnosticInfos; } @@ -67,18 +61,10 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfDataStatusCodes() { - return noOfDataStatusCodes; - } - public List getDataStatusCodes() { return dataStatusCodes; } - public int getNoOfDataDiagnosticInfos() { - return noOfDataDiagnosticInfos; - } - public List getDataDiagnosticInfos() { return dataDiagnosticInfos; } @@ -93,14 +79,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfDataStatusCodes) - writeSimpleField("noOfDataStatusCodes", noOfDataStatusCodes, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDataStatusCodes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataStatusCodes = + (int) ((((getDataStatusCodes()) == (null)) ? -(1) : COUNT(getDataStatusCodes()))); + writeImplicitField("noOfDataStatusCodes", noOfDataStatusCodes, writeSignedInt(writeBuffer, 32)); // Array Field (dataStatusCodes) writeComplexTypeArrayField("dataStatusCodes", dataStatusCodes, writeBuffer); - // Simple Field (noOfDataDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfDataDiagnosticInfos) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfDataDiagnosticInfos = + (int) ((((getDataDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDataDiagnosticInfos()))); + writeImplicitField( "noOfDataDiagnosticInfos", noOfDataDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (dataDiagnosticInfos) @@ -123,7 +115,7 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfDataStatusCodes) + // Implicit Field (noOfDataStatusCodes) lengthInBits += 32; // Array field @@ -135,7 +127,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDataDiagnosticInfos) + // Implicit Field (noOfDataDiagnosticInfos) lengthInBits += 32; // Array field @@ -151,7 +143,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ParsingResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -160,7 +152,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); - int noOfDataStatusCodes = readSimpleField("noOfDataStatusCodes", readSignedInt(readBuffer, 32)); + int noOfDataStatusCodes = + readImplicitField("noOfDataStatusCodes", readSignedInt(readBuffer, 32)); List dataStatusCodes = readCountArrayField( @@ -169,7 +162,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfDataStatusCodes); int noOfDataDiagnosticInfos = - readSimpleField("noOfDataDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfDataDiagnosticInfos", readSignedInt(readBuffer, 32)); List dataDiagnosticInfos = readCountArrayField( @@ -179,43 +172,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ParsingResult"); // Create the instance - return new ParsingResultBuilderImpl( - statusCode, - noOfDataStatusCodes, - dataStatusCodes, - noOfDataDiagnosticInfos, - dataDiagnosticInfos); + return new ParsingResultBuilderImpl(statusCode, dataStatusCodes, dataDiagnosticInfos); } public static class ParsingResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfDataStatusCodes; private final List dataStatusCodes; - private final int noOfDataDiagnosticInfos; private final List dataDiagnosticInfos; public ParsingResultBuilderImpl( StatusCode statusCode, - int noOfDataStatusCodes, List dataStatusCodes, - int noOfDataDiagnosticInfos, List dataDiagnosticInfos) { this.statusCode = statusCode; - this.noOfDataStatusCodes = noOfDataStatusCodes; this.dataStatusCodes = dataStatusCodes; - this.noOfDataDiagnosticInfos = noOfDataDiagnosticInfos; this.dataDiagnosticInfos = dataDiagnosticInfos; } public ParsingResult build() { ParsingResult parsingResult = - new ParsingResult( - statusCode, - noOfDataStatusCodes, - dataStatusCodes, - noOfDataDiagnosticInfos, - dataDiagnosticInfos); + new ParsingResult(statusCode, dataStatusCodes, dataDiagnosticInfos); return parsingResult; } } @@ -230,9 +207,7 @@ public boolean equals(Object o) { } ParsingResult that = (ParsingResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfDataStatusCodes() == that.getNoOfDataStatusCodes()) && (getDataStatusCodes() == that.getDataStatusCodes()) - && (getNoOfDataDiagnosticInfos() == that.getNoOfDataDiagnosticInfos()) && (getDataDiagnosticInfos() == that.getDataDiagnosticInfos()) && super.equals(that) && true; @@ -241,12 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getStatusCode(), - getNoOfDataStatusCodes(), - getDataStatusCodes(), - getNoOfDataDiagnosticInfos(), - getDataDiagnosticInfos()); + super.hashCode(), getStatusCode(), getDataStatusCodes(), getDataDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PascalString.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PascalString.java index f891f933ccc..34c0d4806a9 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PascalString.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PascalString.java @@ -73,8 +73,8 @@ public void serialize(WriteBuffer writeBuffer) throws SerializationException { int stringLength = getStringLength(); writeBuffer.writeVirtual("stringLength", stringLength); - // Simple Field (stringValue) - writeSimpleField("stringValue", stringValue, writeString(writeBuffer, (stringLength) * (8))); + // Optional Field (stringValue) (Can be skipped, if the value is null) + writeOptionalField("stringValue", stringValue, writeString(writeBuffer, (stringLength) * (8))); writeBuffer.popContext("PascalString"); } @@ -95,8 +95,10 @@ public int getLengthInBits() { // A virtual field doesn't have any in- or output. - // Simple field (stringValue) - lengthInBits += (getStringLength()) * (8); + // Optional Field (stringValue) + if (stringValue != null) { + lengthInBits += (getStringLength()) * (8); + } return lengthInBits; } @@ -115,7 +117,8 @@ public static PascalString staticParse(ReadBuffer readBuffer) throws ParseExcept sLength)); String stringValue = - readSimpleField("stringValue", readString(readBuffer, (stringLength) * (8))); + readOptionalField( + "stringValue", readString(readBuffer, (stringLength) * (8)), (sLength) != (-(1))); readBuffer.closeContext("PascalString"); // Create the instance diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Payload.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Payload.java index 6e63186dc4a..20e10307e88 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Payload.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Payload.java @@ -38,7 +38,7 @@ public abstract class Payload implements Message { // Abstract accessors for discriminator values. - public abstract Boolean getExtensible(); + public abstract Boolean getBinary(); // Properties. protected final SequenceHeader sequenceHeader; @@ -88,7 +88,7 @@ public int getLengthInBits() { return lengthInBits; } - public static Payload staticParse(ReadBuffer readBuffer, Boolean extensible, Long byteCount) + public static Payload staticParse(ReadBuffer readBuffer, Boolean binary, Long byteCount) throws ParseException { readBuffer.pullContext("Payload"); PositionAware positionAware = readBuffer; @@ -101,18 +101,14 @@ public static Payload staticParse(ReadBuffer readBuffer, Boolean extensible, Lon // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) PayloadBuilder builder = null; - if (EvaluationHelper.equals(extensible, (boolean) true)) { - builder = ExtensiblePayload.staticParsePayloadBuilder(readBuffer, extensible, byteCount); - } else if (EvaluationHelper.equals(extensible, (boolean) false)) { - builder = BinaryPayload.staticParsePayloadBuilder(readBuffer, extensible, byteCount); + if (EvaluationHelper.equals(binary, (boolean) false)) { + builder = ExtensiblePayload.staticParsePayloadBuilder(readBuffer, binary, byteCount); + } else if (EvaluationHelper.equals(binary, (boolean) true)) { + builder = BinaryPayload.staticParsePayloadBuilder(readBuffer, binary, byteCount); } if (builder == null) { throw new ParseException( - "Unsupported case for discriminated type" - + " parameters [" - + "extensible=" - + extensible - + "]"); + "Unsupported case for discriminated type" + " parameters [" + "binary=" + binary + "]"); } readBuffer.closeContext("Payload"); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableNodeId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableNodeId.java new file mode 100644 index 00000000000..6e9dd3bad21 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableNodeId.java @@ -0,0 +1,164 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PortableNodeId extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 24108; + } + + // Properties. + protected final PascalString namespaceUri; + protected final NodeId identifier; + + public PortableNodeId(PascalString namespaceUri, NodeId identifier) { + super(); + this.namespaceUri = namespaceUri; + this.identifier = identifier; + } + + public PascalString getNamespaceUri() { + return namespaceUri; + } + + public NodeId getIdentifier() { + return identifier; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PortableNodeId"); + + // Simple Field (namespaceUri) + writeSimpleField("namespaceUri", namespaceUri, writeComplex(writeBuffer)); + + // Simple Field (identifier) + writeSimpleField("identifier", identifier, writeComplex(writeBuffer)); + + writeBuffer.popContext("PortableNodeId"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PortableNodeId _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (namespaceUri) + lengthInBits += namespaceUri.getLengthInBits(); + + // Simple field (identifier) + lengthInBits += identifier.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PortableNodeId"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString namespaceUri = + readSimpleField( + "namespaceUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + NodeId identifier = + readSimpleField( + "identifier", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("PortableNodeId"); + // Create the instance + return new PortableNodeIdBuilderImpl(namespaceUri, identifier); + } + + public static class PortableNodeIdBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString namespaceUri; + private final NodeId identifier; + + public PortableNodeIdBuilderImpl(PascalString namespaceUri, NodeId identifier) { + this.namespaceUri = namespaceUri; + this.identifier = identifier; + } + + public PortableNodeId build() { + PortableNodeId portableNodeId = new PortableNodeId(namespaceUri, identifier); + return portableNodeId; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PortableNodeId)) { + return false; + } + PortableNodeId that = (PortableNodeId) o; + return (getNamespaceUri() == that.getNamespaceUri()) + && (getIdentifier() == that.getIdentifier()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getNamespaceUri(), getIdentifier()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableQualifiedName.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableQualifiedName.java index bb42b657f67..ca9194da88c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableQualifiedName.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PortableQualifiedName.java @@ -38,8 +38,8 @@ public class PortableQualifiedName extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "24107"; + public Integer getExtensionId() { + return (int) 24107; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PortableQualifiedName"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PriorityMappingEntryType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PriorityMappingEntryType.java index 9ce7e90a6f9..576333f82f8 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PriorityMappingEntryType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PriorityMappingEntryType.java @@ -38,8 +38,8 @@ public class PriorityMappingEntryType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "25222"; + public Integer getExtensionId() { + return (int) 25222; } // Properties. @@ -125,7 +125,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PriorityMappingEntryType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnostic2DataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnostic2DataType.java index f109c038ea4..0e5c5c37120 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnostic2DataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnostic2DataType.java @@ -38,8 +38,8 @@ public class ProgramDiagnostic2DataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "24035"; + public Integer getExtensionId() { + return (int) 24035; } // Properties. @@ -49,13 +49,9 @@ public String getIdentifier() { protected final long lastTransitionTime; protected final PascalString lastMethodCall; protected final NodeId lastMethodSessionId; - protected final int noOfLastMethodInputArguments; - protected final List lastMethodInputArguments; - protected final int noOfLastMethodOutputArguments; - protected final List lastMethodOutputArguments; - protected final int noOfLastMethodInputValues; + protected final List lastMethodInputArguments; + protected final List lastMethodOutputArguments; protected final List lastMethodInputValues; - protected final int noOfLastMethodOutputValues; protected final List lastMethodOutputValues; protected final long lastMethodCallTime; protected final StatusCode lastMethodReturnStatus; @@ -67,13 +63,9 @@ public ProgramDiagnostic2DataType( long lastTransitionTime, PascalString lastMethodCall, NodeId lastMethodSessionId, - int noOfLastMethodInputArguments, - List lastMethodInputArguments, - int noOfLastMethodOutputArguments, - List lastMethodOutputArguments, - int noOfLastMethodInputValues, + List lastMethodInputArguments, + List lastMethodOutputArguments, List lastMethodInputValues, - int noOfLastMethodOutputValues, List lastMethodOutputValues, long lastMethodCallTime, StatusCode lastMethodReturnStatus) { @@ -84,13 +76,9 @@ public ProgramDiagnostic2DataType( this.lastTransitionTime = lastTransitionTime; this.lastMethodCall = lastMethodCall; this.lastMethodSessionId = lastMethodSessionId; - this.noOfLastMethodInputArguments = noOfLastMethodInputArguments; this.lastMethodInputArguments = lastMethodInputArguments; - this.noOfLastMethodOutputArguments = noOfLastMethodOutputArguments; this.lastMethodOutputArguments = lastMethodOutputArguments; - this.noOfLastMethodInputValues = noOfLastMethodInputValues; this.lastMethodInputValues = lastMethodInputValues; - this.noOfLastMethodOutputValues = noOfLastMethodOutputValues; this.lastMethodOutputValues = lastMethodOutputValues; this.lastMethodCallTime = lastMethodCallTime; this.lastMethodReturnStatus = lastMethodReturnStatus; @@ -120,34 +108,18 @@ public NodeId getLastMethodSessionId() { return lastMethodSessionId; } - public int getNoOfLastMethodInputArguments() { - return noOfLastMethodInputArguments; - } - - public List getLastMethodInputArguments() { + public List getLastMethodInputArguments() { return lastMethodInputArguments; } - public int getNoOfLastMethodOutputArguments() { - return noOfLastMethodOutputArguments; - } - - public List getLastMethodOutputArguments() { + public List getLastMethodOutputArguments() { return lastMethodOutputArguments; } - public int getNoOfLastMethodInputValues() { - return noOfLastMethodInputValues; - } - public List getLastMethodInputValues() { return lastMethodInputValues; } - public int getNoOfLastMethodOutputValues() { - return noOfLastMethodOutputValues; - } - public List getLastMethodOutputValues() { return lastMethodOutputValues; } @@ -186,8 +158,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (lastMethodSessionId) writeSimpleField("lastMethodSessionId", lastMethodSessionId, writeComplex(writeBuffer)); - // Simple Field (noOfLastMethodInputArguments) - writeSimpleField( + // Implicit Field (noOfLastMethodInputArguments) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfLastMethodInputArguments = + (int) + ((((getLastMethodInputArguments()) == (null)) + ? -(1) + : COUNT(getLastMethodInputArguments()))); + writeImplicitField( "noOfLastMethodInputArguments", noOfLastMethodInputArguments, writeSignedInt(writeBuffer, 32)); @@ -195,8 +173,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Array Field (lastMethodInputArguments) writeComplexTypeArrayField("lastMethodInputArguments", lastMethodInputArguments, writeBuffer); - // Simple Field (noOfLastMethodOutputArguments) - writeSimpleField( + // Implicit Field (noOfLastMethodOutputArguments) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfLastMethodOutputArguments = + (int) + ((((getLastMethodOutputArguments()) == (null)) + ? -(1) + : COUNT(getLastMethodOutputArguments()))); + writeImplicitField( "noOfLastMethodOutputArguments", noOfLastMethodOutputArguments, writeSignedInt(writeBuffer, 32)); @@ -204,15 +188,25 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Array Field (lastMethodOutputArguments) writeComplexTypeArrayField("lastMethodOutputArguments", lastMethodOutputArguments, writeBuffer); - // Simple Field (noOfLastMethodInputValues) - writeSimpleField( + // Implicit Field (noOfLastMethodInputValues) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfLastMethodInputValues = + (int) + ((((getLastMethodInputValues()) == (null)) ? -(1) : COUNT(getLastMethodInputValues()))); + writeImplicitField( "noOfLastMethodInputValues", noOfLastMethodInputValues, writeSignedInt(writeBuffer, 32)); // Array Field (lastMethodInputValues) writeComplexTypeArrayField("lastMethodInputValues", lastMethodInputValues, writeBuffer); - // Simple Field (noOfLastMethodOutputValues) - writeSimpleField( + // Implicit Field (noOfLastMethodOutputValues) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfLastMethodOutputValues = + (int) + ((((getLastMethodOutputValues()) == (null)) + ? -(1) + : COUNT(getLastMethodOutputValues()))); + writeImplicitField( "noOfLastMethodOutputValues", noOfLastMethodOutputValues, writeSignedInt(writeBuffer, 32)); // Array Field (lastMethodOutputValues) @@ -256,31 +250,31 @@ public int getLengthInBits() { // Simple field (lastMethodSessionId) lengthInBits += lastMethodSessionId.getLengthInBits(); - // Simple field (noOfLastMethodInputArguments) + // Implicit Field (noOfLastMethodInputArguments) lengthInBits += 32; // Array field if (lastMethodInputArguments != null) { int i = 0; - for (ExtensionObjectDefinition element : lastMethodInputArguments) { + for (Argument element : lastMethodInputArguments) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= lastMethodInputArguments.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfLastMethodOutputArguments) + // Implicit Field (noOfLastMethodOutputArguments) lengthInBits += 32; // Array field if (lastMethodOutputArguments != null) { int i = 0; - for (ExtensionObjectDefinition element : lastMethodOutputArguments) { + for (Argument element : lastMethodOutputArguments) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= lastMethodOutputArguments.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfLastMethodInputValues) + // Implicit Field (noOfLastMethodInputValues) lengthInBits += 32; // Array field @@ -292,7 +286,7 @@ public int getLengthInBits() { } } - // Simple field (noOfLastMethodOutputValues) + // Implicit Field (noOfLastMethodOutputValues) lengthInBits += 32; // Array field @@ -314,7 +308,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ProgramDiagnostic2DataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -342,29 +336,29 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "lastMethodSessionId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); int noOfLastMethodInputArguments = - readSimpleField("noOfLastMethodInputArguments", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodInputArguments", readSignedInt(readBuffer, 32)); - List lastMethodInputArguments = + List lastMethodInputArguments = readCountArrayField( "lastMethodInputArguments", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("298")), + () -> (Argument) ExtensionObjectDefinition.staticParse(readBuffer, (int) (298)), readBuffer), noOfLastMethodInputArguments); int noOfLastMethodOutputArguments = - readSimpleField("noOfLastMethodOutputArguments", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodOutputArguments", readSignedInt(readBuffer, 32)); - List lastMethodOutputArguments = + List lastMethodOutputArguments = readCountArrayField( "lastMethodOutputArguments", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("298")), + () -> (Argument) ExtensionObjectDefinition.staticParse(readBuffer, (int) (298)), readBuffer), noOfLastMethodOutputArguments); int noOfLastMethodInputValues = - readSimpleField("noOfLastMethodInputValues", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodInputValues", readSignedInt(readBuffer, 32)); List lastMethodInputValues = readCountArrayField( @@ -373,7 +367,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfLastMethodInputValues); int noOfLastMethodOutputValues = - readSimpleField("noOfLastMethodOutputValues", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodOutputValues", readSignedInt(readBuffer, 32)); List lastMethodOutputValues = readCountArrayField( @@ -397,13 +391,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit lastTransitionTime, lastMethodCall, lastMethodSessionId, - noOfLastMethodInputArguments, lastMethodInputArguments, - noOfLastMethodOutputArguments, lastMethodOutputArguments, - noOfLastMethodInputValues, lastMethodInputValues, - noOfLastMethodOutputValues, lastMethodOutputValues, lastMethodCallTime, lastMethodReturnStatus); @@ -417,13 +407,9 @@ public static class ProgramDiagnostic2DataTypeBuilderImpl private final long lastTransitionTime; private final PascalString lastMethodCall; private final NodeId lastMethodSessionId; - private final int noOfLastMethodInputArguments; - private final List lastMethodInputArguments; - private final int noOfLastMethodOutputArguments; - private final List lastMethodOutputArguments; - private final int noOfLastMethodInputValues; + private final List lastMethodInputArguments; + private final List lastMethodOutputArguments; private final List lastMethodInputValues; - private final int noOfLastMethodOutputValues; private final List lastMethodOutputValues; private final long lastMethodCallTime; private final StatusCode lastMethodReturnStatus; @@ -435,13 +421,9 @@ public ProgramDiagnostic2DataTypeBuilderImpl( long lastTransitionTime, PascalString lastMethodCall, NodeId lastMethodSessionId, - int noOfLastMethodInputArguments, - List lastMethodInputArguments, - int noOfLastMethodOutputArguments, - List lastMethodOutputArguments, - int noOfLastMethodInputValues, + List lastMethodInputArguments, + List lastMethodOutputArguments, List lastMethodInputValues, - int noOfLastMethodOutputValues, List lastMethodOutputValues, long lastMethodCallTime, StatusCode lastMethodReturnStatus) { @@ -451,13 +433,9 @@ public ProgramDiagnostic2DataTypeBuilderImpl( this.lastTransitionTime = lastTransitionTime; this.lastMethodCall = lastMethodCall; this.lastMethodSessionId = lastMethodSessionId; - this.noOfLastMethodInputArguments = noOfLastMethodInputArguments; this.lastMethodInputArguments = lastMethodInputArguments; - this.noOfLastMethodOutputArguments = noOfLastMethodOutputArguments; this.lastMethodOutputArguments = lastMethodOutputArguments; - this.noOfLastMethodInputValues = noOfLastMethodInputValues; this.lastMethodInputValues = lastMethodInputValues; - this.noOfLastMethodOutputValues = noOfLastMethodOutputValues; this.lastMethodOutputValues = lastMethodOutputValues; this.lastMethodCallTime = lastMethodCallTime; this.lastMethodReturnStatus = lastMethodReturnStatus; @@ -472,13 +450,9 @@ public ProgramDiagnostic2DataType build() { lastTransitionTime, lastMethodCall, lastMethodSessionId, - noOfLastMethodInputArguments, lastMethodInputArguments, - noOfLastMethodOutputArguments, lastMethodOutputArguments, - noOfLastMethodInputValues, lastMethodInputValues, - noOfLastMethodOutputValues, lastMethodOutputValues, lastMethodCallTime, lastMethodReturnStatus); @@ -501,13 +475,9 @@ public boolean equals(Object o) { && (getLastTransitionTime() == that.getLastTransitionTime()) && (getLastMethodCall() == that.getLastMethodCall()) && (getLastMethodSessionId() == that.getLastMethodSessionId()) - && (getNoOfLastMethodInputArguments() == that.getNoOfLastMethodInputArguments()) && (getLastMethodInputArguments() == that.getLastMethodInputArguments()) - && (getNoOfLastMethodOutputArguments() == that.getNoOfLastMethodOutputArguments()) && (getLastMethodOutputArguments() == that.getLastMethodOutputArguments()) - && (getNoOfLastMethodInputValues() == that.getNoOfLastMethodInputValues()) && (getLastMethodInputValues() == that.getLastMethodInputValues()) - && (getNoOfLastMethodOutputValues() == that.getNoOfLastMethodOutputValues()) && (getLastMethodOutputValues() == that.getLastMethodOutputValues()) && (getLastMethodCallTime() == that.getLastMethodCallTime()) && (getLastMethodReturnStatus() == that.getLastMethodReturnStatus()) @@ -525,13 +495,9 @@ public int hashCode() { getLastTransitionTime(), getLastMethodCall(), getLastMethodSessionId(), - getNoOfLastMethodInputArguments(), getLastMethodInputArguments(), - getNoOfLastMethodOutputArguments(), getLastMethodOutputArguments(), - getNoOfLastMethodInputValues(), getLastMethodInputValues(), - getNoOfLastMethodOutputValues(), getLastMethodOutputValues(), getLastMethodCallTime(), getLastMethodReturnStatus()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnosticDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnosticDataType.java index aaff68fb7c9..488a78afa77 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnosticDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ProgramDiagnosticDataType.java @@ -38,8 +38,8 @@ public class ProgramDiagnosticDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "896"; + public Integer getExtensionId() { + return (int) 896; } // Properties. @@ -49,12 +49,10 @@ public String getIdentifier() { protected final long lastTransitionTime; protected final PascalString lastMethodCall; protected final NodeId lastMethodSessionId; - protected final int noOfLastMethodInputArguments; - protected final List lastMethodInputArguments; - protected final int noOfLastMethodOutputArguments; - protected final List lastMethodOutputArguments; + protected final List lastMethodInputArguments; + protected final List lastMethodOutputArguments; protected final long lastMethodCallTime; - protected final ExtensionObjectDefinition lastMethodReturnStatus; + protected final StatusResult lastMethodReturnStatus; public ProgramDiagnosticDataType( NodeId createSessionId, @@ -63,12 +61,10 @@ public ProgramDiagnosticDataType( long lastTransitionTime, PascalString lastMethodCall, NodeId lastMethodSessionId, - int noOfLastMethodInputArguments, - List lastMethodInputArguments, - int noOfLastMethodOutputArguments, - List lastMethodOutputArguments, + List lastMethodInputArguments, + List lastMethodOutputArguments, long lastMethodCallTime, - ExtensionObjectDefinition lastMethodReturnStatus) { + StatusResult lastMethodReturnStatus) { super(); this.createSessionId = createSessionId; this.createClientName = createClientName; @@ -76,9 +72,7 @@ public ProgramDiagnosticDataType( this.lastTransitionTime = lastTransitionTime; this.lastMethodCall = lastMethodCall; this.lastMethodSessionId = lastMethodSessionId; - this.noOfLastMethodInputArguments = noOfLastMethodInputArguments; this.lastMethodInputArguments = lastMethodInputArguments; - this.noOfLastMethodOutputArguments = noOfLastMethodOutputArguments; this.lastMethodOutputArguments = lastMethodOutputArguments; this.lastMethodCallTime = lastMethodCallTime; this.lastMethodReturnStatus = lastMethodReturnStatus; @@ -108,19 +102,11 @@ public NodeId getLastMethodSessionId() { return lastMethodSessionId; } - public int getNoOfLastMethodInputArguments() { - return noOfLastMethodInputArguments; - } - - public List getLastMethodInputArguments() { + public List getLastMethodInputArguments() { return lastMethodInputArguments; } - public int getNoOfLastMethodOutputArguments() { - return noOfLastMethodOutputArguments; - } - - public List getLastMethodOutputArguments() { + public List getLastMethodOutputArguments() { return lastMethodOutputArguments; } @@ -128,7 +114,7 @@ public long getLastMethodCallTime() { return lastMethodCallTime; } - public ExtensionObjectDefinition getLastMethodReturnStatus() { + public StatusResult getLastMethodReturnStatus() { return lastMethodReturnStatus; } @@ -158,8 +144,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (lastMethodSessionId) writeSimpleField("lastMethodSessionId", lastMethodSessionId, writeComplex(writeBuffer)); - // Simple Field (noOfLastMethodInputArguments) - writeSimpleField( + // Implicit Field (noOfLastMethodInputArguments) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfLastMethodInputArguments = + (int) + ((((getLastMethodInputArguments()) == (null)) + ? -(1) + : COUNT(getLastMethodInputArguments()))); + writeImplicitField( "noOfLastMethodInputArguments", noOfLastMethodInputArguments, writeSignedInt(writeBuffer, 32)); @@ -167,8 +159,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Array Field (lastMethodInputArguments) writeComplexTypeArrayField("lastMethodInputArguments", lastMethodInputArguments, writeBuffer); - // Simple Field (noOfLastMethodOutputArguments) - writeSimpleField( + // Implicit Field (noOfLastMethodOutputArguments) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfLastMethodOutputArguments = + (int) + ((((getLastMethodOutputArguments()) == (null)) + ? -(1) + : COUNT(getLastMethodOutputArguments()))); + writeImplicitField( "noOfLastMethodOutputArguments", noOfLastMethodOutputArguments, writeSignedInt(writeBuffer, 32)); @@ -214,25 +212,25 @@ public int getLengthInBits() { // Simple field (lastMethodSessionId) lengthInBits += lastMethodSessionId.getLengthInBits(); - // Simple field (noOfLastMethodInputArguments) + // Implicit Field (noOfLastMethodInputArguments) lengthInBits += 32; // Array field if (lastMethodInputArguments != null) { int i = 0; - for (ExtensionObjectDefinition element : lastMethodInputArguments) { + for (Argument element : lastMethodInputArguments) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= lastMethodInputArguments.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfLastMethodOutputArguments) + // Implicit Field (noOfLastMethodOutputArguments) lengthInBits += 32; // Array field if (lastMethodOutputArguments != null) { int i = 0; - for (ExtensionObjectDefinition element : lastMethodOutputArguments) { + for (Argument element : lastMethodOutputArguments) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= lastMethodOutputArguments.size()); lengthInBits += element.getLengthInBits(); } @@ -248,7 +246,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ProgramDiagnosticDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -276,34 +274,34 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "lastMethodSessionId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); int noOfLastMethodInputArguments = - readSimpleField("noOfLastMethodInputArguments", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodInputArguments", readSignedInt(readBuffer, 32)); - List lastMethodInputArguments = + List lastMethodInputArguments = readCountArrayField( "lastMethodInputArguments", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("298")), + () -> (Argument) ExtensionObjectDefinition.staticParse(readBuffer, (int) (298)), readBuffer), noOfLastMethodInputArguments); int noOfLastMethodOutputArguments = - readSimpleField("noOfLastMethodOutputArguments", readSignedInt(readBuffer, 32)); + readImplicitField("noOfLastMethodOutputArguments", readSignedInt(readBuffer, 32)); - List lastMethodOutputArguments = + List lastMethodOutputArguments = readCountArrayField( "lastMethodOutputArguments", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("298")), + () -> (Argument) ExtensionObjectDefinition.staticParse(readBuffer, (int) (298)), readBuffer), noOfLastMethodOutputArguments); long lastMethodCallTime = readSimpleField("lastMethodCallTime", readSignedLong(readBuffer, 64)); - ExtensionObjectDefinition lastMethodReturnStatus = + StatusResult lastMethodReturnStatus = readSimpleField( "lastMethodReturnStatus", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("301")), + () -> (StatusResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (301)), readBuffer)); readBuffer.closeContext("ProgramDiagnosticDataType"); @@ -315,9 +313,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit lastTransitionTime, lastMethodCall, lastMethodSessionId, - noOfLastMethodInputArguments, lastMethodInputArguments, - noOfLastMethodOutputArguments, lastMethodOutputArguments, lastMethodCallTime, lastMethodReturnStatus); @@ -331,12 +327,10 @@ public static class ProgramDiagnosticDataTypeBuilderImpl private final long lastTransitionTime; private final PascalString lastMethodCall; private final NodeId lastMethodSessionId; - private final int noOfLastMethodInputArguments; - private final List lastMethodInputArguments; - private final int noOfLastMethodOutputArguments; - private final List lastMethodOutputArguments; + private final List lastMethodInputArguments; + private final List lastMethodOutputArguments; private final long lastMethodCallTime; - private final ExtensionObjectDefinition lastMethodReturnStatus; + private final StatusResult lastMethodReturnStatus; public ProgramDiagnosticDataTypeBuilderImpl( NodeId createSessionId, @@ -345,21 +339,17 @@ public ProgramDiagnosticDataTypeBuilderImpl( long lastTransitionTime, PascalString lastMethodCall, NodeId lastMethodSessionId, - int noOfLastMethodInputArguments, - List lastMethodInputArguments, - int noOfLastMethodOutputArguments, - List lastMethodOutputArguments, + List lastMethodInputArguments, + List lastMethodOutputArguments, long lastMethodCallTime, - ExtensionObjectDefinition lastMethodReturnStatus) { + StatusResult lastMethodReturnStatus) { this.createSessionId = createSessionId; this.createClientName = createClientName; this.invocationCreationTime = invocationCreationTime; this.lastTransitionTime = lastTransitionTime; this.lastMethodCall = lastMethodCall; this.lastMethodSessionId = lastMethodSessionId; - this.noOfLastMethodInputArguments = noOfLastMethodInputArguments; this.lastMethodInputArguments = lastMethodInputArguments; - this.noOfLastMethodOutputArguments = noOfLastMethodOutputArguments; this.lastMethodOutputArguments = lastMethodOutputArguments; this.lastMethodCallTime = lastMethodCallTime; this.lastMethodReturnStatus = lastMethodReturnStatus; @@ -374,9 +364,7 @@ public ProgramDiagnosticDataType build() { lastTransitionTime, lastMethodCall, lastMethodSessionId, - noOfLastMethodInputArguments, lastMethodInputArguments, - noOfLastMethodOutputArguments, lastMethodOutputArguments, lastMethodCallTime, lastMethodReturnStatus); @@ -399,9 +387,7 @@ public boolean equals(Object o) { && (getLastTransitionTime() == that.getLastTransitionTime()) && (getLastMethodCall() == that.getLastMethodCall()) && (getLastMethodSessionId() == that.getLastMethodSessionId()) - && (getNoOfLastMethodInputArguments() == that.getNoOfLastMethodInputArguments()) && (getLastMethodInputArguments() == that.getLastMethodInputArguments()) - && (getNoOfLastMethodOutputArguments() == that.getNoOfLastMethodOutputArguments()) && (getLastMethodOutputArguments() == that.getLastMethodOutputArguments()) && (getLastMethodCallTime() == that.getLastMethodCallTime()) && (getLastMethodReturnStatus() == that.getLastMethodReturnStatus()) @@ -419,9 +405,7 @@ public int hashCode() { getLastTransitionTime(), getLastMethodCall(), getLastMethodSessionId(), - getNoOfLastMethodInputArguments(), getLastMethodInputArguments(), - getNoOfLastMethodOutputArguments(), getLastMethodOutputArguments(), getLastMethodCallTime(), getLastMethodReturnStatus()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfiguration2DataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfiguration2DataType.java new file mode 100644 index 00000000000..d359670ac12 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfiguration2DataType.java @@ -0,0 +1,578 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PubSubConfiguration2DataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23604; + } + + // Properties. + protected final List publishedDataSets; + protected final List connections; + protected final boolean enabled; + protected final List subscribedDataSets; + protected final List dataSetClasses; + protected final List defaultSecurityKeyServices; + protected final List securityGroups; + protected final List pubSubKeyPushTargets; + protected final long configurationVersion; + protected final List configurationProperties; + + public PubSubConfiguration2DataType( + List publishedDataSets, + List connections, + boolean enabled, + List subscribedDataSets, + List dataSetClasses, + List defaultSecurityKeyServices, + List securityGroups, + List pubSubKeyPushTargets, + long configurationVersion, + List configurationProperties) { + super(); + this.publishedDataSets = publishedDataSets; + this.connections = connections; + this.enabled = enabled; + this.subscribedDataSets = subscribedDataSets; + this.dataSetClasses = dataSetClasses; + this.defaultSecurityKeyServices = defaultSecurityKeyServices; + this.securityGroups = securityGroups; + this.pubSubKeyPushTargets = pubSubKeyPushTargets; + this.configurationVersion = configurationVersion; + this.configurationProperties = configurationProperties; + } + + public List getPublishedDataSets() { + return publishedDataSets; + } + + public List getConnections() { + return connections; + } + + public boolean getEnabled() { + return enabled; + } + + public List getSubscribedDataSets() { + return subscribedDataSets; + } + + public List getDataSetClasses() { + return dataSetClasses; + } + + public List getDefaultSecurityKeyServices() { + return defaultSecurityKeyServices; + } + + public List getSecurityGroups() { + return securityGroups; + } + + public List getPubSubKeyPushTargets() { + return pubSubKeyPushTargets; + } + + public long getConfigurationVersion() { + return configurationVersion; + } + + public List getConfigurationProperties() { + return configurationProperties; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PubSubConfiguration2DataType"); + + // Implicit Field (noOfPublishedDataSets) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfPublishedDataSets = + (int) ((((getPublishedDataSets()) == (null)) ? -(1) : COUNT(getPublishedDataSets()))); + writeImplicitField( + "noOfPublishedDataSets", noOfPublishedDataSets, writeSignedInt(writeBuffer, 32)); + + // Array Field (publishedDataSets) + writeComplexTypeArrayField("publishedDataSets", publishedDataSets, writeBuffer); + + // Implicit Field (noOfConnections) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfConnections = (int) ((((getConnections()) == (null)) ? -(1) : COUNT(getConnections()))); + writeImplicitField("noOfConnections", noOfConnections, writeSignedInt(writeBuffer, 32)); + + // Array Field (connections) + writeComplexTypeArrayField("connections", connections, writeBuffer); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (enabled) + writeSimpleField("enabled", enabled, writeBoolean(writeBuffer)); + + // Implicit Field (noOfSubscribedDataSets) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSubscribedDataSets = + (int) ((((getSubscribedDataSets()) == (null)) ? -(1) : COUNT(getSubscribedDataSets()))); + writeImplicitField( + "noOfSubscribedDataSets", noOfSubscribedDataSets, writeSignedInt(writeBuffer, 32)); + + // Array Field (subscribedDataSets) + writeComplexTypeArrayField("subscribedDataSets", subscribedDataSets, writeBuffer); + + // Implicit Field (noOfDataSetClasses) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataSetClasses = + (int) ((((getDataSetClasses()) == (null)) ? -(1) : COUNT(getDataSetClasses()))); + writeImplicitField("noOfDataSetClasses", noOfDataSetClasses, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetClasses) + writeComplexTypeArrayField("dataSetClasses", dataSetClasses, writeBuffer); + + // Implicit Field (noOfDefaultSecurityKeyServices) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfDefaultSecurityKeyServices = + (int) + ((((getDefaultSecurityKeyServices()) == (null)) + ? -(1) + : COUNT(getDefaultSecurityKeyServices()))); + writeImplicitField( + "noOfDefaultSecurityKeyServices", + noOfDefaultSecurityKeyServices, + writeSignedInt(writeBuffer, 32)); + + // Array Field (defaultSecurityKeyServices) + writeComplexTypeArrayField( + "defaultSecurityKeyServices", defaultSecurityKeyServices, writeBuffer); + + // Implicit Field (noOfSecurityGroups) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSecurityGroups = + (int) ((((getSecurityGroups()) == (null)) ? -(1) : COUNT(getSecurityGroups()))); + writeImplicitField("noOfSecurityGroups", noOfSecurityGroups, writeSignedInt(writeBuffer, 32)); + + // Array Field (securityGroups) + writeComplexTypeArrayField("securityGroups", securityGroups, writeBuffer); + + // Implicit Field (noOfPubSubKeyPushTargets) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfPubSubKeyPushTargets = + (int) ((((getPubSubKeyPushTargets()) == (null)) ? -(1) : COUNT(getPubSubKeyPushTargets()))); + writeImplicitField( + "noOfPubSubKeyPushTargets", noOfPubSubKeyPushTargets, writeSignedInt(writeBuffer, 32)); + + // Array Field (pubSubKeyPushTargets) + writeComplexTypeArrayField("pubSubKeyPushTargets", pubSubKeyPushTargets, writeBuffer); + + // Simple Field (configurationVersion) + writeSimpleField( + "configurationVersion", configurationVersion, writeUnsignedLong(writeBuffer, 32)); + + // Implicit Field (noOfConfigurationProperties) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfConfigurationProperties = + (int) + ((((getConfigurationProperties()) == (null)) + ? -(1) + : COUNT(getConfigurationProperties()))); + writeImplicitField( + "noOfConfigurationProperties", + noOfConfigurationProperties, + writeSignedInt(writeBuffer, 32)); + + // Array Field (configurationProperties) + writeComplexTypeArrayField("configurationProperties", configurationProperties, writeBuffer); + + writeBuffer.popContext("PubSubConfiguration2DataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PubSubConfiguration2DataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfPublishedDataSets) + lengthInBits += 32; + + // Array field + if (publishedDataSets != null) { + int i = 0; + for (PublishedDataSetDataType element : publishedDataSets) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= publishedDataSets.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfConnections) + lengthInBits += 32; + + // Array field + if (connections != null) { + int i = 0; + for (PubSubConnectionDataType element : connections) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= connections.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (enabled) + lengthInBits += 1; + + // Implicit Field (noOfSubscribedDataSets) + lengthInBits += 32; + + // Array field + if (subscribedDataSets != null) { + int i = 0; + for (StandaloneSubscribedDataSetDataType element : subscribedDataSets) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= subscribedDataSets.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfDataSetClasses) + lengthInBits += 32; + + // Array field + if (dataSetClasses != null) { + int i = 0; + for (DataSetMetaDataType element : dataSetClasses) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetClasses.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfDefaultSecurityKeyServices) + lengthInBits += 32; + + // Array field + if (defaultSecurityKeyServices != null) { + int i = 0; + for (EndpointDescription element : defaultSecurityKeyServices) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= defaultSecurityKeyServices.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfSecurityGroups) + lengthInBits += 32; + + // Array field + if (securityGroups != null) { + int i = 0; + for (SecurityGroupDataType element : securityGroups) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= securityGroups.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfPubSubKeyPushTargets) + lengthInBits += 32; + + // Array field + if (pubSubKeyPushTargets != null) { + int i = 0; + for (PubSubKeyPushTargetDataType element : pubSubKeyPushTargets) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= pubSubKeyPushTargets.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (configurationVersion) + lengthInBits += 32; + + // Implicit Field (noOfConfigurationProperties) + lengthInBits += 32; + + // Array field + if (configurationProperties != null) { + int i = 0; + for (KeyValuePair element : configurationProperties) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= configurationProperties.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PubSubConfiguration2DataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfPublishedDataSets = + readImplicitField("noOfPublishedDataSets", readSignedInt(readBuffer, 32)); + + List publishedDataSets = + readCountArrayField( + "publishedDataSets", + readComplex( + () -> + (PublishedDataSetDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15580)), + readBuffer), + noOfPublishedDataSets); + + int noOfConnections = readImplicitField("noOfConnections", readSignedInt(readBuffer, 32)); + + List connections = + readCountArrayField( + "connections", + readComplex( + () -> + (PubSubConnectionDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15619)), + readBuffer), + noOfConnections); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean enabled = readSimpleField("enabled", readBoolean(readBuffer)); + + int noOfSubscribedDataSets = + readImplicitField("noOfSubscribedDataSets", readSignedInt(readBuffer, 32)); + + List subscribedDataSets = + readCountArrayField( + "subscribedDataSets", + readComplex( + () -> + (StandaloneSubscribedDataSetDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (23602)), + readBuffer), + noOfSubscribedDataSets); + + int noOfDataSetClasses = readImplicitField("noOfDataSetClasses", readSignedInt(readBuffer, 32)); + + List dataSetClasses = + readCountArrayField( + "dataSetClasses", + readComplex( + () -> + (DataSetMetaDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14525)), + readBuffer), + noOfDataSetClasses); + + int noOfDefaultSecurityKeyServices = + readImplicitField("noOfDefaultSecurityKeyServices", readSignedInt(readBuffer, 32)); + + List defaultSecurityKeyServices = + readCountArrayField( + "defaultSecurityKeyServices", + readComplex( + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), + readBuffer), + noOfDefaultSecurityKeyServices); + + int noOfSecurityGroups = readImplicitField("noOfSecurityGroups", readSignedInt(readBuffer, 32)); + + List securityGroups = + readCountArrayField( + "securityGroups", + readComplex( + () -> + (SecurityGroupDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (23603)), + readBuffer), + noOfSecurityGroups); + + int noOfPubSubKeyPushTargets = + readImplicitField("noOfPubSubKeyPushTargets", readSignedInt(readBuffer, 32)); + + List pubSubKeyPushTargets = + readCountArrayField( + "pubSubKeyPushTargets", + readComplex( + () -> + (PubSubKeyPushTargetDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (25272)), + readBuffer), + noOfPubSubKeyPushTargets); + + long configurationVersion = + readSimpleField("configurationVersion", readUnsignedLong(readBuffer, 32)); + + int noOfConfigurationProperties = + readImplicitField("noOfConfigurationProperties", readSignedInt(readBuffer, 32)); + + List configurationProperties = + readCountArrayField( + "configurationProperties", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfConfigurationProperties); + + readBuffer.closeContext("PubSubConfiguration2DataType"); + // Create the instance + return new PubSubConfiguration2DataTypeBuilderImpl( + publishedDataSets, + connections, + enabled, + subscribedDataSets, + dataSetClasses, + defaultSecurityKeyServices, + securityGroups, + pubSubKeyPushTargets, + configurationVersion, + configurationProperties); + } + + public static class PubSubConfiguration2DataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List publishedDataSets; + private final List connections; + private final boolean enabled; + private final List subscribedDataSets; + private final List dataSetClasses; + private final List defaultSecurityKeyServices; + private final List securityGroups; + private final List pubSubKeyPushTargets; + private final long configurationVersion; + private final List configurationProperties; + + public PubSubConfiguration2DataTypeBuilderImpl( + List publishedDataSets, + List connections, + boolean enabled, + List subscribedDataSets, + List dataSetClasses, + List defaultSecurityKeyServices, + List securityGroups, + List pubSubKeyPushTargets, + long configurationVersion, + List configurationProperties) { + this.publishedDataSets = publishedDataSets; + this.connections = connections; + this.enabled = enabled; + this.subscribedDataSets = subscribedDataSets; + this.dataSetClasses = dataSetClasses; + this.defaultSecurityKeyServices = defaultSecurityKeyServices; + this.securityGroups = securityGroups; + this.pubSubKeyPushTargets = pubSubKeyPushTargets; + this.configurationVersion = configurationVersion; + this.configurationProperties = configurationProperties; + } + + public PubSubConfiguration2DataType build() { + PubSubConfiguration2DataType pubSubConfiguration2DataType = + new PubSubConfiguration2DataType( + publishedDataSets, + connections, + enabled, + subscribedDataSets, + dataSetClasses, + defaultSecurityKeyServices, + securityGroups, + pubSubKeyPushTargets, + configurationVersion, + configurationProperties); + return pubSubConfiguration2DataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PubSubConfiguration2DataType)) { + return false; + } + PubSubConfiguration2DataType that = (PubSubConfiguration2DataType) o; + return (getPublishedDataSets() == that.getPublishedDataSets()) + && (getConnections() == that.getConnections()) + && (getEnabled() == that.getEnabled()) + && (getSubscribedDataSets() == that.getSubscribedDataSets()) + && (getDataSetClasses() == that.getDataSetClasses()) + && (getDefaultSecurityKeyServices() == that.getDefaultSecurityKeyServices()) + && (getSecurityGroups() == that.getSecurityGroups()) + && (getPubSubKeyPushTargets() == that.getPubSubKeyPushTargets()) + && (getConfigurationVersion() == that.getConfigurationVersion()) + && (getConfigurationProperties() == that.getConfigurationProperties()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getPublishedDataSets(), + getConnections(), + getEnabled(), + getSubscribedDataSets(), + getDataSetClasses(), + getDefaultSecurityKeyServices(), + getSecurityGroups(), + getPubSubKeyPushTargets(), + getConfigurationVersion(), + getConfigurationProperties()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationDataType.java index da1c6069c65..1853b440d31 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationDataType.java @@ -38,44 +38,30 @@ public class PubSubConfigurationDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15532"; + public Integer getExtensionId() { + return (int) 15532; } // Properties. - protected final int noOfPublishedDataSets; - protected final List publishedDataSets; - protected final int noOfConnections; - protected final List connections; + protected final List publishedDataSets; + protected final List connections; protected final boolean enabled; public PubSubConfigurationDataType( - int noOfPublishedDataSets, - List publishedDataSets, - int noOfConnections, - List connections, + List publishedDataSets, + List connections, boolean enabled) { super(); - this.noOfPublishedDataSets = noOfPublishedDataSets; this.publishedDataSets = publishedDataSets; - this.noOfConnections = noOfConnections; this.connections = connections; this.enabled = enabled; } - public int getNoOfPublishedDataSets() { - return noOfPublishedDataSets; - } - - public List getPublishedDataSets() { + public List getPublishedDataSets() { return publishedDataSets; } - public int getNoOfConnections() { - return noOfConnections; - } - - public List getConnections() { + public List getConnections() { return connections; } @@ -90,15 +76,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("PubSubConfigurationDataType"); - // Simple Field (noOfPublishedDataSets) - writeSimpleField( + // Implicit Field (noOfPublishedDataSets) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfPublishedDataSets = + (int) ((((getPublishedDataSets()) == (null)) ? -(1) : COUNT(getPublishedDataSets()))); + writeImplicitField( "noOfPublishedDataSets", noOfPublishedDataSets, writeSignedInt(writeBuffer, 32)); // Array Field (publishedDataSets) writeComplexTypeArrayField("publishedDataSets", publishedDataSets, writeBuffer); - // Simple Field (noOfConnections) - writeSimpleField("noOfConnections", noOfConnections, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfConnections) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfConnections = (int) ((((getConnections()) == (null)) ? -(1) : COUNT(getConnections()))); + writeImplicitField("noOfConnections", noOfConnections, writeSignedInt(writeBuffer, 32)); // Array Field (connections) writeComplexTypeArrayField("connections", connections, writeBuffer); @@ -123,25 +114,25 @@ public int getLengthInBits() { PubSubConfigurationDataType _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfPublishedDataSets) + // Implicit Field (noOfPublishedDataSets) lengthInBits += 32; // Array field if (publishedDataSets != null) { int i = 0; - for (ExtensionObjectDefinition element : publishedDataSets) { + for (PublishedDataSetDataType element : publishedDataSets) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= publishedDataSets.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfConnections) + // Implicit Field (noOfConnections) lengthInBits += 32; // Array field if (connections != null) { int i = 0; - for (ExtensionObjectDefinition element : connections) { + for (PubSubConnectionDataType element : connections) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= connections.size()); lengthInBits += element.getLengthInBits(); } @@ -157,29 +148,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PubSubConfigurationDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); int noOfPublishedDataSets = - readSimpleField("noOfPublishedDataSets", readSignedInt(readBuffer, 32)); + readImplicitField("noOfPublishedDataSets", readSignedInt(readBuffer, 32)); - List publishedDataSets = + List publishedDataSets = readCountArrayField( "publishedDataSets", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("15580")), + () -> + (PublishedDataSetDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15580)), readBuffer), noOfPublishedDataSets); - int noOfConnections = readSimpleField("noOfConnections", readSignedInt(readBuffer, 32)); + int noOfConnections = readImplicitField("noOfConnections", readSignedInt(readBuffer, 32)); - List connections = + List connections = readCountArrayField( "connections", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("15619")), + () -> + (PubSubConnectionDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15619)), readBuffer), noOfConnections); @@ -190,35 +185,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("PubSubConfigurationDataType"); // Create the instance - return new PubSubConfigurationDataTypeBuilderImpl( - noOfPublishedDataSets, publishedDataSets, noOfConnections, connections, enabled); + return new PubSubConfigurationDataTypeBuilderImpl(publishedDataSets, connections, enabled); } public static class PubSubConfigurationDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfPublishedDataSets; - private final List publishedDataSets; - private final int noOfConnections; - private final List connections; + private final List publishedDataSets; + private final List connections; private final boolean enabled; public PubSubConfigurationDataTypeBuilderImpl( - int noOfPublishedDataSets, - List publishedDataSets, - int noOfConnections, - List connections, + List publishedDataSets, + List connections, boolean enabled) { - this.noOfPublishedDataSets = noOfPublishedDataSets; this.publishedDataSets = publishedDataSets; - this.noOfConnections = noOfConnections; this.connections = connections; this.enabled = enabled; } public PubSubConfigurationDataType build() { PubSubConfigurationDataType pubSubConfigurationDataType = - new PubSubConfigurationDataType( - noOfPublishedDataSets, publishedDataSets, noOfConnections, connections, enabled); + new PubSubConfigurationDataType(publishedDataSets, connections, enabled); return pubSubConfigurationDataType; } } @@ -232,9 +219,7 @@ public boolean equals(Object o) { return false; } PubSubConfigurationDataType that = (PubSubConfigurationDataType) o; - return (getNoOfPublishedDataSets() == that.getNoOfPublishedDataSets()) - && (getPublishedDataSets() == that.getPublishedDataSets()) - && (getNoOfConnections() == that.getNoOfConnections()) + return (getPublishedDataSets() == that.getPublishedDataSets()) && (getConnections() == that.getConnections()) && (getEnabled() == that.getEnabled()) && super.equals(that) @@ -243,13 +228,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getNoOfPublishedDataSets(), - getPublishedDataSets(), - getNoOfConnections(), - getConnections(), - getEnabled()); + return Objects.hash(super.hashCode(), getPublishedDataSets(), getConnections(), getEnabled()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationRefDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationRefDataType.java index 123fb12c84f..8b94bc512b4 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationRefDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationRefDataType.java @@ -38,8 +38,8 @@ public class PubSubConfigurationRefDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "25521"; + public Integer getExtensionId() { + return (int) 25521; } // Properties. @@ -132,7 +132,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PubSubConfigurationRefDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationValueDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationValueDataType.java new file mode 100644 index 00000000000..fa124b8be52 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConfigurationValueDataType.java @@ -0,0 +1,193 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PubSubConfigurationValueDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 25522; + } + + // Properties. + protected final PubSubConfigurationRefDataType configurationElement; + protected final PascalString name; + protected final Variant identifier; + + public PubSubConfigurationValueDataType( + PubSubConfigurationRefDataType configurationElement, PascalString name, Variant identifier) { + super(); + this.configurationElement = configurationElement; + this.name = name; + this.identifier = identifier; + } + + public PubSubConfigurationRefDataType getConfigurationElement() { + return configurationElement; + } + + public PascalString getName() { + return name; + } + + public Variant getIdentifier() { + return identifier; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PubSubConfigurationValueDataType"); + + // Simple Field (configurationElement) + writeSimpleField("configurationElement", configurationElement, writeComplex(writeBuffer)); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Simple Field (identifier) + writeSimpleField("identifier", identifier, writeComplex(writeBuffer)); + + writeBuffer.popContext("PubSubConfigurationValueDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PubSubConfigurationValueDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (configurationElement) + lengthInBits += configurationElement.getLengthInBits(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Simple field (identifier) + lengthInBits += identifier.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PubSubConfigurationValueDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PubSubConfigurationRefDataType configurationElement = + readSimpleField( + "configurationElement", + readComplex( + () -> + (PubSubConfigurationRefDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (25521)), + readBuffer)); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + Variant identifier = + readSimpleField( + "identifier", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("PubSubConfigurationValueDataType"); + // Create the instance + return new PubSubConfigurationValueDataTypeBuilderImpl(configurationElement, name, identifier); + } + + public static class PubSubConfigurationValueDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PubSubConfigurationRefDataType configurationElement; + private final PascalString name; + private final Variant identifier; + + public PubSubConfigurationValueDataTypeBuilderImpl( + PubSubConfigurationRefDataType configurationElement, + PascalString name, + Variant identifier) { + this.configurationElement = configurationElement; + this.name = name; + this.identifier = identifier; + } + + public PubSubConfigurationValueDataType build() { + PubSubConfigurationValueDataType pubSubConfigurationValueDataType = + new PubSubConfigurationValueDataType(configurationElement, name, identifier); + return pubSubConfigurationValueDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PubSubConfigurationValueDataType)) { + return false; + } + PubSubConfigurationValueDataType that = (PubSubConfigurationValueDataType) o; + return (getConfigurationElement() == that.getConfigurationElement()) + && (getName() == that.getName()) + && (getIdentifier() == that.getIdentifier()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getConfigurationElement(), getName(), getIdentifier()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConnectionDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConnectionDataType.java index c5ac05114ac..2b14fbd4b13 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConnectionDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubConnectionDataType.java @@ -38,8 +38,8 @@ public class PubSubConnectionDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15619"; + public Integer getExtensionId() { + return (int) 15619; } // Properties. @@ -48,13 +48,10 @@ public String getIdentifier() { protected final Variant publisherId; protected final PascalString transportProfileUri; protected final ExtensionObject address; - protected final int noOfConnectionProperties; - protected final List connectionProperties; + protected final List connectionProperties; protected final ExtensionObject transportSettings; - protected final int noOfWriterGroups; - protected final List writerGroups; - protected final int noOfReaderGroups; - protected final List readerGroups; + protected final List writerGroups; + protected final List readerGroups; public PubSubConnectionDataType( PascalString name, @@ -62,25 +59,19 @@ public PubSubConnectionDataType( Variant publisherId, PascalString transportProfileUri, ExtensionObject address, - int noOfConnectionProperties, - List connectionProperties, + List connectionProperties, ExtensionObject transportSettings, - int noOfWriterGroups, - List writerGroups, - int noOfReaderGroups, - List readerGroups) { + List writerGroups, + List readerGroups) { super(); this.name = name; this.enabled = enabled; this.publisherId = publisherId; this.transportProfileUri = transportProfileUri; this.address = address; - this.noOfConnectionProperties = noOfConnectionProperties; this.connectionProperties = connectionProperties; this.transportSettings = transportSettings; - this.noOfWriterGroups = noOfWriterGroups; this.writerGroups = writerGroups; - this.noOfReaderGroups = noOfReaderGroups; this.readerGroups = readerGroups; } @@ -104,11 +95,7 @@ public ExtensionObject getAddress() { return address; } - public int getNoOfConnectionProperties() { - return noOfConnectionProperties; - } - - public List getConnectionProperties() { + public List getConnectionProperties() { return connectionProperties; } @@ -116,19 +103,11 @@ public ExtensionObject getTransportSettings() { return transportSettings; } - public int getNoOfWriterGroups() { - return noOfWriterGroups; - } - - public List getWriterGroups() { + public List getWriterGroups() { return writerGroups; } - public int getNoOfReaderGroups() { - return noOfReaderGroups; - } - - public List getReaderGroups() { + public List getReaderGroups() { return readerGroups; } @@ -157,8 +136,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (address) writeSimpleField("address", address, writeComplex(writeBuffer)); - // Simple Field (noOfConnectionProperties) - writeSimpleField( + // Implicit Field (noOfConnectionProperties) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfConnectionProperties = + (int) ((((getConnectionProperties()) == (null)) ? -(1) : COUNT(getConnectionProperties()))); + writeImplicitField( "noOfConnectionProperties", noOfConnectionProperties, writeSignedInt(writeBuffer, 32)); // Array Field (connectionProperties) @@ -167,14 +149,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (transportSettings) writeSimpleField("transportSettings", transportSettings, writeComplex(writeBuffer)); - // Simple Field (noOfWriterGroups) - writeSimpleField("noOfWriterGroups", noOfWriterGroups, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfWriterGroups) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfWriterGroups = + (int) ((((getWriterGroups()) == (null)) ? -(1) : COUNT(getWriterGroups()))); + writeImplicitField("noOfWriterGroups", noOfWriterGroups, writeSignedInt(writeBuffer, 32)); // Array Field (writerGroups) writeComplexTypeArrayField("writerGroups", writerGroups, writeBuffer); - // Simple Field (noOfReaderGroups) - writeSimpleField("noOfReaderGroups", noOfReaderGroups, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfReaderGroups) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReaderGroups = + (int) ((((getReaderGroups()) == (null)) ? -(1) : COUNT(getReaderGroups()))); + writeImplicitField("noOfReaderGroups", noOfReaderGroups, writeSignedInt(writeBuffer, 32)); // Array Field (readerGroups) writeComplexTypeArrayField("readerGroups", readerGroups, writeBuffer); @@ -211,13 +199,13 @@ public int getLengthInBits() { // Simple field (address) lengthInBits += address.getLengthInBits(); - // Simple field (noOfConnectionProperties) + // Implicit Field (noOfConnectionProperties) lengthInBits += 32; // Array field if (connectionProperties != null) { int i = 0; - for (ExtensionObjectDefinition element : connectionProperties) { + for (KeyValuePair element : connectionProperties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= connectionProperties.size()); lengthInBits += element.getLengthInBits(); } @@ -226,25 +214,25 @@ public int getLengthInBits() { // Simple field (transportSettings) lengthInBits += transportSettings.getLengthInBits(); - // Simple field (noOfWriterGroups) + // Implicit Field (noOfWriterGroups) lengthInBits += 32; // Array field if (writerGroups != null) { int i = 0; - for (PubSubGroupDataType element : writerGroups) { + for (WriterGroupDataType element : writerGroups) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= writerGroups.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfReaderGroups) + // Implicit Field (noOfReaderGroups) lengthInBits += 32; // Array field if (readerGroups != null) { int i = 0; - for (PubSubGroupDataType element : readerGroups) { + for (ReaderGroupDataType element : readerGroups) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= readerGroups.size()); lengthInBits += element.getLengthInBits(); } @@ -254,7 +242,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PubSubConnectionDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -284,13 +272,14 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); int noOfConnectionProperties = - readSimpleField("noOfConnectionProperties", readSignedInt(readBuffer, 32)); + readImplicitField("noOfConnectionProperties", readSignedInt(readBuffer, 32)); - List connectionProperties = + List connectionProperties = readCountArrayField( "connectionProperties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfConnectionProperties); @@ -300,27 +289,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex( () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); - int noOfWriterGroups = readSimpleField("noOfWriterGroups", readSignedInt(readBuffer, 32)); + int noOfWriterGroups = readImplicitField("noOfWriterGroups", readSignedInt(readBuffer, 32)); - List writerGroups = + List writerGroups = readCountArrayField( "writerGroups", readComplex( () -> - (PubSubGroupDataType) - ExtensionObjectDefinition.staticParse(readBuffer, (String) ("15609")), + (WriterGroupDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15482)), readBuffer), noOfWriterGroups); - int noOfReaderGroups = readSimpleField("noOfReaderGroups", readSignedInt(readBuffer, 32)); + int noOfReaderGroups = readImplicitField("noOfReaderGroups", readSignedInt(readBuffer, 32)); - List readerGroups = + List readerGroups = readCountArrayField( "readerGroups", readComplex( () -> - (PubSubGroupDataType) - ExtensionObjectDefinition.staticParse(readBuffer, (String) ("15609")), + (ReaderGroupDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15522)), readBuffer), noOfReaderGroups); @@ -332,12 +321,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit publisherId, transportProfileUri, address, - noOfConnectionProperties, connectionProperties, transportSettings, - noOfWriterGroups, writerGroups, - noOfReaderGroups, readerGroups); } @@ -348,13 +334,10 @@ public static class PubSubConnectionDataTypeBuilderImpl private final Variant publisherId; private final PascalString transportProfileUri; private final ExtensionObject address; - private final int noOfConnectionProperties; - private final List connectionProperties; + private final List connectionProperties; private final ExtensionObject transportSettings; - private final int noOfWriterGroups; - private final List writerGroups; - private final int noOfReaderGroups; - private final List readerGroups; + private final List writerGroups; + private final List readerGroups; public PubSubConnectionDataTypeBuilderImpl( PascalString name, @@ -362,24 +345,18 @@ public PubSubConnectionDataTypeBuilderImpl( Variant publisherId, PascalString transportProfileUri, ExtensionObject address, - int noOfConnectionProperties, - List connectionProperties, + List connectionProperties, ExtensionObject transportSettings, - int noOfWriterGroups, - List writerGroups, - int noOfReaderGroups, - List readerGroups) { + List writerGroups, + List readerGroups) { this.name = name; this.enabled = enabled; this.publisherId = publisherId; this.transportProfileUri = transportProfileUri; this.address = address; - this.noOfConnectionProperties = noOfConnectionProperties; this.connectionProperties = connectionProperties; this.transportSettings = transportSettings; - this.noOfWriterGroups = noOfWriterGroups; this.writerGroups = writerGroups; - this.noOfReaderGroups = noOfReaderGroups; this.readerGroups = readerGroups; } @@ -391,12 +368,9 @@ public PubSubConnectionDataType build() { publisherId, transportProfileUri, address, - noOfConnectionProperties, connectionProperties, transportSettings, - noOfWriterGroups, writerGroups, - noOfReaderGroups, readerGroups); return pubSubConnectionDataType; } @@ -416,12 +390,9 @@ public boolean equals(Object o) { && (getPublisherId() == that.getPublisherId()) && (getTransportProfileUri() == that.getTransportProfileUri()) && (getAddress() == that.getAddress()) - && (getNoOfConnectionProperties() == that.getNoOfConnectionProperties()) && (getConnectionProperties() == that.getConnectionProperties()) && (getTransportSettings() == that.getTransportSettings()) - && (getNoOfWriterGroups() == that.getNoOfWriterGroups()) && (getWriterGroups() == that.getWriterGroups()) - && (getNoOfReaderGroups() == that.getNoOfReaderGroups()) && (getReaderGroups() == that.getReaderGroups()) && super.equals(that) && true; @@ -436,12 +407,9 @@ public int hashCode() { getPublisherId(), getTransportProfileUri(), getAddress(), - getNoOfConnectionProperties(), getConnectionProperties(), getTransportSettings(), - getNoOfWriterGroups(), getWriterGroups(), - getNoOfReaderGroups(), getReaderGroups()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubGroupDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubGroupDataType.java index 2e6af6bf2aa..3e828786eec 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubGroupDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubGroupDataType.java @@ -38,8 +38,8 @@ public class PubSubGroupDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15611"; + public Integer getExtensionId() { + return (int) 15611; } // Properties. @@ -47,31 +47,25 @@ public String getIdentifier() { protected final boolean enabled; protected final MessageSecurityMode securityMode; protected final PascalString securityGroupId; - protected final int noOfSecurityKeyServices; - protected final List securityKeyServices; + protected final List securityKeyServices; protected final long maxNetworkMessageSize; - protected final int noOfGroupProperties; - protected final List groupProperties; + protected final List groupProperties; public PubSubGroupDataType( PascalString name, boolean enabled, MessageSecurityMode securityMode, PascalString securityGroupId, - int noOfSecurityKeyServices, - List securityKeyServices, + List securityKeyServices, long maxNetworkMessageSize, - int noOfGroupProperties, - List groupProperties) { + List groupProperties) { super(); this.name = name; this.enabled = enabled; this.securityMode = securityMode; this.securityGroupId = securityGroupId; - this.noOfSecurityKeyServices = noOfSecurityKeyServices; this.securityKeyServices = securityKeyServices; this.maxNetworkMessageSize = maxNetworkMessageSize; - this.noOfGroupProperties = noOfGroupProperties; this.groupProperties = groupProperties; } @@ -91,11 +85,7 @@ public PascalString getSecurityGroupId() { return securityGroupId; } - public int getNoOfSecurityKeyServices() { - return noOfSecurityKeyServices; - } - - public List getSecurityKeyServices() { + public List getSecurityKeyServices() { return securityKeyServices; } @@ -103,11 +93,7 @@ public long getMaxNetworkMessageSize() { return maxNetworkMessageSize; } - public int getNoOfGroupProperties() { - return noOfGroupProperties; - } - - public List getGroupProperties() { + public List getGroupProperties() { return groupProperties; } @@ -140,8 +126,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (securityGroupId) writeSimpleField("securityGroupId", securityGroupId, writeComplex(writeBuffer)); - // Simple Field (noOfSecurityKeyServices) - writeSimpleField( + // Implicit Field (noOfSecurityKeyServices) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSecurityKeyServices = + (int) ((((getSecurityKeyServices()) == (null)) ? -(1) : COUNT(getSecurityKeyServices()))); + writeImplicitField( "noOfSecurityKeyServices", noOfSecurityKeyServices, writeSignedInt(writeBuffer, 32)); // Array Field (securityKeyServices) @@ -151,8 +140,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeSimpleField( "maxNetworkMessageSize", maxNetworkMessageSize, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfGroupProperties) - writeSimpleField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfGroupProperties) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfGroupProperties = + (int) ((((getGroupProperties()) == (null)) ? -(1) : COUNT(getGroupProperties()))); + writeImplicitField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); // Array Field (groupProperties) writeComplexTypeArrayField("groupProperties", groupProperties, writeBuffer); @@ -186,13 +178,13 @@ public int getLengthInBits() { // Simple field (securityGroupId) lengthInBits += securityGroupId.getLengthInBits(); - // Simple field (noOfSecurityKeyServices) + // Implicit Field (noOfSecurityKeyServices) lengthInBits += 32; // Array field if (securityKeyServices != null) { int i = 0; - for (ExtensionObjectDefinition element : securityKeyServices) { + for (EndpointDescription element : securityKeyServices) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= securityKeyServices.size()); lengthInBits += element.getLengthInBits(); } @@ -201,13 +193,13 @@ public int getLengthInBits() { // Simple field (maxNetworkMessageSize) lengthInBits += 32; - // Simple field (noOfGroupProperties) + // Implicit Field (noOfGroupProperties) lengthInBits += 32; // Array field if (groupProperties != null) { int i = 0; - for (ExtensionObjectDefinition element : groupProperties) { + for (KeyValuePair element : groupProperties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= groupProperties.size()); lengthInBits += element.getLengthInBits(); } @@ -217,7 +209,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PubSubGroupDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -242,26 +234,30 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "securityGroupId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfSecurityKeyServices = - readSimpleField("noOfSecurityKeyServices", readSignedInt(readBuffer, 32)); + readImplicitField("noOfSecurityKeyServices", readSignedInt(readBuffer, 32)); - List securityKeyServices = + List securityKeyServices = readCountArrayField( "securityKeyServices", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("314")), + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), readBuffer), noOfSecurityKeyServices); long maxNetworkMessageSize = readSimpleField("maxNetworkMessageSize", readUnsignedLong(readBuffer, 32)); - int noOfGroupProperties = readSimpleField("noOfGroupProperties", readSignedInt(readBuffer, 32)); + int noOfGroupProperties = + readImplicitField("noOfGroupProperties", readSignedInt(readBuffer, 32)); - List groupProperties = + List groupProperties = readCountArrayField( "groupProperties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfGroupProperties); @@ -272,10 +268,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit enabled, securityMode, securityGroupId, - noOfSecurityKeyServices, securityKeyServices, maxNetworkMessageSize, - noOfGroupProperties, groupProperties); } @@ -285,30 +279,24 @@ public static class PubSubGroupDataTypeBuilderImpl private final boolean enabled; private final MessageSecurityMode securityMode; private final PascalString securityGroupId; - private final int noOfSecurityKeyServices; - private final List securityKeyServices; + private final List securityKeyServices; private final long maxNetworkMessageSize; - private final int noOfGroupProperties; - private final List groupProperties; + private final List groupProperties; public PubSubGroupDataTypeBuilderImpl( PascalString name, boolean enabled, MessageSecurityMode securityMode, PascalString securityGroupId, - int noOfSecurityKeyServices, - List securityKeyServices, + List securityKeyServices, long maxNetworkMessageSize, - int noOfGroupProperties, - List groupProperties) { + List groupProperties) { this.name = name; this.enabled = enabled; this.securityMode = securityMode; this.securityGroupId = securityGroupId; - this.noOfSecurityKeyServices = noOfSecurityKeyServices; this.securityKeyServices = securityKeyServices; this.maxNetworkMessageSize = maxNetworkMessageSize; - this.noOfGroupProperties = noOfGroupProperties; this.groupProperties = groupProperties; } @@ -319,10 +307,8 @@ public PubSubGroupDataType build() { enabled, securityMode, securityGroupId, - noOfSecurityKeyServices, securityKeyServices, maxNetworkMessageSize, - noOfGroupProperties, groupProperties); return pubSubGroupDataType; } @@ -341,10 +327,8 @@ public boolean equals(Object o) { && (getEnabled() == that.getEnabled()) && (getSecurityMode() == that.getSecurityMode()) && (getSecurityGroupId() == that.getSecurityGroupId()) - && (getNoOfSecurityKeyServices() == that.getNoOfSecurityKeyServices()) && (getSecurityKeyServices() == that.getSecurityKeyServices()) && (getMaxNetworkMessageSize() == that.getMaxNetworkMessageSize()) - && (getNoOfGroupProperties() == that.getNoOfGroupProperties()) && (getGroupProperties() == that.getGroupProperties()) && super.equals(that) && true; @@ -358,10 +342,8 @@ public int hashCode() { getEnabled(), getSecurityMode(), getSecurityGroupId(), - getNoOfSecurityKeyServices(), getSecurityKeyServices(), getMaxNetworkMessageSize(), - getNoOfGroupProperties(), getGroupProperties()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubKeyPushTargetDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubKeyPushTargetDataType.java index 92749c14aa8..a11205a2e3c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubKeyPushTargetDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PubSubKeyPushTargetDataType.java @@ -38,49 +38,40 @@ public class PubSubKeyPushTargetDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "25272"; + public Integer getExtensionId() { + return (int) 25272; } // Properties. protected final PascalString applicationUri; - protected final int noOfPushTargetFolder; protected final List pushTargetFolder; protected final PascalString endpointUrl; protected final PascalString securityPolicyUri; - protected final ExtensionObjectDefinition userTokenType; + protected final UserTokenPolicy userTokenType; protected final int requestedKeyCount; protected final double retryInterval; - protected final int noOfPushTargetProperties; - protected final List pushTargetProperties; - protected final int noOfSecurityGroups; + protected final List pushTargetProperties; protected final List securityGroups; public PubSubKeyPushTargetDataType( PascalString applicationUri, - int noOfPushTargetFolder, List pushTargetFolder, PascalString endpointUrl, PascalString securityPolicyUri, - ExtensionObjectDefinition userTokenType, + UserTokenPolicy userTokenType, int requestedKeyCount, double retryInterval, - int noOfPushTargetProperties, - List pushTargetProperties, - int noOfSecurityGroups, + List pushTargetProperties, List securityGroups) { super(); this.applicationUri = applicationUri; - this.noOfPushTargetFolder = noOfPushTargetFolder; this.pushTargetFolder = pushTargetFolder; this.endpointUrl = endpointUrl; this.securityPolicyUri = securityPolicyUri; this.userTokenType = userTokenType; this.requestedKeyCount = requestedKeyCount; this.retryInterval = retryInterval; - this.noOfPushTargetProperties = noOfPushTargetProperties; this.pushTargetProperties = pushTargetProperties; - this.noOfSecurityGroups = noOfSecurityGroups; this.securityGroups = securityGroups; } @@ -88,10 +79,6 @@ public PascalString getApplicationUri() { return applicationUri; } - public int getNoOfPushTargetFolder() { - return noOfPushTargetFolder; - } - public List getPushTargetFolder() { return pushTargetFolder; } @@ -104,7 +91,7 @@ public PascalString getSecurityPolicyUri() { return securityPolicyUri; } - public ExtensionObjectDefinition getUserTokenType() { + public UserTokenPolicy getUserTokenType() { return userTokenType; } @@ -116,18 +103,10 @@ public double getRetryInterval() { return retryInterval; } - public int getNoOfPushTargetProperties() { - return noOfPushTargetProperties; - } - - public List getPushTargetProperties() { + public List getPushTargetProperties() { return pushTargetProperties; } - public int getNoOfSecurityGroups() { - return noOfSecurityGroups; - } - public List getSecurityGroups() { return securityGroups; } @@ -142,8 +121,12 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (applicationUri) writeSimpleField("applicationUri", applicationUri, writeComplex(writeBuffer)); - // Simple Field (noOfPushTargetFolder) - writeSimpleField("noOfPushTargetFolder", noOfPushTargetFolder, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfPushTargetFolder) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfPushTargetFolder = + (int) ((((getPushTargetFolder()) == (null)) ? -(1) : COUNT(getPushTargetFolder()))); + writeImplicitField( + "noOfPushTargetFolder", noOfPushTargetFolder, writeSignedInt(writeBuffer, 32)); // Array Field (pushTargetFolder) writeComplexTypeArrayField("pushTargetFolder", pushTargetFolder, writeBuffer); @@ -163,15 +146,21 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (retryInterval) writeSimpleField("retryInterval", retryInterval, writeDouble(writeBuffer, 64)); - // Simple Field (noOfPushTargetProperties) - writeSimpleField( + // Implicit Field (noOfPushTargetProperties) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfPushTargetProperties = + (int) ((((getPushTargetProperties()) == (null)) ? -(1) : COUNT(getPushTargetProperties()))); + writeImplicitField( "noOfPushTargetProperties", noOfPushTargetProperties, writeSignedInt(writeBuffer, 32)); // Array Field (pushTargetProperties) writeComplexTypeArrayField("pushTargetProperties", pushTargetProperties, writeBuffer); - // Simple Field (noOfSecurityGroups) - writeSimpleField("noOfSecurityGroups", noOfSecurityGroups, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfSecurityGroups) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSecurityGroups = + (int) ((((getSecurityGroups()) == (null)) ? -(1) : COUNT(getSecurityGroups()))); + writeImplicitField("noOfSecurityGroups", noOfSecurityGroups, writeSignedInt(writeBuffer, 32)); // Array Field (securityGroups) writeComplexTypeArrayField("securityGroups", securityGroups, writeBuffer); @@ -193,7 +182,7 @@ public int getLengthInBits() { // Simple field (applicationUri) lengthInBits += applicationUri.getLengthInBits(); - // Simple field (noOfPushTargetFolder) + // Implicit Field (noOfPushTargetFolder) lengthInBits += 32; // Array field @@ -220,19 +209,19 @@ public int getLengthInBits() { // Simple field (retryInterval) lengthInBits += 64; - // Simple field (noOfPushTargetProperties) + // Implicit Field (noOfPushTargetProperties) lengthInBits += 32; // Array field if (pushTargetProperties != null) { int i = 0; - for (ExtensionObjectDefinition element : pushTargetProperties) { + for (KeyValuePair element : pushTargetProperties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= pushTargetProperties.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfSecurityGroups) + // Implicit Field (noOfSecurityGroups) lengthInBits += 32; // Array field @@ -248,7 +237,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PubSubKeyPushTargetDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -258,7 +247,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "applicationUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfPushTargetFolder = - readSimpleField("noOfPushTargetFolder", readSignedInt(readBuffer, 32)); + readImplicitField("noOfPushTargetFolder", readSignedInt(readBuffer, 32)); List pushTargetFolder = readCountArrayField( @@ -275,11 +264,13 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "securityPolicyUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - ExtensionObjectDefinition userTokenType = + UserTokenPolicy userTokenType = readSimpleField( "userTokenType", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("306")), + () -> + (UserTokenPolicy) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (306)), readBuffer)); int requestedKeyCount = readSimpleField("requestedKeyCount", readUnsignedInt(readBuffer, 16)); @@ -287,17 +278,18 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit double retryInterval = readSimpleField("retryInterval", readDouble(readBuffer, 64)); int noOfPushTargetProperties = - readSimpleField("noOfPushTargetProperties", readSignedInt(readBuffer, 32)); + readImplicitField("noOfPushTargetProperties", readSignedInt(readBuffer, 32)); - List pushTargetProperties = + List pushTargetProperties = readCountArrayField( "pushTargetProperties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfPushTargetProperties); - int noOfSecurityGroups = readSimpleField("noOfSecurityGroups", readSignedInt(readBuffer, 32)); + int noOfSecurityGroups = readImplicitField("noOfSecurityGroups", readSignedInt(readBuffer, 32)); List securityGroups = readCountArrayField( @@ -309,58 +301,46 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit // Create the instance return new PubSubKeyPushTargetDataTypeBuilderImpl( applicationUri, - noOfPushTargetFolder, pushTargetFolder, endpointUrl, securityPolicyUri, userTokenType, requestedKeyCount, retryInterval, - noOfPushTargetProperties, pushTargetProperties, - noOfSecurityGroups, securityGroups); } public static class PubSubKeyPushTargetDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString applicationUri; - private final int noOfPushTargetFolder; private final List pushTargetFolder; private final PascalString endpointUrl; private final PascalString securityPolicyUri; - private final ExtensionObjectDefinition userTokenType; + private final UserTokenPolicy userTokenType; private final int requestedKeyCount; private final double retryInterval; - private final int noOfPushTargetProperties; - private final List pushTargetProperties; - private final int noOfSecurityGroups; + private final List pushTargetProperties; private final List securityGroups; public PubSubKeyPushTargetDataTypeBuilderImpl( PascalString applicationUri, - int noOfPushTargetFolder, List pushTargetFolder, PascalString endpointUrl, PascalString securityPolicyUri, - ExtensionObjectDefinition userTokenType, + UserTokenPolicy userTokenType, int requestedKeyCount, double retryInterval, - int noOfPushTargetProperties, - List pushTargetProperties, - int noOfSecurityGroups, + List pushTargetProperties, List securityGroups) { this.applicationUri = applicationUri; - this.noOfPushTargetFolder = noOfPushTargetFolder; this.pushTargetFolder = pushTargetFolder; this.endpointUrl = endpointUrl; this.securityPolicyUri = securityPolicyUri; this.userTokenType = userTokenType; this.requestedKeyCount = requestedKeyCount; this.retryInterval = retryInterval; - this.noOfPushTargetProperties = noOfPushTargetProperties; this.pushTargetProperties = pushTargetProperties; - this.noOfSecurityGroups = noOfSecurityGroups; this.securityGroups = securityGroups; } @@ -368,16 +348,13 @@ public PubSubKeyPushTargetDataType build() { PubSubKeyPushTargetDataType pubSubKeyPushTargetDataType = new PubSubKeyPushTargetDataType( applicationUri, - noOfPushTargetFolder, pushTargetFolder, endpointUrl, securityPolicyUri, userTokenType, requestedKeyCount, retryInterval, - noOfPushTargetProperties, pushTargetProperties, - noOfSecurityGroups, securityGroups); return pubSubKeyPushTargetDataType; } @@ -393,16 +370,13 @@ public boolean equals(Object o) { } PubSubKeyPushTargetDataType that = (PubSubKeyPushTargetDataType) o; return (getApplicationUri() == that.getApplicationUri()) - && (getNoOfPushTargetFolder() == that.getNoOfPushTargetFolder()) && (getPushTargetFolder() == that.getPushTargetFolder()) && (getEndpointUrl() == that.getEndpointUrl()) && (getSecurityPolicyUri() == that.getSecurityPolicyUri()) && (getUserTokenType() == that.getUserTokenType()) && (getRequestedKeyCount() == that.getRequestedKeyCount()) && (getRetryInterval() == that.getRetryInterval()) - && (getNoOfPushTargetProperties() == that.getNoOfPushTargetProperties()) && (getPushTargetProperties() == that.getPushTargetProperties()) - && (getNoOfSecurityGroups() == that.getNoOfSecurityGroups()) && (getSecurityGroups() == that.getSecurityGroups()) && super.equals(that) && true; @@ -413,16 +387,13 @@ public int hashCode() { return Objects.hash( super.hashCode(), getApplicationUri(), - getNoOfPushTargetFolder(), getPushTargetFolder(), getEndpointUrl(), getSecurityPolicyUri(), getUserTokenType(), getRequestedKeyCount(), getRetryInterval(), - getNoOfPushTargetProperties(), getPushTargetProperties(), - getNoOfSecurityGroups(), getSecurityGroups()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishRequest.java index 2f39e4ef43e..402ba8b9875 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishRequest.java @@ -38,34 +38,26 @@ public class PublishRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "826"; + public Integer getExtensionId() { + return (int) 826; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfSubscriptionAcknowledgements; - protected final List subscriptionAcknowledgements; + protected final RequestHeader requestHeader; + protected final List subscriptionAcknowledgements; public PublishRequest( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionAcknowledgements, - List subscriptionAcknowledgements) { + RequestHeader requestHeader, List subscriptionAcknowledgements) { super(); this.requestHeader = requestHeader; - this.noOfSubscriptionAcknowledgements = noOfSubscriptionAcknowledgements; this.subscriptionAcknowledgements = subscriptionAcknowledgements; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfSubscriptionAcknowledgements() { - return noOfSubscriptionAcknowledgements; - } - - public List getSubscriptionAcknowledgements() { + public List getSubscriptionAcknowledgements() { return subscriptionAcknowledgements; } @@ -79,8 +71,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfSubscriptionAcknowledgements) - writeSimpleField( + // Implicit Field (noOfSubscriptionAcknowledgements) (Used for parsing, but its value is not + // stored as it's implicitly given by the objects content) + int noOfSubscriptionAcknowledgements = + (int) + ((((getSubscriptionAcknowledgements()) == (null)) + ? -(1) + : COUNT(getSubscriptionAcknowledgements()))); + writeImplicitField( "noOfSubscriptionAcknowledgements", noOfSubscriptionAcknowledgements, writeSignedInt(writeBuffer, 32)); @@ -106,13 +104,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfSubscriptionAcknowledgements) + // Implicit Field (noOfSubscriptionAcknowledgements) lengthInBits += 32; // Array field if (subscriptionAcknowledgements != null) { int i = 0; - for (ExtensionObjectDefinition element : subscriptionAcknowledgements) { + for (SubscriptionAcknowledgement element : subscriptionAcknowledgements) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= subscriptionAcknowledgements.size()); lengthInBits += element.getLengthInBits(); } @@ -122,54 +120,52 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PublishRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); int noOfSubscriptionAcknowledgements = - readSimpleField("noOfSubscriptionAcknowledgements", readSignedInt(readBuffer, 32)); + readImplicitField("noOfSubscriptionAcknowledgements", readSignedInt(readBuffer, 32)); - List subscriptionAcknowledgements = + List subscriptionAcknowledgements = readCountArrayField( "subscriptionAcknowledgements", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("823")), + () -> + (SubscriptionAcknowledgement) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (823)), readBuffer), noOfSubscriptionAcknowledgements); readBuffer.closeContext("PublishRequest"); // Create the instance - return new PublishRequestBuilderImpl( - requestHeader, noOfSubscriptionAcknowledgements, subscriptionAcknowledgements); + return new PublishRequestBuilderImpl(requestHeader, subscriptionAcknowledgements); } public static class PublishRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfSubscriptionAcknowledgements; - private final List subscriptionAcknowledgements; + private final RequestHeader requestHeader; + private final List subscriptionAcknowledgements; public PublishRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionAcknowledgements, - List subscriptionAcknowledgements) { + RequestHeader requestHeader, + List subscriptionAcknowledgements) { this.requestHeader = requestHeader; - this.noOfSubscriptionAcknowledgements = noOfSubscriptionAcknowledgements; this.subscriptionAcknowledgements = subscriptionAcknowledgements; } public PublishRequest build() { PublishRequest publishRequest = - new PublishRequest( - requestHeader, noOfSubscriptionAcknowledgements, subscriptionAcknowledgements); + new PublishRequest(requestHeader, subscriptionAcknowledgements); return publishRequest; } } @@ -184,7 +180,6 @@ public boolean equals(Object o) { } PublishRequest that = (PublishRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfSubscriptionAcknowledgements() == that.getNoOfSubscriptionAcknowledgements()) && (getSubscriptionAcknowledgements() == that.getSubscriptionAcknowledgements()) && super.equals(that) && true; @@ -192,11 +187,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getRequestHeader(), - getNoOfSubscriptionAcknowledgements(), - getSubscriptionAcknowledgements()); + return Objects.hash(super.hashCode(), getRequestHeader(), getSubscriptionAcknowledgements()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishResponse.java index e22119f7db0..1ca13fbe637 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishResponse.java @@ -38,47 +38,38 @@ public class PublishResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "829"; + public Integer getExtensionId() { + return (int) 829; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; protected final long subscriptionId; - protected final int noOfAvailableSequenceNumbers; protected final List availableSequenceNumbers; protected final boolean moreNotifications; - protected final ExtensionObjectDefinition notificationMessage; - protected final int noOfResults; + protected final NotificationMessage notificationMessage; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public PublishResponse( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long subscriptionId, - int noOfAvailableSequenceNumbers, List availableSequenceNumbers, boolean moreNotifications, - ExtensionObjectDefinition notificationMessage, - int noOfResults, + NotificationMessage notificationMessage, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; this.subscriptionId = subscriptionId; - this.noOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers; this.availableSequenceNumbers = availableSequenceNumbers; this.moreNotifications = moreNotifications; this.notificationMessage = notificationMessage; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -86,10 +77,6 @@ public long getSubscriptionId() { return subscriptionId; } - public int getNoOfAvailableSequenceNumbers() { - return noOfAvailableSequenceNumbers; - } - public List getAvailableSequenceNumbers() { return availableSequenceNumbers; } @@ -98,22 +85,14 @@ public boolean getMoreNotifications() { return moreNotifications; } - public ExtensionObjectDefinition getNotificationMessage() { + public NotificationMessage getNotificationMessage() { return notificationMessage; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -131,8 +110,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (subscriptionId) writeSimpleField("subscriptionId", subscriptionId, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfAvailableSequenceNumbers) - writeSimpleField( + // Implicit Field (noOfAvailableSequenceNumbers) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfAvailableSequenceNumbers = + (int) + ((((getAvailableSequenceNumbers()) == (null)) + ? -(1) + : COUNT(getAvailableSequenceNumbers()))); + writeImplicitField( "noOfAvailableSequenceNumbers", noOfAvailableSequenceNumbers, writeSignedInt(writeBuffer, 32)); @@ -150,14 +135,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (notificationMessage) writeSimpleField("notificationMessage", notificationMessage, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -182,7 +172,7 @@ public int getLengthInBits() { // Simple field (subscriptionId) lengthInBits += 32; - // Simple field (noOfAvailableSequenceNumbers) + // Implicit Field (noOfAvailableSequenceNumbers) lengthInBits += 32; // Array field @@ -199,7 +189,7 @@ public int getLengthInBits() { // Simple field (notificationMessage) lengthInBits += notificationMessage.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -211,7 +201,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -227,22 +217,23 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PublishResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); int noOfAvailableSequenceNumbers = - readSimpleField("noOfAvailableSequenceNumbers", readSignedInt(readBuffer, 32)); + readImplicitField("noOfAvailableSequenceNumbers", readSignedInt(readBuffer, 32)); List availableSequenceNumbers = readCountArrayField( @@ -255,14 +246,16 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit boolean moreNotifications = readSimpleField("moreNotifications", readBoolean(readBuffer)); - ExtensionObjectDefinition notificationMessage = + NotificationMessage notificationMessage = readSimpleField( "notificationMessage", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("805")), + () -> + (NotificationMessage) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (805)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -270,7 +263,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -283,49 +277,37 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit return new PublishResponseBuilderImpl( responseHeader, subscriptionId, - noOfAvailableSequenceNumbers, availableSequenceNumbers, moreNotifications, notificationMessage, - noOfResults, results, - noOfDiagnosticInfos, diagnosticInfos); } public static class PublishResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; private final long subscriptionId; - private final int noOfAvailableSequenceNumbers; private final List availableSequenceNumbers; private final boolean moreNotifications; - private final ExtensionObjectDefinition notificationMessage; - private final int noOfResults; + private final NotificationMessage notificationMessage; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public PublishResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, + ResponseHeader responseHeader, long subscriptionId, - int noOfAvailableSequenceNumbers, List availableSequenceNumbers, boolean moreNotifications, - ExtensionObjectDefinition notificationMessage, - int noOfResults, + NotificationMessage notificationMessage, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; this.subscriptionId = subscriptionId; - this.noOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers; this.availableSequenceNumbers = availableSequenceNumbers; this.moreNotifications = moreNotifications; this.notificationMessage = notificationMessage; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } @@ -334,13 +316,10 @@ public PublishResponse build() { new PublishResponse( responseHeader, subscriptionId, - noOfAvailableSequenceNumbers, availableSequenceNumbers, moreNotifications, notificationMessage, - noOfResults, results, - noOfDiagnosticInfos, diagnosticInfos); return publishResponse; } @@ -357,13 +336,10 @@ public boolean equals(Object o) { PublishResponse that = (PublishResponse) o; return (getResponseHeader() == that.getResponseHeader()) && (getSubscriptionId() == that.getSubscriptionId()) - && (getNoOfAvailableSequenceNumbers() == that.getNoOfAvailableSequenceNumbers()) && (getAvailableSequenceNumbers() == that.getAvailableSequenceNumbers()) && (getMoreNotifications() == that.getMoreNotifications()) && (getNotificationMessage() == that.getNotificationMessage()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -375,13 +351,10 @@ public int hashCode() { super.hashCode(), getResponseHeader(), getSubscriptionId(), - getNoOfAvailableSequenceNumbers(), getAvailableSequenceNumbers(), getMoreNotifications(), getNotificationMessage(), - getNoOfResults(), getResults(), - getNoOfDiagnosticInfos(), getDiagnosticInfos()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataItemsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataItemsDataType.java new file mode 100644 index 00000000000..9fd4437b0c7 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataItemsDataType.java @@ -0,0 +1,167 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PublishedDataItemsDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15583; + } + + // Properties. + protected final List publishedData; + + public PublishedDataItemsDataType(List publishedData) { + super(); + this.publishedData = publishedData; + } + + public List getPublishedData() { + return publishedData; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PublishedDataItemsDataType"); + + // Implicit Field (noOfPublishedData) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfPublishedData = + (int) ((((getPublishedData()) == (null)) ? -(1) : COUNT(getPublishedData()))); + writeImplicitField("noOfPublishedData", noOfPublishedData, writeSignedInt(writeBuffer, 32)); + + // Array Field (publishedData) + writeComplexTypeArrayField("publishedData", publishedData, writeBuffer); + + writeBuffer.popContext("PublishedDataItemsDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PublishedDataItemsDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfPublishedData) + lengthInBits += 32; + + // Array field + if (publishedData != null) { + int i = 0; + for (PublishedVariableDataType element : publishedData) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= publishedData.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PublishedDataItemsDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfPublishedData = readImplicitField("noOfPublishedData", readSignedInt(readBuffer, 32)); + + List publishedData = + readCountArrayField( + "publishedData", + readComplex( + () -> + (PublishedVariableDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14275)), + readBuffer), + noOfPublishedData); + + readBuffer.closeContext("PublishedDataItemsDataType"); + // Create the instance + return new PublishedDataItemsDataTypeBuilderImpl(publishedData); + } + + public static class PublishedDataItemsDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List publishedData; + + public PublishedDataItemsDataTypeBuilderImpl(List publishedData) { + this.publishedData = publishedData; + } + + public PublishedDataItemsDataType build() { + PublishedDataItemsDataType publishedDataItemsDataType = + new PublishedDataItemsDataType(publishedData); + return publishedDataItemsDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PublishedDataItemsDataType)) { + return false; + } + PublishedDataItemsDataType that = (PublishedDataItemsDataType) o; + return (getPublishedData() == that.getPublishedData()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getPublishedData()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetCustomSourceDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetCustomSourceDataType.java new file mode 100644 index 00000000000..c403b4fd3ab --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetCustomSourceDataType.java @@ -0,0 +1,152 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PublishedDataSetCustomSourceDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 25271; + } + + // Properties. + protected final boolean cyclicDataSet; + + public PublishedDataSetCustomSourceDataType(boolean cyclicDataSet) { + super(); + this.cyclicDataSet = cyclicDataSet; + } + + public boolean getCyclicDataSet() { + return cyclicDataSet; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PublishedDataSetCustomSourceDataType"); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (cyclicDataSet) + writeSimpleField("cyclicDataSet", cyclicDataSet, writeBoolean(writeBuffer)); + + writeBuffer.popContext("PublishedDataSetCustomSourceDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PublishedDataSetCustomSourceDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (cyclicDataSet) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PublishedDataSetCustomSourceDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean cyclicDataSet = readSimpleField("cyclicDataSet", readBoolean(readBuffer)); + + readBuffer.closeContext("PublishedDataSetCustomSourceDataType"); + // Create the instance + return new PublishedDataSetCustomSourceDataTypeBuilderImpl(cyclicDataSet); + } + + public static class PublishedDataSetCustomSourceDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final boolean cyclicDataSet; + + public PublishedDataSetCustomSourceDataTypeBuilderImpl(boolean cyclicDataSet) { + this.cyclicDataSet = cyclicDataSet; + } + + public PublishedDataSetCustomSourceDataType build() { + PublishedDataSetCustomSourceDataType publishedDataSetCustomSourceDataType = + new PublishedDataSetCustomSourceDataType(cyclicDataSet); + return publishedDataSetCustomSourceDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PublishedDataSetCustomSourceDataType)) { + return false; + } + PublishedDataSetCustomSourceDataType that = (PublishedDataSetCustomSourceDataType) o; + return (getCyclicDataSet() == that.getCyclicDataSet()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getCyclicDataSet()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetDataType.java new file mode 100644 index 00000000000..f672877c36a --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetDataType.java @@ -0,0 +1,289 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PublishedDataSetDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15580; + } + + // Properties. + protected final PascalString name; + protected final List dataSetFolder; + protected final DataSetMetaDataType dataSetMetaData; + protected final List extensionFields; + protected final ExtensionObject dataSetSource; + + public PublishedDataSetDataType( + PascalString name, + List dataSetFolder, + DataSetMetaDataType dataSetMetaData, + List extensionFields, + ExtensionObject dataSetSource) { + super(); + this.name = name; + this.dataSetFolder = dataSetFolder; + this.dataSetMetaData = dataSetMetaData; + this.extensionFields = extensionFields; + this.dataSetSource = dataSetSource; + } + + public PascalString getName() { + return name; + } + + public List getDataSetFolder() { + return dataSetFolder; + } + + public DataSetMetaDataType getDataSetMetaData() { + return dataSetMetaData; + } + + public List getExtensionFields() { + return extensionFields; + } + + public ExtensionObject getDataSetSource() { + return dataSetSource; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PublishedDataSetDataType"); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Implicit Field (noOfDataSetFolder) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataSetFolder = + (int) ((((getDataSetFolder()) == (null)) ? -(1) : COUNT(getDataSetFolder()))); + writeImplicitField("noOfDataSetFolder", noOfDataSetFolder, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetFolder) + writeComplexTypeArrayField("dataSetFolder", dataSetFolder, writeBuffer); + + // Simple Field (dataSetMetaData) + writeSimpleField("dataSetMetaData", dataSetMetaData, writeComplex(writeBuffer)); + + // Implicit Field (noOfExtensionFields) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfExtensionFields = + (int) ((((getExtensionFields()) == (null)) ? -(1) : COUNT(getExtensionFields()))); + writeImplicitField("noOfExtensionFields", noOfExtensionFields, writeSignedInt(writeBuffer, 32)); + + // Array Field (extensionFields) + writeComplexTypeArrayField("extensionFields", extensionFields, writeBuffer); + + // Simple Field (dataSetSource) + writeSimpleField("dataSetSource", dataSetSource, writeComplex(writeBuffer)); + + writeBuffer.popContext("PublishedDataSetDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PublishedDataSetDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Implicit Field (noOfDataSetFolder) + lengthInBits += 32; + + // Array field + if (dataSetFolder != null) { + int i = 0; + for (PascalString element : dataSetFolder) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetFolder.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (dataSetMetaData) + lengthInBits += dataSetMetaData.getLengthInBits(); + + // Implicit Field (noOfExtensionFields) + lengthInBits += 32; + + // Array field + if (extensionFields != null) { + int i = 0; + for (KeyValuePair element : extensionFields) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= extensionFields.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (dataSetSource) + lengthInBits += dataSetSource.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PublishedDataSetDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfDataSetFolder = readImplicitField("noOfDataSetFolder", readSignedInt(readBuffer, 32)); + + List dataSetFolder = + readCountArrayField( + "dataSetFolder", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfDataSetFolder); + + DataSetMetaDataType dataSetMetaData = + readSimpleField( + "dataSetMetaData", + readComplex( + () -> + (DataSetMetaDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14525)), + readBuffer)); + + int noOfExtensionFields = + readImplicitField("noOfExtensionFields", readSignedInt(readBuffer, 32)); + + List extensionFields = + readCountArrayField( + "extensionFields", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfExtensionFields); + + ExtensionObject dataSetSource = + readSimpleField( + "dataSetSource", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + readBuffer.closeContext("PublishedDataSetDataType"); + // Create the instance + return new PublishedDataSetDataTypeBuilderImpl( + name, dataSetFolder, dataSetMetaData, extensionFields, dataSetSource); + } + + public static class PublishedDataSetDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString name; + private final List dataSetFolder; + private final DataSetMetaDataType dataSetMetaData; + private final List extensionFields; + private final ExtensionObject dataSetSource; + + public PublishedDataSetDataTypeBuilderImpl( + PascalString name, + List dataSetFolder, + DataSetMetaDataType dataSetMetaData, + List extensionFields, + ExtensionObject dataSetSource) { + this.name = name; + this.dataSetFolder = dataSetFolder; + this.dataSetMetaData = dataSetMetaData; + this.extensionFields = extensionFields; + this.dataSetSource = dataSetSource; + } + + public PublishedDataSetDataType build() { + PublishedDataSetDataType publishedDataSetDataType = + new PublishedDataSetDataType( + name, dataSetFolder, dataSetMetaData, extensionFields, dataSetSource); + return publishedDataSetDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PublishedDataSetDataType)) { + return false; + } + PublishedDataSetDataType that = (PublishedDataSetDataType) o; + return (getName() == that.getName()) + && (getDataSetFolder() == that.getDataSetFolder()) + && (getDataSetMetaData() == that.getDataSetMetaData()) + && (getExtensionFields() == that.getExtensionFields()) + && (getDataSetSource() == that.getDataSetSource()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getName(), + getDataSetFolder(), + getDataSetMetaData(), + getExtensionFields(), + getDataSetSource()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetSourceDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetSourceDataType.java index 1ee4b692e41..2de243ee722 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetSourceDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedDataSetSourceDataType.java @@ -38,8 +38,8 @@ public class PublishedDataSetSourceDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15582"; + public Integer getExtensionId() { + return (int) 15582; } public PublishedDataSetSourceDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PublishedDataSetSourceDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedEventsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedEventsDataType.java new file mode 100644 index 00000000000..16923316de4 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedEventsDataType.java @@ -0,0 +1,213 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class PublishedEventsDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15584; + } + + // Properties. + protected final NodeId eventNotifier; + protected final List selectedFields; + protected final ContentFilter filter; + + public PublishedEventsDataType( + NodeId eventNotifier, List selectedFields, ContentFilter filter) { + super(); + this.eventNotifier = eventNotifier; + this.selectedFields = selectedFields; + this.filter = filter; + } + + public NodeId getEventNotifier() { + return eventNotifier; + } + + public List getSelectedFields() { + return selectedFields; + } + + public ContentFilter getFilter() { + return filter; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("PublishedEventsDataType"); + + // Simple Field (eventNotifier) + writeSimpleField("eventNotifier", eventNotifier, writeComplex(writeBuffer)); + + // Implicit Field (noOfSelectedFields) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSelectedFields = + (int) ((((getSelectedFields()) == (null)) ? -(1) : COUNT(getSelectedFields()))); + writeImplicitField("noOfSelectedFields", noOfSelectedFields, writeSignedInt(writeBuffer, 32)); + + // Array Field (selectedFields) + writeComplexTypeArrayField("selectedFields", selectedFields, writeBuffer); + + // Simple Field (filter) + writeSimpleField("filter", filter, writeComplex(writeBuffer)); + + writeBuffer.popContext("PublishedEventsDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + PublishedEventsDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (eventNotifier) + lengthInBits += eventNotifier.getLengthInBits(); + + // Implicit Field (noOfSelectedFields) + lengthInBits += 32; + + // Array field + if (selectedFields != null) { + int i = 0; + for (SimpleAttributeOperand element : selectedFields) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= selectedFields.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (filter) + lengthInBits += filter.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("PublishedEventsDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId eventNotifier = + readSimpleField( + "eventNotifier", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int noOfSelectedFields = readImplicitField("noOfSelectedFields", readSignedInt(readBuffer, 32)); + + List selectedFields = + readCountArrayField( + "selectedFields", + readComplex( + () -> + (SimpleAttributeOperand) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (603)), + readBuffer), + noOfSelectedFields); + + ContentFilter filter = + readSimpleField( + "filter", + readComplex( + () -> + (ContentFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (588)), + readBuffer)); + + readBuffer.closeContext("PublishedEventsDataType"); + // Create the instance + return new PublishedEventsDataTypeBuilderImpl(eventNotifier, selectedFields, filter); + } + + public static class PublishedEventsDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId eventNotifier; + private final List selectedFields; + private final ContentFilter filter; + + public PublishedEventsDataTypeBuilderImpl( + NodeId eventNotifier, List selectedFields, ContentFilter filter) { + this.eventNotifier = eventNotifier; + this.selectedFields = selectedFields; + this.filter = filter; + } + + public PublishedEventsDataType build() { + PublishedEventsDataType publishedEventsDataType = + new PublishedEventsDataType(eventNotifier, selectedFields, filter); + return publishedEventsDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PublishedEventsDataType)) { + return false; + } + PublishedEventsDataType that = (PublishedEventsDataType) o; + return (getEventNotifier() == that.getEventNotifier()) + && (getSelectedFields() == that.getSelectedFields()) + && (getFilter() == that.getFilter()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getEventNotifier(), getSelectedFields(), getFilter()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedVariableDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedVariableDataType.java index f8f787f9cb0..92f6efc597b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedVariableDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/PublishedVariableDataType.java @@ -38,8 +38,8 @@ public class PublishedVariableDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "14275"; + public Integer getExtensionId() { + return (int) 14275; } // Properties. @@ -50,7 +50,6 @@ public String getIdentifier() { protected final double deadbandValue; protected final PascalString indexRange; protected final Variant substituteValue; - protected final int noOfMetaDataProperties; protected final List metaDataProperties; public PublishedVariableDataType( @@ -61,7 +60,6 @@ public PublishedVariableDataType( double deadbandValue, PascalString indexRange, Variant substituteValue, - int noOfMetaDataProperties, List metaDataProperties) { super(); this.publishedVariable = publishedVariable; @@ -71,7 +69,6 @@ public PublishedVariableDataType( this.deadbandValue = deadbandValue; this.indexRange = indexRange; this.substituteValue = substituteValue; - this.noOfMetaDataProperties = noOfMetaDataProperties; this.metaDataProperties = metaDataProperties; } @@ -103,10 +100,6 @@ public Variant getSubstituteValue() { return substituteValue; } - public int getNoOfMetaDataProperties() { - return noOfMetaDataProperties; - } - public List getMetaDataProperties() { return metaDataProperties; } @@ -139,8 +132,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (substituteValue) writeSimpleField("substituteValue", substituteValue, writeComplex(writeBuffer)); - // Simple Field (noOfMetaDataProperties) - writeSimpleField( + // Implicit Field (noOfMetaDataProperties) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfMetaDataProperties = + (int) ((((getMetaDataProperties()) == (null)) ? -(1) : COUNT(getMetaDataProperties()))); + writeImplicitField( "noOfMetaDataProperties", noOfMetaDataProperties, writeSignedInt(writeBuffer, 32)); // Array Field (metaDataProperties) @@ -181,7 +177,7 @@ public int getLengthInBits() { // Simple field (substituteValue) lengthInBits += substituteValue.getLengthInBits(); - // Simple field (noOfMetaDataProperties) + // Implicit Field (noOfMetaDataProperties) lengthInBits += 32; // Array field @@ -197,7 +193,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("PublishedVariableDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -224,7 +220,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "substituteValue", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); int noOfMetaDataProperties = - readSimpleField("noOfMetaDataProperties", readSignedInt(readBuffer, 32)); + readImplicitField("noOfMetaDataProperties", readSignedInt(readBuffer, 32)); List metaDataProperties = readCountArrayField( @@ -242,7 +238,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit deadbandValue, indexRange, substituteValue, - noOfMetaDataProperties, metaDataProperties); } @@ -255,7 +250,6 @@ public static class PublishedVariableDataTypeBuilderImpl private final double deadbandValue; private final PascalString indexRange; private final Variant substituteValue; - private final int noOfMetaDataProperties; private final List metaDataProperties; public PublishedVariableDataTypeBuilderImpl( @@ -266,7 +260,6 @@ public PublishedVariableDataTypeBuilderImpl( double deadbandValue, PascalString indexRange, Variant substituteValue, - int noOfMetaDataProperties, List metaDataProperties) { this.publishedVariable = publishedVariable; this.attributeId = attributeId; @@ -275,7 +268,6 @@ public PublishedVariableDataTypeBuilderImpl( this.deadbandValue = deadbandValue; this.indexRange = indexRange; this.substituteValue = substituteValue; - this.noOfMetaDataProperties = noOfMetaDataProperties; this.metaDataProperties = metaDataProperties; } @@ -289,7 +281,6 @@ public PublishedVariableDataType build() { deadbandValue, indexRange, substituteValue, - noOfMetaDataProperties, metaDataProperties); return publishedVariableDataType; } @@ -311,7 +302,6 @@ public boolean equals(Object o) { && (getDeadbandValue() == that.getDeadbandValue()) && (getIndexRange() == that.getIndexRange()) && (getSubstituteValue() == that.getSubstituteValue()) - && (getNoOfMetaDataProperties() == that.getNoOfMetaDataProperties()) && (getMetaDataProperties() == that.getMetaDataProperties()) && super.equals(that) && true; @@ -328,7 +318,6 @@ public int hashCode() { getDeadbandValue(), getIndexRange(), getSubstituteValue(), - getNoOfMetaDataProperties(), getMetaDataProperties()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QosDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QosDataType.java index 7741d2b0d06..ea980a40cbc 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QosDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QosDataType.java @@ -38,8 +38,8 @@ public class QosDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "23605"; + public Integer getExtensionId() { + return (int) 23605; } public QosDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QosDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QuantityDimension.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QuantityDimension.java index 05299d4a03a..d3847245d4b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QuantityDimension.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QuantityDimension.java @@ -38,8 +38,8 @@ public class QuantityDimension extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32440"; + public Integer getExtensionId() { + return (int) 32440; } // Properties. @@ -184,7 +184,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QuantityDimension"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataDescription.java index 5180696240f..a13d7b079e7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataDescription.java @@ -38,24 +38,24 @@ public class QueryDataDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "572"; + public Integer getExtensionId() { + return (int) 572; } // Properties. - protected final ExtensionObjectDefinition relativePath; + protected final RelativePath relativePath; protected final long attributeId; protected final PascalString indexRange; public QueryDataDescription( - ExtensionObjectDefinition relativePath, long attributeId, PascalString indexRange) { + RelativePath relativePath, long attributeId, PascalString indexRange) { super(); this.relativePath = relativePath; this.attributeId = attributeId; this.indexRange = indexRange; } - public ExtensionObjectDefinition getRelativePath() { + public RelativePath getRelativePath() { return relativePath; } @@ -110,16 +110,16 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryDataDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition relativePath = + RelativePath relativePath = readSimpleField( "relativePath", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("542")), + () -> (RelativePath) ExtensionObjectDefinition.staticParse(readBuffer, (int) (542)), readBuffer)); long attributeId = readSimpleField("attributeId", readUnsignedLong(readBuffer, 32)); @@ -135,12 +135,12 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class QueryDataDescriptionBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition relativePath; + private final RelativePath relativePath; private final long attributeId; private final PascalString indexRange; public QueryDataDescriptionBuilderImpl( - ExtensionObjectDefinition relativePath, long attributeId, PascalString indexRange) { + RelativePath relativePath, long attributeId, PascalString indexRange) { this.relativePath = relativePath; this.attributeId = attributeId; this.indexRange = indexRange; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataSet.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataSet.java index e771c313fc7..9ec465a6fbe 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataSet.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryDataSet.java @@ -38,25 +38,20 @@ public class QueryDataSet extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "579"; + public Integer getExtensionId() { + return (int) 579; } // Properties. protected final ExpandedNodeId nodeId; protected final ExpandedNodeId typeDefinitionNode; - protected final int noOfValues; protected final List values; public QueryDataSet( - ExpandedNodeId nodeId, - ExpandedNodeId typeDefinitionNode, - int noOfValues, - List values) { + ExpandedNodeId nodeId, ExpandedNodeId typeDefinitionNode, List values) { super(); this.nodeId = nodeId; this.typeDefinitionNode = typeDefinitionNode; - this.noOfValues = noOfValues; this.values = values; } @@ -68,10 +63,6 @@ public ExpandedNodeId getTypeDefinitionNode() { return typeDefinitionNode; } - public int getNoOfValues() { - return noOfValues; - } - public List getValues() { return values; } @@ -89,8 +80,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (typeDefinitionNode) writeSimpleField("typeDefinitionNode", typeDefinitionNode, writeComplex(writeBuffer)); - // Simple Field (noOfValues) - writeSimpleField("noOfValues", noOfValues, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfValues) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfValues = (int) ((((getValues()) == (null)) ? -(1) : COUNT(getValues()))); + writeImplicitField("noOfValues", noOfValues, writeSignedInt(writeBuffer, 32)); // Array Field (values) writeComplexTypeArrayField("values", values, writeBuffer); @@ -115,7 +108,7 @@ public int getLengthInBits() { // Simple field (typeDefinitionNode) lengthInBits += typeDefinitionNode.getLengthInBits(); - // Simple field (noOfValues) + // Implicit Field (noOfValues) lengthInBits += 32; // Array field @@ -131,7 +124,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryDataSet"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -145,7 +138,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "typeDefinitionNode", readComplex(() -> ExpandedNodeId.staticParse(readBuffer), readBuffer)); - int noOfValues = readSimpleField("noOfValues", readSignedInt(readBuffer, 32)); + int noOfValues = readImplicitField("noOfValues", readSignedInt(readBuffer, 32)); List values = readCountArrayField( @@ -153,29 +146,24 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("QueryDataSet"); // Create the instance - return new QueryDataSetBuilderImpl(nodeId, typeDefinitionNode, noOfValues, values); + return new QueryDataSetBuilderImpl(nodeId, typeDefinitionNode, values); } public static class QueryDataSetBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final ExpandedNodeId nodeId; private final ExpandedNodeId typeDefinitionNode; - private final int noOfValues; private final List values; public QueryDataSetBuilderImpl( - ExpandedNodeId nodeId, - ExpandedNodeId typeDefinitionNode, - int noOfValues, - List values) { + ExpandedNodeId nodeId, ExpandedNodeId typeDefinitionNode, List values) { this.nodeId = nodeId; this.typeDefinitionNode = typeDefinitionNode; - this.noOfValues = noOfValues; this.values = values; } public QueryDataSet build() { - QueryDataSet queryDataSet = new QueryDataSet(nodeId, typeDefinitionNode, noOfValues, values); + QueryDataSet queryDataSet = new QueryDataSet(nodeId, typeDefinitionNode, values); return queryDataSet; } } @@ -191,7 +179,6 @@ public boolean equals(Object o) { QueryDataSet that = (QueryDataSet) o; return (getNodeId() == that.getNodeId()) && (getTypeDefinitionNode() == that.getTypeDefinitionNode()) - && (getNoOfValues() == that.getNoOfValues()) && (getValues() == that.getValues()) && super.equals(that) && true; @@ -199,8 +186,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getNodeId(), getTypeDefinitionNode(), getNoOfValues(), getValues()); + return Objects.hash(super.hashCode(), getNodeId(), getTypeDefinitionNode(), getValues()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstRequest.java index 5deb7d5ca55..27d1bf3fe74 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstRequest.java @@ -38,54 +38,47 @@ public class QueryFirstRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "615"; + public Integer getExtensionId() { + return (int) 615; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition view; - protected final int noOfNodeTypes; - protected final List nodeTypes; - protected final ExtensionObjectDefinition filter; + protected final RequestHeader requestHeader; + protected final ViewDescription view; + protected final List nodeTypes; + protected final ContentFilter filter; protected final long maxDataSetsToReturn; protected final long maxReferencesToReturn; public QueryFirstRequest( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition view, - int noOfNodeTypes, - List nodeTypes, - ExtensionObjectDefinition filter, + RequestHeader requestHeader, + ViewDescription view, + List nodeTypes, + ContentFilter filter, long maxDataSetsToReturn, long maxReferencesToReturn) { super(); this.requestHeader = requestHeader; this.view = view; - this.noOfNodeTypes = noOfNodeTypes; this.nodeTypes = nodeTypes; this.filter = filter; this.maxDataSetsToReturn = maxDataSetsToReturn; this.maxReferencesToReturn = maxReferencesToReturn; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getView() { + public ViewDescription getView() { return view; } - public int getNoOfNodeTypes() { - return noOfNodeTypes; - } - - public List getNodeTypes() { + public List getNodeTypes() { return nodeTypes; } - public ExtensionObjectDefinition getFilter() { + public ContentFilter getFilter() { return filter; } @@ -110,8 +103,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (view) writeSimpleField("view", view, writeComplex(writeBuffer)); - // Simple Field (noOfNodeTypes) - writeSimpleField("noOfNodeTypes", noOfNodeTypes, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodeTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodeTypes = (int) ((((getNodeTypes()) == (null)) ? -(1) : COUNT(getNodeTypes()))); + writeImplicitField("noOfNodeTypes", noOfNodeTypes, writeSignedInt(writeBuffer, 32)); // Array Field (nodeTypes) writeComplexTypeArrayField("nodeTypes", nodeTypes, writeBuffer); @@ -147,13 +142,13 @@ public int getLengthInBits() { // Simple field (view) lengthInBits += view.getLengthInBits(); - // Simple field (noOfNodeTypes) + // Implicit Field (noOfNodeTypes) lengthInBits += 32; // Array field if (nodeTypes != null) { int i = 0; - for (ExtensionObjectDefinition element : nodeTypes) { + for (NodeTypeDescription element : nodeTypes) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodeTypes.size()); lengthInBits += element.getLengthInBits(); } @@ -172,40 +167,46 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryFirstRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition view = + ViewDescription view = readSimpleField( "view", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("513")), + () -> + (ViewDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (513)), readBuffer)); - int noOfNodeTypes = readSimpleField("noOfNodeTypes", readSignedInt(readBuffer, 32)); + int noOfNodeTypes = readImplicitField("noOfNodeTypes", readSignedInt(readBuffer, 32)); - List nodeTypes = + List nodeTypes = readCountArrayField( "nodeTypes", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("575")), + () -> + (NodeTypeDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (575)), readBuffer), noOfNodeTypes); - ExtensionObjectDefinition filter = + ContentFilter filter = readSimpleField( "filter", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("588")), + () -> + (ContentFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (588)), readBuffer)); long maxDataSetsToReturn = @@ -217,36 +218,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("QueryFirstRequest"); // Create the instance return new QueryFirstRequestBuilderImpl( - requestHeader, - view, - noOfNodeTypes, - nodeTypes, - filter, - maxDataSetsToReturn, - maxReferencesToReturn); + requestHeader, view, nodeTypes, filter, maxDataSetsToReturn, maxReferencesToReturn); } public static class QueryFirstRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition view; - private final int noOfNodeTypes; - private final List nodeTypes; - private final ExtensionObjectDefinition filter; + private final RequestHeader requestHeader; + private final ViewDescription view; + private final List nodeTypes; + private final ContentFilter filter; private final long maxDataSetsToReturn; private final long maxReferencesToReturn; public QueryFirstRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition view, - int noOfNodeTypes, - List nodeTypes, - ExtensionObjectDefinition filter, + RequestHeader requestHeader, + ViewDescription view, + List nodeTypes, + ContentFilter filter, long maxDataSetsToReturn, long maxReferencesToReturn) { this.requestHeader = requestHeader; this.view = view; - this.noOfNodeTypes = noOfNodeTypes; this.nodeTypes = nodeTypes; this.filter = filter; this.maxDataSetsToReturn = maxDataSetsToReturn; @@ -256,13 +248,7 @@ public QueryFirstRequestBuilderImpl( public QueryFirstRequest build() { QueryFirstRequest queryFirstRequest = new QueryFirstRequest( - requestHeader, - view, - noOfNodeTypes, - nodeTypes, - filter, - maxDataSetsToReturn, - maxReferencesToReturn); + requestHeader, view, nodeTypes, filter, maxDataSetsToReturn, maxReferencesToReturn); return queryFirstRequest; } } @@ -278,7 +264,6 @@ public boolean equals(Object o) { QueryFirstRequest that = (QueryFirstRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getView() == that.getView()) - && (getNoOfNodeTypes() == that.getNoOfNodeTypes()) && (getNodeTypes() == that.getNodeTypes()) && (getFilter() == that.getFilter()) && (getMaxDataSetsToReturn() == that.getMaxDataSetsToReturn()) @@ -293,7 +278,6 @@ public int hashCode() { super.hashCode(), getRequestHeader(), getView(), - getNoOfNodeTypes(), getNodeTypes(), getFilter(), getMaxDataSetsToReturn(), diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstResponse.java index 23ce82ab3f1..c04b98b5cd1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryFirstResponse.java @@ -38,52 +38,39 @@ public class QueryFirstResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "618"; + public Integer getExtensionId() { + return (int) 618; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfQueryDataSets; - protected final List queryDataSets; + protected final ResponseHeader responseHeader; + protected final List queryDataSets; protected final PascalByteString continuationPoint; - protected final int noOfParsingResults; - protected final List parsingResults; - protected final int noOfDiagnosticInfos; + protected final List parsingResults; protected final List diagnosticInfos; - protected final ExtensionObjectDefinition filterResult; + protected final ContentFilterResult filterResult; public QueryFirstResponse( - ExtensionObjectDefinition responseHeader, - int noOfQueryDataSets, - List queryDataSets, + ResponseHeader responseHeader, + List queryDataSets, PascalByteString continuationPoint, - int noOfParsingResults, - List parsingResults, - int noOfDiagnosticInfos, + List parsingResults, List diagnosticInfos, - ExtensionObjectDefinition filterResult) { + ContentFilterResult filterResult) { super(); this.responseHeader = responseHeader; - this.noOfQueryDataSets = noOfQueryDataSets; this.queryDataSets = queryDataSets; this.continuationPoint = continuationPoint; - this.noOfParsingResults = noOfParsingResults; this.parsingResults = parsingResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; this.filterResult = filterResult; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfQueryDataSets() { - return noOfQueryDataSets; - } - - public List getQueryDataSets() { + public List getQueryDataSets() { return queryDataSets; } @@ -91,23 +78,15 @@ public PascalByteString getContinuationPoint() { return continuationPoint; } - public int getNoOfParsingResults() { - return noOfParsingResults; - } - - public List getParsingResults() { + public List getParsingResults() { return parsingResults; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } - public ExtensionObjectDefinition getFilterResult() { + public ContentFilterResult getFilterResult() { return filterResult; } @@ -121,8 +100,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfQueryDataSets) - writeSimpleField("noOfQueryDataSets", noOfQueryDataSets, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfQueryDataSets) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfQueryDataSets = + (int) ((((getQueryDataSets()) == (null)) ? -(1) : COUNT(getQueryDataSets()))); + writeImplicitField("noOfQueryDataSets", noOfQueryDataSets, writeSignedInt(writeBuffer, 32)); // Array Field (queryDataSets) writeComplexTypeArrayField("queryDataSets", queryDataSets, writeBuffer); @@ -130,14 +112,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (continuationPoint) writeSimpleField("continuationPoint", continuationPoint, writeComplex(writeBuffer)); - // Simple Field (noOfParsingResults) - writeSimpleField("noOfParsingResults", noOfParsingResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfParsingResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfParsingResults = + (int) ((((getParsingResults()) == (null)) ? -(1) : COUNT(getParsingResults()))); + writeImplicitField("noOfParsingResults", noOfParsingResults, writeSignedInt(writeBuffer, 32)); // Array Field (parsingResults) writeComplexTypeArrayField("parsingResults", parsingResults, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -162,13 +150,13 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfQueryDataSets) + // Implicit Field (noOfQueryDataSets) lengthInBits += 32; // Array field if (queryDataSets != null) { int i = 0; - for (ExtensionObjectDefinition element : queryDataSets) { + for (QueryDataSet element : queryDataSets) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= queryDataSets.size()); lengthInBits += element.getLengthInBits(); } @@ -177,19 +165,19 @@ public int getLengthInBits() { // Simple field (continuationPoint) lengthInBits += continuationPoint.getLengthInBits(); - // Simple field (noOfParsingResults) + // Implicit Field (noOfParsingResults) lengthInBits += 32; // Array field if (parsingResults != null) { int i = 0; - for (ExtensionObjectDefinition element : parsingResults) { + for (ParsingResult element : parsingResults) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= parsingResults.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -208,25 +196,26 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryFirstResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfQueryDataSets = readSimpleField("noOfQueryDataSets", readSignedInt(readBuffer, 32)); + int noOfQueryDataSets = readImplicitField("noOfQueryDataSets", readSignedInt(readBuffer, 32)); - List queryDataSets = + List queryDataSets = readCountArrayField( "queryDataSets", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("579")), + () -> (QueryDataSet) ExtensionObjectDefinition.staticParse(readBuffer, (int) (579)), readBuffer), noOfQueryDataSets); @@ -235,17 +224,19 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "continuationPoint", readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer)); - int noOfParsingResults = readSimpleField("noOfParsingResults", readSignedInt(readBuffer, 32)); + int noOfParsingResults = readImplicitField("noOfParsingResults", readSignedInt(readBuffer, 32)); - List parsingResults = + List parsingResults = readCountArrayField( "parsingResults", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("612")), + () -> + (ParsingResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (612)), readBuffer), noOfParsingResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -253,56 +244,46 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> DiagnosticInfo.staticParse(readBuffer), readBuffer), noOfDiagnosticInfos); - ExtensionObjectDefinition filterResult = + ContentFilterResult filterResult = readSimpleField( "filterResult", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("609")), + () -> + (ContentFilterResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (609)), readBuffer)); readBuffer.closeContext("QueryFirstResponse"); // Create the instance return new QueryFirstResponseBuilderImpl( responseHeader, - noOfQueryDataSets, queryDataSets, continuationPoint, - noOfParsingResults, parsingResults, - noOfDiagnosticInfos, diagnosticInfos, filterResult); } public static class QueryFirstResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfQueryDataSets; - private final List queryDataSets; + private final ResponseHeader responseHeader; + private final List queryDataSets; private final PascalByteString continuationPoint; - private final int noOfParsingResults; - private final List parsingResults; - private final int noOfDiagnosticInfos; + private final List parsingResults; private final List diagnosticInfos; - private final ExtensionObjectDefinition filterResult; + private final ContentFilterResult filterResult; public QueryFirstResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfQueryDataSets, - List queryDataSets, + ResponseHeader responseHeader, + List queryDataSets, PascalByteString continuationPoint, - int noOfParsingResults, - List parsingResults, - int noOfDiagnosticInfos, + List parsingResults, List diagnosticInfos, - ExtensionObjectDefinition filterResult) { + ContentFilterResult filterResult) { this.responseHeader = responseHeader; - this.noOfQueryDataSets = noOfQueryDataSets; this.queryDataSets = queryDataSets; this.continuationPoint = continuationPoint; - this.noOfParsingResults = noOfParsingResults; this.parsingResults = parsingResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; this.filterResult = filterResult; } @@ -311,12 +292,9 @@ public QueryFirstResponse build() { QueryFirstResponse queryFirstResponse = new QueryFirstResponse( responseHeader, - noOfQueryDataSets, queryDataSets, continuationPoint, - noOfParsingResults, parsingResults, - noOfDiagnosticInfos, diagnosticInfos, filterResult); return queryFirstResponse; @@ -333,12 +311,9 @@ public boolean equals(Object o) { } QueryFirstResponse that = (QueryFirstResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfQueryDataSets() == that.getNoOfQueryDataSets()) && (getQueryDataSets() == that.getQueryDataSets()) && (getContinuationPoint() == that.getContinuationPoint()) - && (getNoOfParsingResults() == that.getNoOfParsingResults()) && (getParsingResults() == that.getParsingResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && (getFilterResult() == that.getFilterResult()) && super.equals(that) @@ -350,12 +325,9 @@ public int hashCode() { return Objects.hash( super.hashCode(), getResponseHeader(), - getNoOfQueryDataSets(), getQueryDataSets(), getContinuationPoint(), - getNoOfParsingResults(), getParsingResults(), - getNoOfDiagnosticInfos(), getDiagnosticInfos(), getFilterResult()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextRequest.java index 7651902291e..99a20307e88 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextRequest.java @@ -38,17 +38,17 @@ public class QueryNextRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "621"; + public Integer getExtensionId() { + return (int) 621; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final boolean releaseContinuationPoint; protected final PascalByteString continuationPoint; public QueryNextRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, boolean releaseContinuationPoint, PascalByteString continuationPoint) { super(); @@ -57,7 +57,7 @@ public QueryNextRequest( this.continuationPoint = continuationPoint; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -119,16 +119,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryNextRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); Byte reservedField0 = @@ -150,12 +151,12 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class QueryNextRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final boolean releaseContinuationPoint; private final PascalByteString continuationPoint; public QueryNextRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, boolean releaseContinuationPoint, PascalByteString continuationPoint) { this.requestHeader = requestHeader; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextResponse.java index 824e39c9551..5450c9b3b32 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/QueryNextResponse.java @@ -38,37 +38,30 @@ public class QueryNextResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "624"; + public Integer getExtensionId() { + return (int) 624; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfQueryDataSets; - protected final List queryDataSets; + protected final ResponseHeader responseHeader; + protected final List queryDataSets; protected final PascalByteString revisedContinuationPoint; public QueryNextResponse( - ExtensionObjectDefinition responseHeader, - int noOfQueryDataSets, - List queryDataSets, + ResponseHeader responseHeader, + List queryDataSets, PascalByteString revisedContinuationPoint) { super(); this.responseHeader = responseHeader; - this.noOfQueryDataSets = noOfQueryDataSets; this.queryDataSets = queryDataSets; this.revisedContinuationPoint = revisedContinuationPoint; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfQueryDataSets() { - return noOfQueryDataSets; - } - - public List getQueryDataSets() { + public List getQueryDataSets() { return queryDataSets; } @@ -86,8 +79,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfQueryDataSets) - writeSimpleField("noOfQueryDataSets", noOfQueryDataSets, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfQueryDataSets) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfQueryDataSets = + (int) ((((getQueryDataSets()) == (null)) ? -(1) : COUNT(getQueryDataSets()))); + writeImplicitField("noOfQueryDataSets", noOfQueryDataSets, writeSignedInt(writeBuffer, 32)); // Array Field (queryDataSets) writeComplexTypeArrayField("queryDataSets", queryDataSets, writeBuffer); @@ -113,13 +109,13 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfQueryDataSets) + // Implicit Field (noOfQueryDataSets) lengthInBits += 32; // Array field if (queryDataSets != null) { int i = 0; - for (ExtensionObjectDefinition element : queryDataSets) { + for (QueryDataSet element : queryDataSets) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= queryDataSets.size()); lengthInBits += element.getLengthInBits(); } @@ -132,25 +128,26 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("QueryNextResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfQueryDataSets = readSimpleField("noOfQueryDataSets", readSignedInt(readBuffer, 32)); + int noOfQueryDataSets = readImplicitField("noOfQueryDataSets", readSignedInt(readBuffer, 32)); - List queryDataSets = + List queryDataSets = readCountArrayField( "queryDataSets", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("579")), + () -> (QueryDataSet) ExtensionObjectDefinition.staticParse(readBuffer, (int) (579)), readBuffer), noOfQueryDataSets); @@ -162,31 +159,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("QueryNextResponse"); // Create the instance return new QueryNextResponseBuilderImpl( - responseHeader, noOfQueryDataSets, queryDataSets, revisedContinuationPoint); + responseHeader, queryDataSets, revisedContinuationPoint); } public static class QueryNextResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfQueryDataSets; - private final List queryDataSets; + private final ResponseHeader responseHeader; + private final List queryDataSets; private final PascalByteString revisedContinuationPoint; public QueryNextResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfQueryDataSets, - List queryDataSets, + ResponseHeader responseHeader, + List queryDataSets, PascalByteString revisedContinuationPoint) { this.responseHeader = responseHeader; - this.noOfQueryDataSets = noOfQueryDataSets; this.queryDataSets = queryDataSets; this.revisedContinuationPoint = revisedContinuationPoint; } public QueryNextResponse build() { QueryNextResponse queryNextResponse = - new QueryNextResponse( - responseHeader, noOfQueryDataSets, queryDataSets, revisedContinuationPoint); + new QueryNextResponse(responseHeader, queryDataSets, revisedContinuationPoint); return queryNextResponse; } } @@ -201,7 +194,6 @@ public boolean equals(Object o) { } QueryNextResponse that = (QueryNextResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfQueryDataSets() == that.getNoOfQueryDataSets()) && (getQueryDataSets() == that.getQueryDataSets()) && (getRevisedContinuationPoint() == that.getRevisedContinuationPoint()) && super.equals(that) @@ -211,11 +203,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfQueryDataSets(), - getQueryDataSets(), - getRevisedContinuationPoint()); + super.hashCode(), getResponseHeader(), getQueryDataSets(), getRevisedContinuationPoint()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Range.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Range.java index e6417667d8f..f58077e0cbc 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Range.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Range.java @@ -38,8 +38,8 @@ public class Range extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "886"; + public Integer getExtensionId() { + return (int) 886; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Range"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RationalNumber.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RationalNumber.java index f91f3290b33..ec5e07e8941 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RationalNumber.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RationalNumber.java @@ -38,8 +38,8 @@ public class RationalNumber extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "18808"; + public Integer getExtensionId() { + return (int) 18808; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RationalNumber"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAnnotationDataDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAnnotationDataDetails.java new file mode 100644 index 00000000000..7b0eed7ad88 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAnnotationDataDetails.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadAnnotationDataDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23499; + } + + // Properties. + protected final List reqTimes; + + public ReadAnnotationDataDetails(List reqTimes) { + super(); + this.reqTimes = reqTimes; + } + + public List getReqTimes() { + return reqTimes; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadAnnotationDataDetails"); + + // Implicit Field (noOfReqTimes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReqTimes = (int) ((((getReqTimes()) == (null)) ? -(1) : COUNT(getReqTimes()))); + writeImplicitField("noOfReqTimes", noOfReqTimes, writeSignedInt(writeBuffer, 32)); + + // Array Field (reqTimes) + writeSimpleTypeArrayField("reqTimes", reqTimes, writeSignedLong(writeBuffer, 64)); + + writeBuffer.popContext("ReadAnnotationDataDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadAnnotationDataDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfReqTimes) + lengthInBits += 32; + + // Array field + if (reqTimes != null) { + lengthInBits += 64 * reqTimes.size(); + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadAnnotationDataDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfReqTimes = readImplicitField("noOfReqTimes", readSignedInt(readBuffer, 32)); + + List reqTimes = + readCountArrayField("reqTimes", readSignedLong(readBuffer, 64), noOfReqTimes); + + readBuffer.closeContext("ReadAnnotationDataDetails"); + // Create the instance + return new ReadAnnotationDataDetailsBuilderImpl(reqTimes); + } + + public static class ReadAnnotationDataDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List reqTimes; + + public ReadAnnotationDataDetailsBuilderImpl(List reqTimes) { + this.reqTimes = reqTimes; + } + + public ReadAnnotationDataDetails build() { + ReadAnnotationDataDetails readAnnotationDataDetails = new ReadAnnotationDataDetails(reqTimes); + return readAnnotationDataDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadAnnotationDataDetails)) { + return false; + } + ReadAnnotationDataDetails that = (ReadAnnotationDataDetails) o; + return (getReqTimes() == that.getReqTimes()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getReqTimes()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAtTimeDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAtTimeDetails.java new file mode 100644 index 00000000000..75bbf688f4d --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadAtTimeDetails.java @@ -0,0 +1,182 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadAtTimeDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 655; + } + + // Properties. + protected final List reqTimes; + protected final boolean useSimpleBounds; + + public ReadAtTimeDetails(List reqTimes, boolean useSimpleBounds) { + super(); + this.reqTimes = reqTimes; + this.useSimpleBounds = useSimpleBounds; + } + + public List getReqTimes() { + return reqTimes; + } + + public boolean getUseSimpleBounds() { + return useSimpleBounds; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadAtTimeDetails"); + + // Implicit Field (noOfReqTimes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfReqTimes = (int) ((((getReqTimes()) == (null)) ? -(1) : COUNT(getReqTimes()))); + writeImplicitField("noOfReqTimes", noOfReqTimes, writeSignedInt(writeBuffer, 32)); + + // Array Field (reqTimes) + writeSimpleTypeArrayField("reqTimes", reqTimes, writeSignedLong(writeBuffer, 64)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (useSimpleBounds) + writeSimpleField("useSimpleBounds", useSimpleBounds, writeBoolean(writeBuffer)); + + writeBuffer.popContext("ReadAtTimeDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadAtTimeDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfReqTimes) + lengthInBits += 32; + + // Array field + if (reqTimes != null) { + lengthInBits += 64 * reqTimes.size(); + } + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (useSimpleBounds) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadAtTimeDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfReqTimes = readImplicitField("noOfReqTimes", readSignedInt(readBuffer, 32)); + + List reqTimes = + readCountArrayField("reqTimes", readSignedLong(readBuffer, 64), noOfReqTimes); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean useSimpleBounds = readSimpleField("useSimpleBounds", readBoolean(readBuffer)); + + readBuffer.closeContext("ReadAtTimeDetails"); + // Create the instance + return new ReadAtTimeDetailsBuilderImpl(reqTimes, useSimpleBounds); + } + + public static class ReadAtTimeDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List reqTimes; + private final boolean useSimpleBounds; + + public ReadAtTimeDetailsBuilderImpl(List reqTimes, boolean useSimpleBounds) { + this.reqTimes = reqTimes; + this.useSimpleBounds = useSimpleBounds; + } + + public ReadAtTimeDetails build() { + ReadAtTimeDetails readAtTimeDetails = new ReadAtTimeDetails(reqTimes, useSimpleBounds); + return readAtTimeDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadAtTimeDetails)) { + return false; + } + ReadAtTimeDetails that = (ReadAtTimeDetails) o; + return (getReqTimes() == that.getReqTimes()) + && (getUseSimpleBounds() == that.getUseSimpleBounds()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getReqTimes(), getUseSimpleBounds()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails.java new file mode 100644 index 00000000000..add5dfbe4d6 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails.java @@ -0,0 +1,202 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadEventDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 646; + } + + // Properties. + protected final long numValuesPerNode; + protected final long startTime; + protected final long endTime; + protected final EventFilter filter; + + public ReadEventDetails(long numValuesPerNode, long startTime, long endTime, EventFilter filter) { + super(); + this.numValuesPerNode = numValuesPerNode; + this.startTime = startTime; + this.endTime = endTime; + this.filter = filter; + } + + public long getNumValuesPerNode() { + return numValuesPerNode; + } + + public long getStartTime() { + return startTime; + } + + public long getEndTime() { + return endTime; + } + + public EventFilter getFilter() { + return filter; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadEventDetails"); + + // Simple Field (numValuesPerNode) + writeSimpleField("numValuesPerNode", numValuesPerNode, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (endTime) + writeSimpleField("endTime", endTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (filter) + writeSimpleField("filter", filter, writeComplex(writeBuffer)); + + writeBuffer.popContext("ReadEventDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadEventDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (numValuesPerNode) + lengthInBits += 32; + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (endTime) + lengthInBits += 64; + + // Simple field (filter) + lengthInBits += filter.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadEventDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long numValuesPerNode = readSimpleField("numValuesPerNode", readUnsignedLong(readBuffer, 32)); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + long endTime = readSimpleField("endTime", readSignedLong(readBuffer, 64)); + + EventFilter filter = + readSimpleField( + "filter", + readComplex( + () -> (EventFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (727)), + readBuffer)); + + readBuffer.closeContext("ReadEventDetails"); + // Create the instance + return new ReadEventDetailsBuilderImpl(numValuesPerNode, startTime, endTime, filter); + } + + public static class ReadEventDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long numValuesPerNode; + private final long startTime; + private final long endTime; + private final EventFilter filter; + + public ReadEventDetailsBuilderImpl( + long numValuesPerNode, long startTime, long endTime, EventFilter filter) { + this.numValuesPerNode = numValuesPerNode; + this.startTime = startTime; + this.endTime = endTime; + this.filter = filter; + } + + public ReadEventDetails build() { + ReadEventDetails readEventDetails = + new ReadEventDetails(numValuesPerNode, startTime, endTime, filter); + return readEventDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadEventDetails)) { + return false; + } + ReadEventDetails that = (ReadEventDetails) o; + return (getNumValuesPerNode() == that.getNumValuesPerNode()) + && (getStartTime() == that.getStartTime()) + && (getEndTime() == that.getEndTime()) + && (getFilter() == that.getFilter()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNumValuesPerNode(), getStartTime(), getEndTime(), getFilter()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails2.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails2.java new file mode 100644 index 00000000000..b3f80d44bf0 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadEventDetails2.java @@ -0,0 +1,243 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadEventDetails2 extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 32801; + } + + // Properties. + protected final long numValuesPerNode; + protected final long startTime; + protected final long endTime; + protected final EventFilter filter; + protected final boolean readModified; + + public ReadEventDetails2( + long numValuesPerNode, + long startTime, + long endTime, + EventFilter filter, + boolean readModified) { + super(); + this.numValuesPerNode = numValuesPerNode; + this.startTime = startTime; + this.endTime = endTime; + this.filter = filter; + this.readModified = readModified; + } + + public long getNumValuesPerNode() { + return numValuesPerNode; + } + + public long getStartTime() { + return startTime; + } + + public long getEndTime() { + return endTime; + } + + public EventFilter getFilter() { + return filter; + } + + public boolean getReadModified() { + return readModified; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadEventDetails2"); + + // Simple Field (numValuesPerNode) + writeSimpleField("numValuesPerNode", numValuesPerNode, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (endTime) + writeSimpleField("endTime", endTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (filter) + writeSimpleField("filter", filter, writeComplex(writeBuffer)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (readModified) + writeSimpleField("readModified", readModified, writeBoolean(writeBuffer)); + + writeBuffer.popContext("ReadEventDetails2"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadEventDetails2 _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (numValuesPerNode) + lengthInBits += 32; + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (endTime) + lengthInBits += 64; + + // Simple field (filter) + lengthInBits += filter.getLengthInBits(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (readModified) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadEventDetails2"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long numValuesPerNode = readSimpleField("numValuesPerNode", readUnsignedLong(readBuffer, 32)); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + long endTime = readSimpleField("endTime", readSignedLong(readBuffer, 64)); + + EventFilter filter = + readSimpleField( + "filter", + readComplex( + () -> (EventFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (727)), + readBuffer)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean readModified = readSimpleField("readModified", readBoolean(readBuffer)); + + readBuffer.closeContext("ReadEventDetails2"); + // Create the instance + return new ReadEventDetails2BuilderImpl( + numValuesPerNode, startTime, endTime, filter, readModified); + } + + public static class ReadEventDetails2BuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long numValuesPerNode; + private final long startTime; + private final long endTime; + private final EventFilter filter; + private final boolean readModified; + + public ReadEventDetails2BuilderImpl( + long numValuesPerNode, + long startTime, + long endTime, + EventFilter filter, + boolean readModified) { + this.numValuesPerNode = numValuesPerNode; + this.startTime = startTime; + this.endTime = endTime; + this.filter = filter; + this.readModified = readModified; + } + + public ReadEventDetails2 build() { + ReadEventDetails2 readEventDetails2 = + new ReadEventDetails2(numValuesPerNode, startTime, endTime, filter, readModified); + return readEventDetails2; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadEventDetails2)) { + return false; + } + ReadEventDetails2 that = (ReadEventDetails2) o; + return (getNumValuesPerNode() == that.getNumValuesPerNode()) + && (getStartTime() == that.getStartTime()) + && (getEndTime() == that.getEndTime()) + && (getFilter() == that.getFilter()) + && (getReadModified() == that.getReadModified()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getNumValuesPerNode(), + getStartTime(), + getEndTime(), + getFilter(), + getReadModified()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadProcessedDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadProcessedDetails.java new file mode 100644 index 00000000000..395976f9820 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadProcessedDetails.java @@ -0,0 +1,258 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadProcessedDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 652; + } + + // Properties. + protected final long startTime; + protected final long endTime; + protected final double processingInterval; + protected final List aggregateType; + protected final AggregateConfiguration aggregateConfiguration; + + public ReadProcessedDetails( + long startTime, + long endTime, + double processingInterval, + List aggregateType, + AggregateConfiguration aggregateConfiguration) { + super(); + this.startTime = startTime; + this.endTime = endTime; + this.processingInterval = processingInterval; + this.aggregateType = aggregateType; + this.aggregateConfiguration = aggregateConfiguration; + } + + public long getStartTime() { + return startTime; + } + + public long getEndTime() { + return endTime; + } + + public double getProcessingInterval() { + return processingInterval; + } + + public List getAggregateType() { + return aggregateType; + } + + public AggregateConfiguration getAggregateConfiguration() { + return aggregateConfiguration; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadProcessedDetails"); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (endTime) + writeSimpleField("endTime", endTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (processingInterval) + writeSimpleField("processingInterval", processingInterval, writeDouble(writeBuffer, 64)); + + // Implicit Field (noOfAggregateType) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfAggregateType = + (int) ((((getAggregateType()) == (null)) ? -(1) : COUNT(getAggregateType()))); + writeImplicitField("noOfAggregateType", noOfAggregateType, writeSignedInt(writeBuffer, 32)); + + // Array Field (aggregateType) + writeComplexTypeArrayField("aggregateType", aggregateType, writeBuffer); + + // Simple Field (aggregateConfiguration) + writeSimpleField("aggregateConfiguration", aggregateConfiguration, writeComplex(writeBuffer)); + + writeBuffer.popContext("ReadProcessedDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadProcessedDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (endTime) + lengthInBits += 64; + + // Simple field (processingInterval) + lengthInBits += 64; + + // Implicit Field (noOfAggregateType) + lengthInBits += 32; + + // Array field + if (aggregateType != null) { + int i = 0; + for (NodeId element : aggregateType) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= aggregateType.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (aggregateConfiguration) + lengthInBits += aggregateConfiguration.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadProcessedDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + long endTime = readSimpleField("endTime", readSignedLong(readBuffer, 64)); + + double processingInterval = readSimpleField("processingInterval", readDouble(readBuffer, 64)); + + int noOfAggregateType = readImplicitField("noOfAggregateType", readSignedInt(readBuffer, 32)); + + List aggregateType = + readCountArrayField( + "aggregateType", + readComplex(() -> NodeId.staticParse(readBuffer), readBuffer), + noOfAggregateType); + + AggregateConfiguration aggregateConfiguration = + readSimpleField( + "aggregateConfiguration", + readComplex( + () -> + (AggregateConfiguration) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (950)), + readBuffer)); + + readBuffer.closeContext("ReadProcessedDetails"); + // Create the instance + return new ReadProcessedDetailsBuilderImpl( + startTime, endTime, processingInterval, aggregateType, aggregateConfiguration); + } + + public static class ReadProcessedDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long startTime; + private final long endTime; + private final double processingInterval; + private final List aggregateType; + private final AggregateConfiguration aggregateConfiguration; + + public ReadProcessedDetailsBuilderImpl( + long startTime, + long endTime, + double processingInterval, + List aggregateType, + AggregateConfiguration aggregateConfiguration) { + this.startTime = startTime; + this.endTime = endTime; + this.processingInterval = processingInterval; + this.aggregateType = aggregateType; + this.aggregateConfiguration = aggregateConfiguration; + } + + public ReadProcessedDetails build() { + ReadProcessedDetails readProcessedDetails = + new ReadProcessedDetails( + startTime, endTime, processingInterval, aggregateType, aggregateConfiguration); + return readProcessedDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadProcessedDetails)) { + return false; + } + ReadProcessedDetails that = (ReadProcessedDetails) o; + return (getStartTime() == that.getStartTime()) + && (getEndTime() == that.getEndTime()) + && (getProcessingInterval() == that.getProcessingInterval()) + && (getAggregateType() == that.getAggregateType()) + && (getAggregateConfiguration() == that.getAggregateConfiguration()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getStartTime(), + getEndTime(), + getProcessingInterval(), + getAggregateType(), + getAggregateConfiguration()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRawModifiedDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRawModifiedDetails.java new file mode 100644 index 00000000000..060af402dd9 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRawModifiedDetails.java @@ -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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReadRawModifiedDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 649; + } + + // Properties. + protected final boolean isReadModified; + protected final long startTime; + protected final long endTime; + protected final long numValuesPerNode; + protected final boolean returnBounds; + + public ReadRawModifiedDetails( + boolean isReadModified, + long startTime, + long endTime, + long numValuesPerNode, + boolean returnBounds) { + super(); + this.isReadModified = isReadModified; + this.startTime = startTime; + this.endTime = endTime; + this.numValuesPerNode = numValuesPerNode; + this.returnBounds = returnBounds; + } + + public boolean getIsReadModified() { + return isReadModified; + } + + public long getStartTime() { + return startTime; + } + + public long getEndTime() { + return endTime; + } + + public long getNumValuesPerNode() { + return numValuesPerNode; + } + + public boolean getReturnBounds() { + return returnBounds; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReadRawModifiedDetails"); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (isReadModified) + writeSimpleField("isReadModified", isReadModified, writeBoolean(writeBuffer)); + + // Simple Field (startTime) + writeSimpleField("startTime", startTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (endTime) + writeSimpleField("endTime", endTime, writeSignedLong(writeBuffer, 64)); + + // Simple Field (numValuesPerNode) + writeSimpleField("numValuesPerNode", numValuesPerNode, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (returnBounds) + writeSimpleField("returnBounds", returnBounds, writeBoolean(writeBuffer)); + + writeBuffer.popContext("ReadRawModifiedDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReadRawModifiedDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (isReadModified) + lengthInBits += 1; + + // Simple field (startTime) + lengthInBits += 64; + + // Simple field (endTime) + lengthInBits += 64; + + // Simple field (numValuesPerNode) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (returnBounds) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReadRawModifiedDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean isReadModified = readSimpleField("isReadModified", readBoolean(readBuffer)); + + long startTime = readSimpleField("startTime", readSignedLong(readBuffer, 64)); + + long endTime = readSimpleField("endTime", readSignedLong(readBuffer, 64)); + + long numValuesPerNode = readSimpleField("numValuesPerNode", readUnsignedLong(readBuffer, 32)); + + Byte reservedField1 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean returnBounds = readSimpleField("returnBounds", readBoolean(readBuffer)); + + readBuffer.closeContext("ReadRawModifiedDetails"); + // Create the instance + return new ReadRawModifiedDetailsBuilderImpl( + isReadModified, startTime, endTime, numValuesPerNode, returnBounds); + } + + public static class ReadRawModifiedDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final boolean isReadModified; + private final long startTime; + private final long endTime; + private final long numValuesPerNode; + private final boolean returnBounds; + + public ReadRawModifiedDetailsBuilderImpl( + boolean isReadModified, + long startTime, + long endTime, + long numValuesPerNode, + boolean returnBounds) { + this.isReadModified = isReadModified; + this.startTime = startTime; + this.endTime = endTime; + this.numValuesPerNode = numValuesPerNode; + this.returnBounds = returnBounds; + } + + public ReadRawModifiedDetails build() { + ReadRawModifiedDetails readRawModifiedDetails = + new ReadRawModifiedDetails( + isReadModified, startTime, endTime, numValuesPerNode, returnBounds); + return readRawModifiedDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReadRawModifiedDetails)) { + return false; + } + ReadRawModifiedDetails that = (ReadRawModifiedDetails) o; + return (getIsReadModified() == that.getIsReadModified()) + && (getStartTime() == that.getStartTime()) + && (getEndTime() == that.getEndTime()) + && (getNumValuesPerNode() == that.getNumValuesPerNode()) + && (getReturnBounds() == that.getReturnBounds()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getIsReadModified(), + getStartTime(), + getEndTime(), + getNumValuesPerNode(), + getReturnBounds()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRequest.java index e80587fb5fa..ded54c04fd5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadRequest.java @@ -38,32 +38,29 @@ public class ReadRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "631"; + public Integer getExtensionId() { + return (int) 631; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final double maxAge; protected final TimestampsToReturn timestampsToReturn; - protected final int noOfNodesToRead; - protected final List nodesToRead; + protected final List nodesToRead; public ReadRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, double maxAge, TimestampsToReturn timestampsToReturn, - int noOfNodesToRead, - List nodesToRead) { + List nodesToRead) { super(); this.requestHeader = requestHeader; this.maxAge = maxAge; this.timestampsToReturn = timestampsToReturn; - this.noOfNodesToRead = noOfNodesToRead; this.nodesToRead = nodesToRead; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -75,11 +72,7 @@ public TimestampsToReturn getTimestampsToReturn() { return timestampsToReturn; } - public int getNoOfNodesToRead() { - return noOfNodesToRead; - } - - public List getNodesToRead() { + public List getNodesToRead() { return nodesToRead; } @@ -106,8 +99,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) TimestampsToReturn::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfNodesToRead) - writeSimpleField("noOfNodesToRead", noOfNodesToRead, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToRead) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToRead = (int) ((((getNodesToRead()) == (null)) ? -(1) : COUNT(getNodesToRead()))); + writeImplicitField("noOfNodesToRead", noOfNodesToRead, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToRead) writeComplexTypeArrayField("nodesToRead", nodesToRead, writeBuffer); @@ -135,13 +130,13 @@ public int getLengthInBits() { // Simple field (timestampsToReturn) lengthInBits += 32; - // Simple field (noOfNodesToRead) + // Implicit Field (noOfNodesToRead) lengthInBits += 32; // Array field if (nodesToRead != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToRead) { + for (ReadValueId element : nodesToRead) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToRead.size()); lengthInBits += element.getLengthInBits(); } @@ -151,16 +146,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReadRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); double maxAge = readSimpleField("maxAge", readDouble(readBuffer, 64)); @@ -171,46 +167,42 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "TimestampsToReturn", readEnum(TimestampsToReturn::enumForValue, readUnsignedLong(readBuffer, 32))); - int noOfNodesToRead = readSimpleField("noOfNodesToRead", readSignedInt(readBuffer, 32)); + int noOfNodesToRead = readImplicitField("noOfNodesToRead", readSignedInt(readBuffer, 32)); - List nodesToRead = + List nodesToRead = readCountArrayField( "nodesToRead", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("628")), + () -> (ReadValueId) ExtensionObjectDefinition.staticParse(readBuffer, (int) (628)), readBuffer), noOfNodesToRead); readBuffer.closeContext("ReadRequest"); // Create the instance - return new ReadRequestBuilderImpl( - requestHeader, maxAge, timestampsToReturn, noOfNodesToRead, nodesToRead); + return new ReadRequestBuilderImpl(requestHeader, maxAge, timestampsToReturn, nodesToRead); } public static class ReadRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final double maxAge; private final TimestampsToReturn timestampsToReturn; - private final int noOfNodesToRead; - private final List nodesToRead; + private final List nodesToRead; public ReadRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, double maxAge, TimestampsToReturn timestampsToReturn, - int noOfNodesToRead, - List nodesToRead) { + List nodesToRead) { this.requestHeader = requestHeader; this.maxAge = maxAge; this.timestampsToReturn = timestampsToReturn; - this.noOfNodesToRead = noOfNodesToRead; this.nodesToRead = nodesToRead; } public ReadRequest build() { ReadRequest readRequest = - new ReadRequest(requestHeader, maxAge, timestampsToReturn, noOfNodesToRead, nodesToRead); + new ReadRequest(requestHeader, maxAge, timestampsToReturn, nodesToRead); return readRequest; } } @@ -227,7 +219,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getMaxAge() == that.getMaxAge()) && (getTimestampsToReturn() == that.getTimestampsToReturn()) - && (getNoOfNodesToRead() == that.getNoOfNodesToRead()) && (getNodesToRead() == that.getNodesToRead()) && super.equals(that) && true; @@ -240,7 +231,6 @@ public int hashCode() { getRequestHeader(), getMaxAge(), getTimestampsToReturn(), - getNoOfNodesToRead(), getNodesToRead()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadResponse.java index d22bf34131e..2bbe1dab776 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadResponse.java @@ -38,47 +38,33 @@ public class ReadResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "634"; + public Integer getExtensionId() { + return (int) 634; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public ReadResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReadResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> DataValue.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,26 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ReadResponse"); // Create the instance - return new ReadResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new ReadResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class ReadResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public ReadResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public ReadResponse build() { - ReadResponse readResponse = - new ReadResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + ReadResponse readResponse = new ReadResponse(responseHeader, results, diagnosticInfos); return readResponse; } } @@ -223,9 +207,7 @@ public boolean equals(Object o) { } ReadResponse that = (ReadResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +215,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadValueId.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadValueId.java index d33fd688eab..e716fa98449 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadValueId.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReadValueId.java @@ -38,8 +38,8 @@ public class ReadValueId extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "628"; + public Integer getExtensionId() { + return (int) 628; } // Properties. @@ -122,7 +122,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReadValueId"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupDataType.java new file mode 100644 index 00000000000..3134ec8bae6 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupDataType.java @@ -0,0 +1,459 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReaderGroupDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15522; + } + + // Properties. + protected final PascalString name; + protected final boolean enabled; + protected final MessageSecurityMode securityMode; + protected final PascalString securityGroupId; + protected final List securityKeyServices; + protected final long maxNetworkMessageSize; + protected final List groupProperties; + protected final ExtensionObject transportSettings; + protected final ExtensionObject messageSettings; + protected final List dataSetReaders; + + public ReaderGroupDataType( + PascalString name, + boolean enabled, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + long maxNetworkMessageSize, + List groupProperties, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + List dataSetReaders) { + super(); + this.name = name; + this.enabled = enabled; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.maxNetworkMessageSize = maxNetworkMessageSize; + this.groupProperties = groupProperties; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.dataSetReaders = dataSetReaders; + } + + public PascalString getName() { + return name; + } + + public boolean getEnabled() { + return enabled; + } + + public MessageSecurityMode getSecurityMode() { + return securityMode; + } + + public PascalString getSecurityGroupId() { + return securityGroupId; + } + + public List getSecurityKeyServices() { + return securityKeyServices; + } + + public long getMaxNetworkMessageSize() { + return maxNetworkMessageSize; + } + + public List getGroupProperties() { + return groupProperties; + } + + public ExtensionObject getTransportSettings() { + return transportSettings; + } + + public ExtensionObject getMessageSettings() { + return messageSettings; + } + + public List getDataSetReaders() { + return dataSetReaders; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReaderGroupDataType"); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (enabled) + writeSimpleField("enabled", enabled, writeBoolean(writeBuffer)); + + // Simple Field (securityMode) + writeSimpleEnumField( + "securityMode", + "MessageSecurityMode", + securityMode, + writeEnum( + MessageSecurityMode::getValue, + MessageSecurityMode::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (securityGroupId) + writeSimpleField("securityGroupId", securityGroupId, writeComplex(writeBuffer)); + + // Implicit Field (noOfSecurityKeyServices) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSecurityKeyServices = + (int) ((((getSecurityKeyServices()) == (null)) ? -(1) : COUNT(getSecurityKeyServices()))); + writeImplicitField( + "noOfSecurityKeyServices", noOfSecurityKeyServices, writeSignedInt(writeBuffer, 32)); + + // Array Field (securityKeyServices) + writeComplexTypeArrayField("securityKeyServices", securityKeyServices, writeBuffer); + + // Simple Field (maxNetworkMessageSize) + writeSimpleField( + "maxNetworkMessageSize", maxNetworkMessageSize, writeUnsignedLong(writeBuffer, 32)); + + // Implicit Field (noOfGroupProperties) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfGroupProperties = + (int) ((((getGroupProperties()) == (null)) ? -(1) : COUNT(getGroupProperties()))); + writeImplicitField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); + + // Array Field (groupProperties) + writeComplexTypeArrayField("groupProperties", groupProperties, writeBuffer); + + // Simple Field (transportSettings) + writeSimpleField("transportSettings", transportSettings, writeComplex(writeBuffer)); + + // Simple Field (messageSettings) + writeSimpleField("messageSettings", messageSettings, writeComplex(writeBuffer)); + + // Implicit Field (noOfDataSetReaders) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataSetReaders = + (int) ((((getDataSetReaders()) == (null)) ? -(1) : COUNT(getDataSetReaders()))); + writeImplicitField("noOfDataSetReaders", noOfDataSetReaders, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetReaders) + writeComplexTypeArrayField("dataSetReaders", dataSetReaders, writeBuffer); + + writeBuffer.popContext("ReaderGroupDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReaderGroupDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (enabled) + lengthInBits += 1; + + // Simple field (securityMode) + lengthInBits += 32; + + // Simple field (securityGroupId) + lengthInBits += securityGroupId.getLengthInBits(); + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32; + + // Array field + if (securityKeyServices != null) { + int i = 0; + for (EndpointDescription element : securityKeyServices) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= securityKeyServices.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (maxNetworkMessageSize) + lengthInBits += 32; + + // Implicit Field (noOfGroupProperties) + lengthInBits += 32; + + // Array field + if (groupProperties != null) { + int i = 0; + for (KeyValuePair element : groupProperties) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= groupProperties.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (transportSettings) + lengthInBits += transportSettings.getLengthInBits(); + + // Simple field (messageSettings) + lengthInBits += messageSettings.getLengthInBits(); + + // Implicit Field (noOfDataSetReaders) + lengthInBits += 32; + + // Array field + if (dataSetReaders != null) { + int i = 0; + for (DataSetReaderDataType element : dataSetReaders) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetReaders.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReaderGroupDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean enabled = readSimpleField("enabled", readBoolean(readBuffer)); + + MessageSecurityMode securityMode = + readEnumField( + "securityMode", + "MessageSecurityMode", + readEnum(MessageSecurityMode::enumForValue, readUnsignedLong(readBuffer, 32))); + + PascalString securityGroupId = + readSimpleField( + "securityGroupId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfSecurityKeyServices = + readImplicitField("noOfSecurityKeyServices", readSignedInt(readBuffer, 32)); + + List securityKeyServices = + readCountArrayField( + "securityKeyServices", + readComplex( + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), + readBuffer), + noOfSecurityKeyServices); + + long maxNetworkMessageSize = + readSimpleField("maxNetworkMessageSize", readUnsignedLong(readBuffer, 32)); + + int noOfGroupProperties = + readImplicitField("noOfGroupProperties", readSignedInt(readBuffer, 32)); + + List groupProperties = + readCountArrayField( + "groupProperties", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfGroupProperties); + + ExtensionObject transportSettings = + readSimpleField( + "transportSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + ExtensionObject messageSettings = + readSimpleField( + "messageSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + int noOfDataSetReaders = readImplicitField("noOfDataSetReaders", readSignedInt(readBuffer, 32)); + + List dataSetReaders = + readCountArrayField( + "dataSetReaders", + readComplex( + () -> + (DataSetReaderDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15625)), + readBuffer), + noOfDataSetReaders); + + readBuffer.closeContext("ReaderGroupDataType"); + // Create the instance + return new ReaderGroupDataTypeBuilderImpl( + name, + enabled, + securityMode, + securityGroupId, + securityKeyServices, + maxNetworkMessageSize, + groupProperties, + transportSettings, + messageSettings, + dataSetReaders); + } + + public static class ReaderGroupDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString name; + private final boolean enabled; + private final MessageSecurityMode securityMode; + private final PascalString securityGroupId; + private final List securityKeyServices; + private final long maxNetworkMessageSize; + private final List groupProperties; + private final ExtensionObject transportSettings; + private final ExtensionObject messageSettings; + private final List dataSetReaders; + + public ReaderGroupDataTypeBuilderImpl( + PascalString name, + boolean enabled, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + long maxNetworkMessageSize, + List groupProperties, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + List dataSetReaders) { + this.name = name; + this.enabled = enabled; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.maxNetworkMessageSize = maxNetworkMessageSize; + this.groupProperties = groupProperties; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.dataSetReaders = dataSetReaders; + } + + public ReaderGroupDataType build() { + ReaderGroupDataType readerGroupDataType = + new ReaderGroupDataType( + name, + enabled, + securityMode, + securityGroupId, + securityKeyServices, + maxNetworkMessageSize, + groupProperties, + transportSettings, + messageSettings, + dataSetReaders); + return readerGroupDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReaderGroupDataType)) { + return false; + } + ReaderGroupDataType that = (ReaderGroupDataType) o; + return (getName() == that.getName()) + && (getEnabled() == that.getEnabled()) + && (getSecurityMode() == that.getSecurityMode()) + && (getSecurityGroupId() == that.getSecurityGroupId()) + && (getSecurityKeyServices() == that.getSecurityKeyServices()) + && (getMaxNetworkMessageSize() == that.getMaxNetworkMessageSize()) + && (getGroupProperties() == that.getGroupProperties()) + && (getTransportSettings() == that.getTransportSettings()) + && (getMessageSettings() == that.getMessageSettings()) + && (getDataSetReaders() == that.getDataSetReaders()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getName(), + getEnabled(), + getSecurityMode(), + getSecurityGroupId(), + getSecurityKeyServices(), + getMaxNetworkMessageSize(), + getGroupProperties(), + getTransportSettings(), + getMessageSettings(), + getDataSetReaders()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupMessageDataType.java index 66419a3bfbb..8c80cdcd678 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupMessageDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupMessageDataType.java @@ -38,8 +38,8 @@ public class ReaderGroupMessageDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15624"; + public Integer getExtensionId() { + return (int) 15624; } public ReaderGroupMessageDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReaderGroupMessageDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupTransportDataType.java index 828505bc5b8..b4345803a9d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupTransportDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReaderGroupTransportDataType.java @@ -38,8 +38,8 @@ public class ReaderGroupTransportDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15623"; + public Integer getExtensionId() { + return (int) 15623; } public ReaderGroupTransportDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReaderGroupTransportDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosDataType.java new file mode 100644 index 00000000000..b6fb3f4120f --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosDataType.java @@ -0,0 +1,122 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReceiveQosDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23610; + } + + public ReceiveQosDataType() { + super(); + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReceiveQosDataType"); + + writeBuffer.popContext("ReceiveQosDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReceiveQosDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReceiveQosDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + readBuffer.closeContext("ReceiveQosDataType"); + // Create the instance + return new ReceiveQosDataTypeBuilderImpl(); + } + + public static class ReceiveQosDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + + public ReceiveQosDataTypeBuilderImpl() {} + + public ReceiveQosDataType build() { + ReceiveQosDataType receiveQosDataType = new ReceiveQosDataType(); + return receiveQosDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReceiveQosDataType)) { + return false; + } + ReceiveQosDataType that = (ReceiveQosDataType) o; + return super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosPriorityDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosPriorityDataType.java new file mode 100644 index 00000000000..7dd716b64b5 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReceiveQosPriorityDataType.java @@ -0,0 +1,144 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReceiveQosPriorityDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23611; + } + + // Properties. + protected final PascalString priorityLabel; + + public ReceiveQosPriorityDataType(PascalString priorityLabel) { + super(); + this.priorityLabel = priorityLabel; + } + + public PascalString getPriorityLabel() { + return priorityLabel; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReceiveQosPriorityDataType"); + + // Simple Field (priorityLabel) + writeSimpleField("priorityLabel", priorityLabel, writeComplex(writeBuffer)); + + writeBuffer.popContext("ReceiveQosPriorityDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReceiveQosPriorityDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (priorityLabel) + lengthInBits += priorityLabel.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReceiveQosPriorityDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString priorityLabel = + readSimpleField( + "priorityLabel", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("ReceiveQosPriorityDataType"); + // Create the instance + return new ReceiveQosPriorityDataTypeBuilderImpl(priorityLabel); + } + + public static class ReceiveQosPriorityDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString priorityLabel; + + public ReceiveQosPriorityDataTypeBuilderImpl(PascalString priorityLabel) { + this.priorityLabel = priorityLabel; + } + + public ReceiveQosPriorityDataType build() { + ReceiveQosPriorityDataType receiveQosPriorityDataType = + new ReceiveQosPriorityDataType(priorityLabel); + return receiveQosPriorityDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReceiveQosPriorityDataType)) { + return false; + } + ReceiveQosPriorityDataType that = (ReceiveQosPriorityDataType) o; + return (getPriorityLabel() == that.getPriorityLabel()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getPriorityLabel()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RedundantServerDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RedundantServerDataType.java index fd54c2892ad..c1a87ed2e0f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RedundantServerDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RedundantServerDataType.java @@ -38,8 +38,8 @@ public class RedundantServerDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "855"; + public Integer getExtensionId() { + return (int) 855; } // Properties. @@ -114,7 +114,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RedundantServerDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescription.java index cc9e837a402..ac167dd3771 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescription.java @@ -38,8 +38,8 @@ public class ReferenceDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "520"; + public Integer getExtensionId() { + return (int) 520; } // Properties. @@ -174,7 +174,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReferenceDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescriptionDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescriptionDataType.java index a75b4c50316..74c496f4934 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescriptionDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceDescriptionDataType.java @@ -38,8 +38,8 @@ public class ReferenceDescriptionDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32661"; + public Integer getExtensionId() { + return (int) 32661; } // Properties. @@ -128,7 +128,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReferenceDescriptionDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceListEntryDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceListEntryDataType.java index 9ccba451a44..665f8375746 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceListEntryDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceListEntryDataType.java @@ -38,8 +38,8 @@ public class ReferenceListEntryDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32662"; + public Integer getExtensionId() { + return (int) 32662; } // Properties. @@ -116,7 +116,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ReferenceListEntryDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceTypeAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceTypeAttributes.java new file mode 100644 index 00000000000..b84747686a7 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ReferenceTypeAttributes.java @@ -0,0 +1,321 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ReferenceTypeAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 369; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final boolean symmetric; + protected final boolean isAbstract; + protected final LocalizedText inverseName; + + public ReferenceTypeAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean symmetric, + boolean isAbstract, + LocalizedText inverseName) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.symmetric = symmetric; + this.isAbstract = isAbstract; + this.inverseName = inverseName; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public boolean getSymmetric() { + return symmetric; + } + + public boolean getIsAbstract() { + return isAbstract; + } + + public LocalizedText getInverseName() { + return inverseName; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ReferenceTypeAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 6)); + + // Simple Field (symmetric) + writeSimpleField("symmetric", symmetric, writeBoolean(writeBuffer)); + + // Simple Field (isAbstract) + writeSimpleField("isAbstract", isAbstract, writeBoolean(writeBuffer)); + + // Simple Field (inverseName) + writeSimpleField("inverseName", inverseName, writeComplex(writeBuffer)); + + writeBuffer.popContext("ReferenceTypeAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ReferenceTypeAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 6; + + // Simple field (symmetric) + lengthInBits += 1; + + // Simple field (isAbstract) + lengthInBits += 1; + + // Simple field (inverseName) + lengthInBits += inverseName.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ReferenceTypeAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 6), (byte) 0x00); + + boolean symmetric = readSimpleField("symmetric", readBoolean(readBuffer)); + + boolean isAbstract = readSimpleField("isAbstract", readBoolean(readBuffer)); + + LocalizedText inverseName = + readSimpleField( + "inverseName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("ReferenceTypeAttributes"); + // Create the instance + return new ReferenceTypeAttributesBuilderImpl( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + symmetric, + isAbstract, + inverseName); + } + + public static class ReferenceTypeAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final boolean symmetric; + private final boolean isAbstract; + private final LocalizedText inverseName; + + public ReferenceTypeAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean symmetric, + boolean isAbstract, + LocalizedText inverseName) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.symmetric = symmetric; + this.isAbstract = isAbstract; + this.inverseName = inverseName; + } + + public ReferenceTypeAttributes build() { + ReferenceTypeAttributes referenceTypeAttributes = + new ReferenceTypeAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + symmetric, + isAbstract, + inverseName); + return referenceTypeAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ReferenceTypeAttributes)) { + return false; + } + ReferenceTypeAttributes that = (ReferenceTypeAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getSymmetric() == that.getSymmetric()) + && (getIsAbstract() == that.getIsAbstract()) + && (getInverseName() == that.getInverseName()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getSymmetric(), + getIsAbstract(), + getInverseName()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesRequest.java index 54cda1fcf72..66165451564 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesRequest.java @@ -38,33 +38,24 @@ public class RegisterNodesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "560"; + public Integer getExtensionId() { + return (int) 560; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfNodesToRegister; + protected final RequestHeader requestHeader; protected final List nodesToRegister; - public RegisterNodesRequest( - ExtensionObjectDefinition requestHeader, - int noOfNodesToRegister, - List nodesToRegister) { + public RegisterNodesRequest(RequestHeader requestHeader, List nodesToRegister) { super(); this.requestHeader = requestHeader; - this.noOfNodesToRegister = noOfNodesToRegister; this.nodesToRegister = nodesToRegister; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfNodesToRegister() { - return noOfNodesToRegister; - } - public List getNodesToRegister() { return nodesToRegister; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfNodesToRegister) - writeSimpleField("noOfNodesToRegister", noOfNodesToRegister, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToRegister) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToRegister = + (int) ((((getNodesToRegister()) == (null)) ? -(1) : COUNT(getNodesToRegister()))); + writeImplicitField("noOfNodesToRegister", noOfNodesToRegister, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToRegister) writeComplexTypeArrayField("nodesToRegister", nodesToRegister, writeBuffer); @@ -102,7 +96,7 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfNodesToRegister) + // Implicit Field (noOfNodesToRegister) lengthInBits += 32; // Array field @@ -118,19 +112,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterNodesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfNodesToRegister = readSimpleField("noOfNodesToRegister", readSignedInt(readBuffer, 32)); + int noOfNodesToRegister = + readImplicitField("noOfNodesToRegister", readSignedInt(readBuffer, 32)); List nodesToRegister = readCountArrayField( @@ -140,27 +136,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("RegisterNodesRequest"); // Create the instance - return new RegisterNodesRequestBuilderImpl(requestHeader, noOfNodesToRegister, nodesToRegister); + return new RegisterNodesRequestBuilderImpl(requestHeader, nodesToRegister); } public static class RegisterNodesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfNodesToRegister; + private final RequestHeader requestHeader; private final List nodesToRegister; public RegisterNodesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfNodesToRegister, - List nodesToRegister) { + RequestHeader requestHeader, List nodesToRegister) { this.requestHeader = requestHeader; - this.noOfNodesToRegister = noOfNodesToRegister; this.nodesToRegister = nodesToRegister; } public RegisterNodesRequest build() { RegisterNodesRequest registerNodesRequest = - new RegisterNodesRequest(requestHeader, noOfNodesToRegister, nodesToRegister); + new RegisterNodesRequest(requestHeader, nodesToRegister); return registerNodesRequest; } } @@ -175,7 +167,6 @@ public boolean equals(Object o) { } RegisterNodesRequest that = (RegisterNodesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfNodesToRegister() == that.getNoOfNodesToRegister()) && (getNodesToRegister() == that.getNodesToRegister()) && super.equals(that) && true; @@ -183,8 +174,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfNodesToRegister(), getNodesToRegister()); + return Objects.hash(super.hashCode(), getRequestHeader(), getNodesToRegister()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesResponse.java index b87872c1ae8..9b80cadcdf1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterNodesResponse.java @@ -38,33 +38,24 @@ public class RegisterNodesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "563"; + public Integer getExtensionId() { + return (int) 563; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfRegisteredNodeIds; + protected final ResponseHeader responseHeader; protected final List registeredNodeIds; - public RegisterNodesResponse( - ExtensionObjectDefinition responseHeader, - int noOfRegisteredNodeIds, - List registeredNodeIds) { + public RegisterNodesResponse(ResponseHeader responseHeader, List registeredNodeIds) { super(); this.responseHeader = responseHeader; - this.noOfRegisteredNodeIds = noOfRegisteredNodeIds; this.registeredNodeIds = registeredNodeIds; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfRegisteredNodeIds() { - return noOfRegisteredNodeIds; - } - public List getRegisteredNodeIds() { return registeredNodeIds; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfRegisteredNodeIds) - writeSimpleField( + // Implicit Field (noOfRegisteredNodeIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfRegisteredNodeIds = + (int) ((((getRegisteredNodeIds()) == (null)) ? -(1) : COUNT(getRegisteredNodeIds()))); + writeImplicitField( "noOfRegisteredNodeIds", noOfRegisteredNodeIds, writeSignedInt(writeBuffer, 32)); // Array Field (registeredNodeIds) @@ -103,7 +97,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfRegisteredNodeIds) + // Implicit Field (noOfRegisteredNodeIds) lengthInBits += 32; // Array field @@ -119,20 +113,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterNodesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); int noOfRegisteredNodeIds = - readSimpleField("noOfRegisteredNodeIds", readSignedInt(readBuffer, 32)); + readImplicitField("noOfRegisteredNodeIds", readSignedInt(readBuffer, 32)); List registeredNodeIds = readCountArrayField( @@ -142,28 +137,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("RegisterNodesResponse"); // Create the instance - return new RegisterNodesResponseBuilderImpl( - responseHeader, noOfRegisteredNodeIds, registeredNodeIds); + return new RegisterNodesResponseBuilderImpl(responseHeader, registeredNodeIds); } public static class RegisterNodesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfRegisteredNodeIds; + private final ResponseHeader responseHeader; private final List registeredNodeIds; public RegisterNodesResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfRegisteredNodeIds, - List registeredNodeIds) { + ResponseHeader responseHeader, List registeredNodeIds) { this.responseHeader = responseHeader; - this.noOfRegisteredNodeIds = noOfRegisteredNodeIds; this.registeredNodeIds = registeredNodeIds; } public RegisterNodesResponse build() { RegisterNodesResponse registerNodesResponse = - new RegisterNodesResponse(responseHeader, noOfRegisteredNodeIds, registeredNodeIds); + new RegisterNodesResponse(responseHeader, registeredNodeIds); return registerNodesResponse; } } @@ -178,7 +168,6 @@ public boolean equals(Object o) { } RegisterNodesResponse that = (RegisterNodesResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfRegisteredNodeIds() == that.getNoOfRegisteredNodeIds()) && (getRegisteredNodeIds() == that.getRegisteredNodeIds()) && super.equals(that) && true; @@ -186,8 +175,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getResponseHeader(), getNoOfRegisteredNodeIds(), getRegisteredNodeIds()); + return Objects.hash(super.hashCode(), getResponseHeader(), getRegisteredNodeIds()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Request.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Request.java index 626fdfeb513..1ca93eee5ab 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Request.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Request.java @@ -38,40 +38,33 @@ public class RegisterServer2Request extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12195"; + public Integer getExtensionId() { + return (int) 12195; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition server; - protected final int noOfDiscoveryConfiguration; + protected final RequestHeader requestHeader; + protected final RegisteredServer server; protected final List discoveryConfiguration; public RegisterServer2Request( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition server, - int noOfDiscoveryConfiguration, + RequestHeader requestHeader, + RegisteredServer server, List discoveryConfiguration) { super(); this.requestHeader = requestHeader; this.server = server; - this.noOfDiscoveryConfiguration = noOfDiscoveryConfiguration; this.discoveryConfiguration = discoveryConfiguration; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getServer() { + public RegisteredServer getServer() { return server; } - public int getNoOfDiscoveryConfiguration() { - return noOfDiscoveryConfiguration; - } - public List getDiscoveryConfiguration() { return discoveryConfiguration; } @@ -89,8 +82,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (server) writeSimpleField("server", server, writeComplex(writeBuffer)); - // Simple Field (noOfDiscoveryConfiguration) - writeSimpleField( + // Implicit Field (noOfDiscoveryConfiguration) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfDiscoveryConfiguration = + (int) + ((((getDiscoveryConfiguration()) == (null)) + ? -(1) + : COUNT(getDiscoveryConfiguration()))); + writeImplicitField( "noOfDiscoveryConfiguration", noOfDiscoveryConfiguration, writeSignedInt(writeBuffer, 32)); // Array Field (discoveryConfiguration) @@ -116,7 +115,7 @@ public int getLengthInBits() { // Simple field (server) lengthInBits += server.getLengthInBits(); - // Simple field (noOfDiscoveryConfiguration) + // Implicit Field (noOfDiscoveryConfiguration) lengthInBits += 32; // Array field @@ -132,27 +131,30 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterServer2Request"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition server = + RegisteredServer server = readSimpleField( "server", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("434")), + () -> + (RegisteredServer) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (434)), readBuffer)); int noOfDiscoveryConfiguration = - readSimpleField("noOfDiscoveryConfiguration", readSignedInt(readBuffer, 32)); + readImplicitField("noOfDiscoveryConfiguration", readSignedInt(readBuffer, 32)); List discoveryConfiguration = readCountArrayField( @@ -163,32 +165,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("RegisterServer2Request"); // Create the instance - return new RegisterServer2RequestBuilderImpl( - requestHeader, server, noOfDiscoveryConfiguration, discoveryConfiguration); + return new RegisterServer2RequestBuilderImpl(requestHeader, server, discoveryConfiguration); } public static class RegisterServer2RequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition server; - private final int noOfDiscoveryConfiguration; + private final RequestHeader requestHeader; + private final RegisteredServer server; private final List discoveryConfiguration; public RegisterServer2RequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - ExtensionObjectDefinition server, - int noOfDiscoveryConfiguration, + RequestHeader requestHeader, + RegisteredServer server, List discoveryConfiguration) { this.requestHeader = requestHeader; this.server = server; - this.noOfDiscoveryConfiguration = noOfDiscoveryConfiguration; this.discoveryConfiguration = discoveryConfiguration; } public RegisterServer2Request build() { RegisterServer2Request registerServer2Request = - new RegisterServer2Request( - requestHeader, server, noOfDiscoveryConfiguration, discoveryConfiguration); + new RegisterServer2Request(requestHeader, server, discoveryConfiguration); return registerServer2Request; } } @@ -204,7 +201,6 @@ public boolean equals(Object o) { RegisterServer2Request that = (RegisterServer2Request) o; return (getRequestHeader() == that.getRequestHeader()) && (getServer() == that.getServer()) - && (getNoOfDiscoveryConfiguration() == that.getNoOfDiscoveryConfiguration()) && (getDiscoveryConfiguration() == that.getDiscoveryConfiguration()) && super.equals(that) && true; @@ -213,11 +209,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getServer(), - getNoOfDiscoveryConfiguration(), - getDiscoveryConfiguration()); + super.hashCode(), getRequestHeader(), getServer(), getDiscoveryConfiguration()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Response.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Response.java index 42cb6543b0f..e5477e10609 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Response.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServer2Response.java @@ -38,47 +38,33 @@ public class RegisterServer2Response extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12196"; + public Integer getExtensionId() { + return (int) 12196; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfConfigurationResults; + protected final ResponseHeader responseHeader; protected final List configurationResults; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public RegisterServer2Response( - ExtensionObjectDefinition responseHeader, - int noOfConfigurationResults, + ResponseHeader responseHeader, List configurationResults, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfConfigurationResults = noOfConfigurationResults; this.configurationResults = configurationResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfConfigurationResults() { - return noOfConfigurationResults; - } - public List getConfigurationResults() { return configurationResults; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,15 +79,21 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfConfigurationResults) - writeSimpleField( + // Implicit Field (noOfConfigurationResults) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfConfigurationResults = + (int) ((((getConfigurationResults()) == (null)) ? -(1) : COUNT(getConfigurationResults()))); + writeImplicitField( "noOfConfigurationResults", noOfConfigurationResults, writeSignedInt(writeBuffer, 32)); // Array Field (configurationResults) writeComplexTypeArrayField("configurationResults", configurationResults, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -123,7 +115,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfConfigurationResults) + // Implicit Field (noOfConfigurationResults) lengthInBits += 32; // Array field @@ -135,7 +127,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -151,20 +143,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterServer2Response"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); int noOfConfigurationResults = - readSimpleField("noOfConfigurationResults", readSignedInt(readBuffer, 32)); + readImplicitField("noOfConfigurationResults", readSignedInt(readBuffer, 32)); List configurationResults = readCountArrayField( @@ -172,7 +165,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfConfigurationResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -183,42 +177,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("RegisterServer2Response"); // Create the instance return new RegisterServer2ResponseBuilderImpl( - responseHeader, - noOfConfigurationResults, - configurationResults, - noOfDiagnosticInfos, - diagnosticInfos); + responseHeader, configurationResults, diagnosticInfos); } public static class RegisterServer2ResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfConfigurationResults; + private final ResponseHeader responseHeader; private final List configurationResults; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public RegisterServer2ResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfConfigurationResults, + ResponseHeader responseHeader, List configurationResults, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfConfigurationResults = noOfConfigurationResults; this.configurationResults = configurationResults; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public RegisterServer2Response build() { RegisterServer2Response registerServer2Response = - new RegisterServer2Response( - responseHeader, - noOfConfigurationResults, - configurationResults, - noOfDiagnosticInfos, - diagnosticInfos); + new RegisterServer2Response(responseHeader, configurationResults, diagnosticInfos); return registerServer2Response; } } @@ -233,9 +212,7 @@ public boolean equals(Object o) { } RegisterServer2Response that = (RegisterServer2Response) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfConfigurationResults() == that.getNoOfConfigurationResults()) && (getConfigurationResults() == that.getConfigurationResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -244,12 +221,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfConfigurationResults(), - getConfigurationResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + super.hashCode(), getResponseHeader(), getConfigurationResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerRequest.java index 352966b776c..a0477104afa 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerRequest.java @@ -38,26 +38,25 @@ public class RegisterServerRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "437"; + public Integer getExtensionId() { + return (int) 437; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final ExtensionObjectDefinition server; + protected final RequestHeader requestHeader; + protected final RegisteredServer server; - public RegisterServerRequest( - ExtensionObjectDefinition requestHeader, ExtensionObjectDefinition server) { + public RegisterServerRequest(RequestHeader requestHeader, RegisteredServer server) { super(); this.requestHeader = requestHeader; this.server = server; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public ExtensionObjectDefinition getServer() { + public RegisteredServer getServer() { return server; } @@ -98,23 +97,26 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterServerRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - ExtensionObjectDefinition server = + RegisteredServer server = readSimpleField( "server", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("434")), + () -> + (RegisteredServer) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (434)), readBuffer)); readBuffer.closeContext("RegisterServerRequest"); @@ -124,11 +126,10 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class RegisterServerRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final ExtensionObjectDefinition server; + private final RequestHeader requestHeader; + private final RegisteredServer server; - public RegisterServerRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, ExtensionObjectDefinition server) { + public RegisterServerRequestBuilderImpl(RequestHeader requestHeader, RegisteredServer server) { this.requestHeader = requestHeader; this.server = server; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerResponse.java index b4890969423..e2d5fe7adcb 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisterServerResponse.java @@ -38,19 +38,19 @@ public class RegisterServerResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "440"; + public Integer getExtensionId() { + return (int) 440; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; - public RegisterServerResponse(ExtensionObjectDefinition responseHeader) { + public RegisterServerResponse(ResponseHeader responseHeader) { super(); this.responseHeader = responseHeader; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisterServerResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); readBuffer.closeContext("RegisterServerResponse"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class RegisterServerResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; - public RegisterServerResponseBuilderImpl(ExtensionObjectDefinition responseHeader) { + public RegisterServerResponseBuilderImpl(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisteredServer.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisteredServer.java index a80c0635e45..526e393c751 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisteredServer.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RegisteredServer.java @@ -38,18 +38,16 @@ public class RegisteredServer extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "434"; + public Integer getExtensionId() { + return (int) 434; } // Properties. protected final PascalString serverUri; protected final PascalString productUri; - protected final int noOfServerNames; protected final List serverNames; protected final ApplicationType serverType; protected final PascalString gatewayServerUri; - protected final int noOfDiscoveryUrls; protected final List discoveryUrls; protected final PascalString semaphoreFilePath; protected final boolean isOnline; @@ -57,22 +55,18 @@ public String getIdentifier() { public RegisteredServer( PascalString serverUri, PascalString productUri, - int noOfServerNames, List serverNames, ApplicationType serverType, PascalString gatewayServerUri, - int noOfDiscoveryUrls, List discoveryUrls, PascalString semaphoreFilePath, boolean isOnline) { super(); this.serverUri = serverUri; this.productUri = productUri; - this.noOfServerNames = noOfServerNames; this.serverNames = serverNames; this.serverType = serverType; this.gatewayServerUri = gatewayServerUri; - this.noOfDiscoveryUrls = noOfDiscoveryUrls; this.discoveryUrls = discoveryUrls; this.semaphoreFilePath = semaphoreFilePath; this.isOnline = isOnline; @@ -86,10 +80,6 @@ public PascalString getProductUri() { return productUri; } - public int getNoOfServerNames() { - return noOfServerNames; - } - public List getServerNames() { return serverNames; } @@ -102,10 +92,6 @@ public PascalString getGatewayServerUri() { return gatewayServerUri; } - public int getNoOfDiscoveryUrls() { - return noOfDiscoveryUrls; - } - public List getDiscoveryUrls() { return discoveryUrls; } @@ -131,8 +117,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (productUri) writeSimpleField("productUri", productUri, writeComplex(writeBuffer)); - // Simple Field (noOfServerNames) - writeSimpleField("noOfServerNames", noOfServerNames, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServerNames) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServerNames = (int) ((((getServerNames()) == (null)) ? -(1) : COUNT(getServerNames()))); + writeImplicitField("noOfServerNames", noOfServerNames, writeSignedInt(writeBuffer, 32)); // Array Field (serverNames) writeComplexTypeArrayField("serverNames", serverNames, writeBuffer); @@ -148,8 +136,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (gatewayServerUri) writeSimpleField("gatewayServerUri", gatewayServerUri, writeComplex(writeBuffer)); - // Simple Field (noOfDiscoveryUrls) - writeSimpleField("noOfDiscoveryUrls", noOfDiscoveryUrls, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiscoveryUrls) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiscoveryUrls = + (int) ((((getDiscoveryUrls()) == (null)) ? -(1) : COUNT(getDiscoveryUrls()))); + writeImplicitField("noOfDiscoveryUrls", noOfDiscoveryUrls, writeSignedInt(writeBuffer, 32)); // Array Field (discoveryUrls) writeComplexTypeArrayField("discoveryUrls", discoveryUrls, writeBuffer); @@ -183,7 +174,7 @@ public int getLengthInBits() { // Simple field (productUri) lengthInBits += productUri.getLengthInBits(); - // Simple field (noOfServerNames) + // Implicit Field (noOfServerNames) lengthInBits += 32; // Array field @@ -201,7 +192,7 @@ public int getLengthInBits() { // Simple field (gatewayServerUri) lengthInBits += gatewayServerUri.getLengthInBits(); - // Simple field (noOfDiscoveryUrls) + // Implicit Field (noOfDiscoveryUrls) lengthInBits += 32; // Array field @@ -226,7 +217,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RegisteredServer"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -239,7 +230,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "productUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfServerNames = readSimpleField("noOfServerNames", readSignedInt(readBuffer, 32)); + int noOfServerNames = readImplicitField("noOfServerNames", readSignedInt(readBuffer, 32)); List serverNames = readCountArrayField( @@ -258,7 +249,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "gatewayServerUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfDiscoveryUrls = readSimpleField("noOfDiscoveryUrls", readSignedInt(readBuffer, 32)); + int noOfDiscoveryUrls = readImplicitField("noOfDiscoveryUrls", readSignedInt(readBuffer, 32)); List discoveryUrls = readCountArrayField( @@ -281,11 +272,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit return new RegisteredServerBuilderImpl( serverUri, productUri, - noOfServerNames, serverNames, serverType, gatewayServerUri, - noOfDiscoveryUrls, discoveryUrls, semaphoreFilePath, isOnline); @@ -295,11 +284,9 @@ public static class RegisteredServerBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString serverUri; private final PascalString productUri; - private final int noOfServerNames; private final List serverNames; private final ApplicationType serverType; private final PascalString gatewayServerUri; - private final int noOfDiscoveryUrls; private final List discoveryUrls; private final PascalString semaphoreFilePath; private final boolean isOnline; @@ -307,21 +294,17 @@ public static class RegisteredServerBuilderImpl public RegisteredServerBuilderImpl( PascalString serverUri, PascalString productUri, - int noOfServerNames, List serverNames, ApplicationType serverType, PascalString gatewayServerUri, - int noOfDiscoveryUrls, List discoveryUrls, PascalString semaphoreFilePath, boolean isOnline) { this.serverUri = serverUri; this.productUri = productUri; - this.noOfServerNames = noOfServerNames; this.serverNames = serverNames; this.serverType = serverType; this.gatewayServerUri = gatewayServerUri; - this.noOfDiscoveryUrls = noOfDiscoveryUrls; this.discoveryUrls = discoveryUrls; this.semaphoreFilePath = semaphoreFilePath; this.isOnline = isOnline; @@ -332,11 +315,9 @@ public RegisteredServer build() { new RegisteredServer( serverUri, productUri, - noOfServerNames, serverNames, serverType, gatewayServerUri, - noOfDiscoveryUrls, discoveryUrls, semaphoreFilePath, isOnline); @@ -355,11 +336,9 @@ public boolean equals(Object o) { RegisteredServer that = (RegisteredServer) o; return (getServerUri() == that.getServerUri()) && (getProductUri() == that.getProductUri()) - && (getNoOfServerNames() == that.getNoOfServerNames()) && (getServerNames() == that.getServerNames()) && (getServerType() == that.getServerType()) && (getGatewayServerUri() == that.getGatewayServerUri()) - && (getNoOfDiscoveryUrls() == that.getNoOfDiscoveryUrls()) && (getDiscoveryUrls() == that.getDiscoveryUrls()) && (getSemaphoreFilePath() == that.getSemaphoreFilePath()) && (getIsOnline() == that.getIsOnline()) @@ -373,11 +352,9 @@ public int hashCode() { super.hashCode(), getServerUri(), getProductUri(), - getNoOfServerNames(), getServerNames(), getServerType(), getGatewayServerUri(), - getNoOfDiscoveryUrls(), getDiscoveryUrls(), getSemaphoreFilePath(), getIsOnline()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePath.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePath.java index b8c2c1b65d5..3425836aee1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePath.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePath.java @@ -38,25 +38,19 @@ public class RelativePath extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "542"; + public Integer getExtensionId() { + return (int) 542; } // Properties. - protected final int noOfElements; - protected final List elements; + protected final List elements; - public RelativePath(int noOfElements, List elements) { + public RelativePath(List elements) { super(); - this.noOfElements = noOfElements; this.elements = elements; } - public int getNoOfElements() { - return noOfElements; - } - - public List getElements() { + public List getElements() { return elements; } @@ -67,8 +61,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("RelativePath"); - // Simple Field (noOfElements) - writeSimpleField("noOfElements", noOfElements, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfElements) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfElements = (int) ((((getElements()) == (null)) ? -(1) : COUNT(getElements()))); + writeImplicitField("noOfElements", noOfElements, writeSignedInt(writeBuffer, 32)); // Array Field (elements) writeComplexTypeArrayField("elements", elements, writeBuffer); @@ -87,13 +83,13 @@ public int getLengthInBits() { RelativePath _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfElements) + // Implicit Field (noOfElements) lengthInBits += 32; // Array field if (elements != null) { int i = 0; - for (ExtensionObjectDefinition element : elements) { + for (RelativePathElement element : elements) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= elements.size()); lengthInBits += element.getLengthInBits(); } @@ -103,38 +99,38 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RelativePath"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfElements = readSimpleField("noOfElements", readSignedInt(readBuffer, 32)); + int noOfElements = readImplicitField("noOfElements", readSignedInt(readBuffer, 32)); - List elements = + List elements = readCountArrayField( "elements", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("539")), + () -> + (RelativePathElement) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (539)), readBuffer), noOfElements); readBuffer.closeContext("RelativePath"); // Create the instance - return new RelativePathBuilderImpl(noOfElements, elements); + return new RelativePathBuilderImpl(elements); } public static class RelativePathBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfElements; - private final List elements; + private final List elements; - public RelativePathBuilderImpl(int noOfElements, List elements) { - this.noOfElements = noOfElements; + public RelativePathBuilderImpl(List elements) { this.elements = elements; } public RelativePath build() { - RelativePath relativePath = new RelativePath(noOfElements, elements); + RelativePath relativePath = new RelativePath(elements); return relativePath; } } @@ -148,15 +144,12 @@ public boolean equals(Object o) { return false; } RelativePath that = (RelativePath) o; - return (getNoOfElements() == that.getNoOfElements()) - && (getElements() == that.getElements()) - && super.equals(that) - && true; + return (getElements() == that.getElements()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getNoOfElements(), getElements()); + return Objects.hash(super.hashCode(), getElements()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePathElement.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePathElement.java index b3c5c6c3a78..1d33d5bec49 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePathElement.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RelativePathElement.java @@ -38,8 +38,8 @@ public class RelativePathElement extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "539"; + public Integer getExtensionId() { + return (int) 539; } // Properties. @@ -131,7 +131,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RelativePathElement"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishRequest.java index 70ae04ab604..49d0bb12747 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishRequest.java @@ -38,24 +38,24 @@ public class RepublishRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "832"; + public Integer getExtensionId() { + return (int) 832; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final long retransmitSequenceNumber; public RepublishRequest( - ExtensionObjectDefinition requestHeader, long subscriptionId, long retransmitSequenceNumber) { + RequestHeader requestHeader, long subscriptionId, long retransmitSequenceNumber) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.retransmitSequenceNumber = retransmitSequenceNumber; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -111,16 +111,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RepublishRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -135,14 +136,12 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class RepublishRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final long retransmitSequenceNumber; public RepublishRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - long subscriptionId, - long retransmitSequenceNumber) { + RequestHeader requestHeader, long subscriptionId, long retransmitSequenceNumber) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.retransmitSequenceNumber = retransmitSequenceNumber; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishResponse.java index aa205dae523..5d9e208e63d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RepublishResponse.java @@ -38,26 +38,25 @@ public class RepublishResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "835"; + public Integer getExtensionId() { + return (int) 835; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final ExtensionObjectDefinition notificationMessage; + protected final ResponseHeader responseHeader; + protected final NotificationMessage notificationMessage; - public RepublishResponse( - ExtensionObjectDefinition responseHeader, ExtensionObjectDefinition notificationMessage) { + public RepublishResponse(ResponseHeader responseHeader, NotificationMessage notificationMessage) { super(); this.responseHeader = responseHeader; this.notificationMessage = notificationMessage; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public ExtensionObjectDefinition getNotificationMessage() { + public NotificationMessage getNotificationMessage() { return notificationMessage; } @@ -98,23 +97,26 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RepublishResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - ExtensionObjectDefinition notificationMessage = + NotificationMessage notificationMessage = readSimpleField( "notificationMessage", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("805")), + () -> + (NotificationMessage) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (805)), readBuffer)); readBuffer.closeContext("RepublishResponse"); @@ -124,11 +126,11 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class RepublishResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final ExtensionObjectDefinition notificationMessage; + private final ResponseHeader responseHeader; + private final NotificationMessage notificationMessage; public RepublishResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, ExtensionObjectDefinition notificationMessage) { + ResponseHeader responseHeader, NotificationMessage notificationMessage) { this.responseHeader = responseHeader; this.notificationMessage = notificationMessage; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RequestHeader.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RequestHeader.java index 99b02d36d99..e34961e088c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RequestHeader.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RequestHeader.java @@ -38,8 +38,8 @@ public class RequestHeader extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "391"; + public Integer getExtensionId() { + return (int) 391; } // Properties. @@ -164,7 +164,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RequestHeader"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ResponseHeader.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ResponseHeader.java index f4fc7cf5004..889e3878b44 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ResponseHeader.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ResponseHeader.java @@ -38,8 +38,8 @@ public class ResponseHeader extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "394"; + public Integer getExtensionId() { + return (int) 394; } // Properties. @@ -47,7 +47,6 @@ public String getIdentifier() { protected final long requestHandle; protected final StatusCode serviceResult; protected final DiagnosticInfo serviceDiagnostics; - protected final int noOfStringTable; protected final List stringTable; protected final ExtensionObject additionalHeader; @@ -56,7 +55,6 @@ public ResponseHeader( long requestHandle, StatusCode serviceResult, DiagnosticInfo serviceDiagnostics, - int noOfStringTable, List stringTable, ExtensionObject additionalHeader) { super(); @@ -64,7 +62,6 @@ public ResponseHeader( this.requestHandle = requestHandle; this.serviceResult = serviceResult; this.serviceDiagnostics = serviceDiagnostics; - this.noOfStringTable = noOfStringTable; this.stringTable = stringTable; this.additionalHeader = additionalHeader; } @@ -85,10 +82,6 @@ public DiagnosticInfo getServiceDiagnostics() { return serviceDiagnostics; } - public int getNoOfStringTable() { - return noOfStringTable; - } - public List getStringTable() { return stringTable; } @@ -116,8 +109,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (serviceDiagnostics) writeSimpleField("serviceDiagnostics", serviceDiagnostics, writeComplex(writeBuffer)); - // Simple Field (noOfStringTable) - writeSimpleField("noOfStringTable", noOfStringTable, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfStringTable) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfStringTable = (int) ((((getStringTable()) == (null)) ? -(1) : COUNT(getStringTable()))); + writeImplicitField("noOfStringTable", noOfStringTable, writeSignedInt(writeBuffer, 32)); // Array Field (stringTable) writeComplexTypeArrayField("stringTable", stringTable, writeBuffer); @@ -151,7 +146,7 @@ public int getLengthInBits() { // Simple field (serviceDiagnostics) lengthInBits += serviceDiagnostics.getLengthInBits(); - // Simple field (noOfStringTable) + // Implicit Field (noOfStringTable) lengthInBits += 32; // Array field @@ -170,7 +165,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ResponseHeader"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -188,7 +183,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "serviceDiagnostics", readComplex(() -> DiagnosticInfo.staticParse(readBuffer), readBuffer)); - int noOfStringTable = readSimpleField("noOfStringTable", readSignedInt(readBuffer, 32)); + int noOfStringTable = readImplicitField("noOfStringTable", readSignedInt(readBuffer, 32)); List stringTable = readCountArrayField( @@ -205,13 +200,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ResponseHeader"); // Create the instance return new ResponseHeaderBuilderImpl( - timestamp, - requestHandle, - serviceResult, - serviceDiagnostics, - noOfStringTable, - stringTable, - additionalHeader); + timestamp, requestHandle, serviceResult, serviceDiagnostics, stringTable, additionalHeader); } public static class ResponseHeaderBuilderImpl @@ -220,7 +209,6 @@ public static class ResponseHeaderBuilderImpl private final long requestHandle; private final StatusCode serviceResult; private final DiagnosticInfo serviceDiagnostics; - private final int noOfStringTable; private final List stringTable; private final ExtensionObject additionalHeader; @@ -229,14 +217,12 @@ public ResponseHeaderBuilderImpl( long requestHandle, StatusCode serviceResult, DiagnosticInfo serviceDiagnostics, - int noOfStringTable, List stringTable, ExtensionObject additionalHeader) { this.timestamp = timestamp; this.requestHandle = requestHandle; this.serviceResult = serviceResult; this.serviceDiagnostics = serviceDiagnostics; - this.noOfStringTable = noOfStringTable; this.stringTable = stringTable; this.additionalHeader = additionalHeader; } @@ -248,7 +234,6 @@ public ResponseHeader build() { requestHandle, serviceResult, serviceDiagnostics, - noOfStringTable, stringTable, additionalHeader); return responseHeader; @@ -268,7 +253,6 @@ public boolean equals(Object o) { && (getRequestHandle() == that.getRequestHandle()) && (getServiceResult() == that.getServiceResult()) && (getServiceDiagnostics() == that.getServiceDiagnostics()) - && (getNoOfStringTable() == that.getNoOfStringTable()) && (getStringTable() == that.getStringTable()) && (getAdditionalHeader() == that.getAdditionalHeader()) && super.equals(that) @@ -283,7 +267,6 @@ public int hashCode() { getRequestHandle(), getServiceResult(), getServiceDiagnostics(), - getNoOfStringTable(), getStringTable(), getAdditionalHeader()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RolePermissionType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RolePermissionType.java index 839313e59e0..cb7c7ea767d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RolePermissionType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RolePermissionType.java @@ -38,8 +38,8 @@ public class RolePermissionType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "98"; + public Integer getExtensionId() { + return (int) 98; } // Properties. @@ -102,7 +102,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("RolePermissionType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityTokenDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RootExtensionObject.java similarity index 51% rename from plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityTokenDefinition.java rename to plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RootExtensionObject.java index e49369bf509..b5d3dcae96c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityTokenDefinition.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/RootExtensionObject.java @@ -35,27 +35,36 @@ // Code generated by code-generation. DO NOT EDIT. -public abstract class UserIdentityTokenDefinition implements Message { +public class RootExtensionObject extends ExtensionObject implements Message { - // Abstract accessors for discriminator values. - public abstract String getIdentifier(); + // Accessors for discriminator values. + public Boolean getIncludeEncodingMask() { + return (boolean) false; + } + + // Properties. + protected final ExtensionObjectDefinition body; - public UserIdentityTokenDefinition() { - super(); + public RootExtensionObject(ExpandedNodeId typeId, ExtensionObjectDefinition body) { + super(typeId); + this.body = body; } - protected abstract void serializeUserIdentityTokenDefinitionChild(WriteBuffer writeBuffer) - throws SerializationException; + public ExtensionObjectDefinition getBody() { + return body; + } - public void serialize(WriteBuffer writeBuffer) throws SerializationException { + @Override + protected void serializeExtensionObjectChild(WriteBuffer writeBuffer) + throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - writeBuffer.pushContext("UserIdentityTokenDefinition"); + writeBuffer.pushContext("RootExtensionObject"); - // Switch field (Serialize the sub-type) - serializeUserIdentityTokenDefinitionChild(writeBuffer); + // Simple Field (body) + writeSimpleField("body", body, writeComplex(writeBuffer)); - writeBuffer.popContext("UserIdentityTokenDefinition"); + writeBuffer.popContext("RootExtensionObject"); } @Override @@ -65,55 +74,47 @@ public int getLengthInBytes() { @Override public int getLengthInBits() { - int lengthInBits = 0; - UserIdentityTokenDefinition _value = this; + int lengthInBits = super.getLengthInBits(); + RootExtensionObject _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Length of sub-type elements will be added by sub-type... + // Simple field (body) + lengthInBits += body.getLengthInBits(); return lengthInBits; } - public static UserIdentityTokenDefinition staticParse(ReadBuffer readBuffer, String identifier) + public static ExtensionObjectBuilder staticParseExtensionObjectBuilder( + ReadBuffer readBuffer, Integer extensionId, Boolean includeEncodingMask) throws ParseException { - readBuffer.pullContext("UserIdentityTokenDefinition"); + readBuffer.pullContext("RootExtensionObject"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) - UserIdentityTokenDefinitionBuilder builder = null; - if (EvaluationHelper.equals(identifier, (String) "anonymous")) { - builder = - AnonymousIdentityToken.staticParseUserIdentityTokenDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "username")) { - builder = - UserNameIdentityToken.staticParseUserIdentityTokenDefinitionBuilder( - readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "certificate")) { - builder = - X509IdentityToken.staticParseUserIdentityTokenDefinitionBuilder(readBuffer, identifier); - } else if (EvaluationHelper.equals(identifier, (String) "identity")) { - builder = - IssuedIdentityToken.staticParseUserIdentityTokenDefinitionBuilder(readBuffer, identifier); - } - if (builder == null) { - throw new ParseException( - "Unsupported case for discriminated type" - + " parameters [" - + "identifier=" - + identifier - + "]"); - } + ExtensionObjectDefinition body = + readSimpleField( + "body", + readComplex( + () -> ExtensionObjectDefinition.staticParse(readBuffer, (int) (extensionId)), + readBuffer)); - readBuffer.closeContext("UserIdentityTokenDefinition"); + readBuffer.closeContext("RootExtensionObject"); // Create the instance - UserIdentityTokenDefinition _userIdentityTokenDefinition = builder.build(); - return _userIdentityTokenDefinition; + return new RootExtensionObjectBuilderImpl(body); } - public interface UserIdentityTokenDefinitionBuilder { - UserIdentityTokenDefinition build(); + public static class RootExtensionObjectBuilderImpl + implements ExtensionObject.ExtensionObjectBuilder { + private final ExtensionObjectDefinition body; + + public RootExtensionObjectBuilderImpl(ExtensionObjectDefinition body) { + this.body = body; + } + + public RootExtensionObject build(ExpandedNodeId typeId) { + RootExtensionObject rootExtensionObject = new RootExtensionObject(typeId, body); + return rootExtensionObject; + } } @Override @@ -121,16 +122,16 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof UserIdentityTokenDefinition)) { + if (!(o instanceof RootExtensionObject)) { return false; } - UserIdentityTokenDefinition that = (UserIdentityTokenDefinition) o; - return true; + RootExtensionObject that = (RootExtensionObject) o; + return (getBody() == that.getBody()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(); + return Objects.hash(super.hashCode(), getBody()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SamplingIntervalDiagnosticsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SamplingIntervalDiagnosticsDataType.java index 06655b241ac..d17ea25282f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SamplingIntervalDiagnosticsDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SamplingIntervalDiagnosticsDataType.java @@ -39,8 +39,8 @@ public class SamplingIntervalDiagnosticsDataType extends ExtensionObjectDefiniti implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "858"; + public Integer getExtensionId() { + return (int) 858; } // Properties. @@ -130,7 +130,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SamplingIntervalDiagnosticsDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SecurityGroupDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SecurityGroupDataType.java index 9db90d12dfb..ad4402ecdc7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SecurityGroupDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SecurityGroupDataType.java @@ -38,49 +38,40 @@ public class SecurityGroupDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "23603"; + public Integer getExtensionId() { + return (int) 23603; } // Properties. protected final PascalString name; - protected final int noOfSecurityGroupFolder; protected final List securityGroupFolder; protected final double keyLifetime; protected final PascalString securityPolicyUri; protected final long maxFutureKeyCount; protected final long maxPastKeyCount; protected final PascalString securityGroupId; - protected final int noOfRolePermissions; - protected final List rolePermissions; - protected final int noOfGroupProperties; - protected final List groupProperties; + protected final List rolePermissions; + protected final List groupProperties; public SecurityGroupDataType( PascalString name, - int noOfSecurityGroupFolder, List securityGroupFolder, double keyLifetime, PascalString securityPolicyUri, long maxFutureKeyCount, long maxPastKeyCount, PascalString securityGroupId, - int noOfRolePermissions, - List rolePermissions, - int noOfGroupProperties, - List groupProperties) { + List rolePermissions, + List groupProperties) { super(); this.name = name; - this.noOfSecurityGroupFolder = noOfSecurityGroupFolder; this.securityGroupFolder = securityGroupFolder; this.keyLifetime = keyLifetime; this.securityPolicyUri = securityPolicyUri; this.maxFutureKeyCount = maxFutureKeyCount; this.maxPastKeyCount = maxPastKeyCount; this.securityGroupId = securityGroupId; - this.noOfRolePermissions = noOfRolePermissions; this.rolePermissions = rolePermissions; - this.noOfGroupProperties = noOfGroupProperties; this.groupProperties = groupProperties; } @@ -88,10 +79,6 @@ public PascalString getName() { return name; } - public int getNoOfSecurityGroupFolder() { - return noOfSecurityGroupFolder; - } - public List getSecurityGroupFolder() { return securityGroupFolder; } @@ -116,19 +103,11 @@ public PascalString getSecurityGroupId() { return securityGroupId; } - public int getNoOfRolePermissions() { - return noOfRolePermissions; - } - - public List getRolePermissions() { + public List getRolePermissions() { return rolePermissions; } - public int getNoOfGroupProperties() { - return noOfGroupProperties; - } - - public List getGroupProperties() { + public List getGroupProperties() { return groupProperties; } @@ -142,8 +121,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (name) writeSimpleField("name", name, writeComplex(writeBuffer)); - // Simple Field (noOfSecurityGroupFolder) - writeSimpleField( + // Implicit Field (noOfSecurityGroupFolder) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSecurityGroupFolder = + (int) ((((getSecurityGroupFolder()) == (null)) ? -(1) : COUNT(getSecurityGroupFolder()))); + writeImplicitField( "noOfSecurityGroupFolder", noOfSecurityGroupFolder, writeSignedInt(writeBuffer, 32)); // Array Field (securityGroupFolder) @@ -164,14 +146,20 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (securityGroupId) writeSimpleField("securityGroupId", securityGroupId, writeComplex(writeBuffer)); - // Simple Field (noOfRolePermissions) - writeSimpleField("noOfRolePermissions", noOfRolePermissions, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfRolePermissions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfRolePermissions = + (int) ((((getRolePermissions()) == (null)) ? -(1) : COUNT(getRolePermissions()))); + writeImplicitField("noOfRolePermissions", noOfRolePermissions, writeSignedInt(writeBuffer, 32)); // Array Field (rolePermissions) writeComplexTypeArrayField("rolePermissions", rolePermissions, writeBuffer); - // Simple Field (noOfGroupProperties) - writeSimpleField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfGroupProperties) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfGroupProperties = + (int) ((((getGroupProperties()) == (null)) ? -(1) : COUNT(getGroupProperties()))); + writeImplicitField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); // Array Field (groupProperties) writeComplexTypeArrayField("groupProperties", groupProperties, writeBuffer); @@ -193,7 +181,7 @@ public int getLengthInBits() { // Simple field (name) lengthInBits += name.getLengthInBits(); - // Simple field (noOfSecurityGroupFolder) + // Implicit Field (noOfSecurityGroupFolder) lengthInBits += 32; // Array field @@ -220,25 +208,25 @@ public int getLengthInBits() { // Simple field (securityGroupId) lengthInBits += securityGroupId.getLengthInBits(); - // Simple field (noOfRolePermissions) + // Implicit Field (noOfRolePermissions) lengthInBits += 32; // Array field if (rolePermissions != null) { int i = 0; - for (ExtensionObjectDefinition element : rolePermissions) { + for (RolePermissionType element : rolePermissions) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= rolePermissions.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfGroupProperties) + // Implicit Field (noOfGroupProperties) lengthInBits += 32; // Array field if (groupProperties != null) { int i = 0; - for (ExtensionObjectDefinition element : groupProperties) { + for (KeyValuePair element : groupProperties) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= groupProperties.size()); lengthInBits += element.getLengthInBits(); } @@ -248,7 +236,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SecurityGroupDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -258,7 +246,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfSecurityGroupFolder = - readSimpleField("noOfSecurityGroupFolder", readSignedInt(readBuffer, 32)); + readImplicitField("noOfSecurityGroupFolder", readSignedInt(readBuffer, 32)); List securityGroupFolder = readCountArrayField( @@ -281,23 +269,28 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "securityGroupId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfRolePermissions = readSimpleField("noOfRolePermissions", readSignedInt(readBuffer, 32)); + int noOfRolePermissions = + readImplicitField("noOfRolePermissions", readSignedInt(readBuffer, 32)); - List rolePermissions = + List rolePermissions = readCountArrayField( "rolePermissions", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("98")), + () -> + (RolePermissionType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (98)), readBuffer), noOfRolePermissions); - int noOfGroupProperties = readSimpleField("noOfGroupProperties", readSignedInt(readBuffer, 32)); + int noOfGroupProperties = + readImplicitField("noOfGroupProperties", readSignedInt(readBuffer, 32)); - List groupProperties = + List groupProperties = readCountArrayField( "groupProperties", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("14535")), + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), readBuffer), noOfGroupProperties); @@ -305,58 +298,46 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit // Create the instance return new SecurityGroupDataTypeBuilderImpl( name, - noOfSecurityGroupFolder, securityGroupFolder, keyLifetime, securityPolicyUri, maxFutureKeyCount, maxPastKeyCount, securityGroupId, - noOfRolePermissions, rolePermissions, - noOfGroupProperties, groupProperties); } public static class SecurityGroupDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString name; - private final int noOfSecurityGroupFolder; private final List securityGroupFolder; private final double keyLifetime; private final PascalString securityPolicyUri; private final long maxFutureKeyCount; private final long maxPastKeyCount; private final PascalString securityGroupId; - private final int noOfRolePermissions; - private final List rolePermissions; - private final int noOfGroupProperties; - private final List groupProperties; + private final List rolePermissions; + private final List groupProperties; public SecurityGroupDataTypeBuilderImpl( PascalString name, - int noOfSecurityGroupFolder, List securityGroupFolder, double keyLifetime, PascalString securityPolicyUri, long maxFutureKeyCount, long maxPastKeyCount, PascalString securityGroupId, - int noOfRolePermissions, - List rolePermissions, - int noOfGroupProperties, - List groupProperties) { + List rolePermissions, + List groupProperties) { this.name = name; - this.noOfSecurityGroupFolder = noOfSecurityGroupFolder; this.securityGroupFolder = securityGroupFolder; this.keyLifetime = keyLifetime; this.securityPolicyUri = securityPolicyUri; this.maxFutureKeyCount = maxFutureKeyCount; this.maxPastKeyCount = maxPastKeyCount; this.securityGroupId = securityGroupId; - this.noOfRolePermissions = noOfRolePermissions; this.rolePermissions = rolePermissions; - this.noOfGroupProperties = noOfGroupProperties; this.groupProperties = groupProperties; } @@ -364,16 +345,13 @@ public SecurityGroupDataType build() { SecurityGroupDataType securityGroupDataType = new SecurityGroupDataType( name, - noOfSecurityGroupFolder, securityGroupFolder, keyLifetime, securityPolicyUri, maxFutureKeyCount, maxPastKeyCount, securityGroupId, - noOfRolePermissions, rolePermissions, - noOfGroupProperties, groupProperties); return securityGroupDataType; } @@ -389,16 +367,13 @@ public boolean equals(Object o) { } SecurityGroupDataType that = (SecurityGroupDataType) o; return (getName() == that.getName()) - && (getNoOfSecurityGroupFolder() == that.getNoOfSecurityGroupFolder()) && (getSecurityGroupFolder() == that.getSecurityGroupFolder()) && (getKeyLifetime() == that.getKeyLifetime()) && (getSecurityPolicyUri() == that.getSecurityPolicyUri()) && (getMaxFutureKeyCount() == that.getMaxFutureKeyCount()) && (getMaxPastKeyCount() == that.getMaxPastKeyCount()) && (getSecurityGroupId() == that.getSecurityGroupId()) - && (getNoOfRolePermissions() == that.getNoOfRolePermissions()) && (getRolePermissions() == that.getRolePermissions()) - && (getNoOfGroupProperties() == that.getNoOfGroupProperties()) && (getGroupProperties() == that.getGroupProperties()) && super.equals(that) && true; @@ -409,16 +384,13 @@ public int hashCode() { return Objects.hash( super.hashCode(), getName(), - getNoOfSecurityGroupFolder(), getSecurityGroupFolder(), getKeyLifetime(), getSecurityPolicyUri(), getMaxFutureKeyCount(), getMaxPastKeyCount(), getSecurityGroupId(), - getNoOfRolePermissions(), getRolePermissions(), - getNoOfGroupProperties(), getGroupProperties()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SemanticChangeStructureDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SemanticChangeStructureDataType.java index ca69bb323eb..ad29bd2a59f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SemanticChangeStructureDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SemanticChangeStructureDataType.java @@ -38,8 +38,8 @@ public class SemanticChangeStructureDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "899"; + public Integer getExtensionId() { + return (int) 899; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SemanticChangeStructureDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerDiagnosticsSummaryDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerDiagnosticsSummaryDataType.java index f5b9c9073e5..8c86bb4e590 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerDiagnosticsSummaryDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerDiagnosticsSummaryDataType.java @@ -38,8 +38,8 @@ public class ServerDiagnosticsSummaryDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "861"; + public Integer getExtensionId() { + return (int) 861; } // Properties. @@ -245,7 +245,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ServerDiagnosticsSummaryDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerOnNetwork.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerOnNetwork.java index 07d279380f4..dc90255a6d7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerOnNetwork.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerOnNetwork.java @@ -38,28 +38,25 @@ public class ServerOnNetwork extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12191"; + public Integer getExtensionId() { + return (int) 12191; } // Properties. protected final long recordId; protected final PascalString serverName; protected final PascalString discoveryUrl; - protected final int noOfServerCapabilities; protected final List serverCapabilities; public ServerOnNetwork( long recordId, PascalString serverName, PascalString discoveryUrl, - int noOfServerCapabilities, List serverCapabilities) { super(); this.recordId = recordId; this.serverName = serverName; this.discoveryUrl = discoveryUrl; - this.noOfServerCapabilities = noOfServerCapabilities; this.serverCapabilities = serverCapabilities; } @@ -75,10 +72,6 @@ public PascalString getDiscoveryUrl() { return discoveryUrl; } - public int getNoOfServerCapabilities() { - return noOfServerCapabilities; - } - public List getServerCapabilities() { return serverCapabilities; } @@ -99,8 +92,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (discoveryUrl) writeSimpleField("discoveryUrl", discoveryUrl, writeComplex(writeBuffer)); - // Simple Field (noOfServerCapabilities) - writeSimpleField( + // Implicit Field (noOfServerCapabilities) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfServerCapabilities = + (int) ((((getServerCapabilities()) == (null)) ? -(1) : COUNT(getServerCapabilities()))); + writeImplicitField( "noOfServerCapabilities", noOfServerCapabilities, writeSignedInt(writeBuffer, 32)); // Array Field (serverCapabilities) @@ -129,7 +125,7 @@ public int getLengthInBits() { // Simple field (discoveryUrl) lengthInBits += discoveryUrl.getLengthInBits(); - // Simple field (noOfServerCapabilities) + // Implicit Field (noOfServerCapabilities) lengthInBits += 32; // Array field @@ -145,7 +141,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ServerOnNetwork"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -161,7 +157,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "discoveryUrl", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfServerCapabilities = - readSimpleField("noOfServerCapabilities", readSignedInt(readBuffer, 32)); + readImplicitField("noOfServerCapabilities", readSignedInt(readBuffer, 32)); List serverCapabilities = readCountArrayField( @@ -171,8 +167,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("ServerOnNetwork"); // Create the instance - return new ServerOnNetworkBuilderImpl( - recordId, serverName, discoveryUrl, noOfServerCapabilities, serverCapabilities); + return new ServerOnNetworkBuilderImpl(recordId, serverName, discoveryUrl, serverCapabilities); } public static class ServerOnNetworkBuilderImpl @@ -180,26 +175,22 @@ public static class ServerOnNetworkBuilderImpl private final long recordId; private final PascalString serverName; private final PascalString discoveryUrl; - private final int noOfServerCapabilities; private final List serverCapabilities; public ServerOnNetworkBuilderImpl( long recordId, PascalString serverName, PascalString discoveryUrl, - int noOfServerCapabilities, List serverCapabilities) { this.recordId = recordId; this.serverName = serverName; this.discoveryUrl = discoveryUrl; - this.noOfServerCapabilities = noOfServerCapabilities; this.serverCapabilities = serverCapabilities; } public ServerOnNetwork build() { ServerOnNetwork serverOnNetwork = - new ServerOnNetwork( - recordId, serverName, discoveryUrl, noOfServerCapabilities, serverCapabilities); + new ServerOnNetwork(recordId, serverName, discoveryUrl, serverCapabilities); return serverOnNetwork; } } @@ -216,7 +207,6 @@ public boolean equals(Object o) { return (getRecordId() == that.getRecordId()) && (getServerName() == that.getServerName()) && (getDiscoveryUrl() == that.getDiscoveryUrl()) - && (getNoOfServerCapabilities() == that.getNoOfServerCapabilities()) && (getServerCapabilities() == that.getServerCapabilities()) && super.equals(that) && true; @@ -229,7 +219,6 @@ public int hashCode() { getRecordId(), getServerName(), getDiscoveryUrl(), - getNoOfServerCapabilities(), getServerCapabilities()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerStatusDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerStatusDataType.java index 41ab01148d8..1f49c70e10a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerStatusDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServerStatusDataType.java @@ -38,15 +38,15 @@ public class ServerStatusDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "864"; + public Integer getExtensionId() { + return (int) 864; } // Properties. protected final long startTime; protected final long currentTime; protected final ServerState state; - protected final ExtensionObjectDefinition buildInfo; + protected final BuildInfo buildInfo; protected final long secondsTillShutdown; protected final LocalizedText shutdownReason; @@ -54,7 +54,7 @@ public ServerStatusDataType( long startTime, long currentTime, ServerState state, - ExtensionObjectDefinition buildInfo, + BuildInfo buildInfo, long secondsTillShutdown, LocalizedText shutdownReason) { super(); @@ -78,7 +78,7 @@ public ServerState getState() { return state; } - public ExtensionObjectDefinition getBuildInfo() { + public BuildInfo getBuildInfo() { return buildInfo; } @@ -156,7 +156,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ServerStatusDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -171,11 +171,11 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "ServerState", readEnum(ServerState::enumForValue, readUnsignedLong(readBuffer, 32))); - ExtensionObjectDefinition buildInfo = + BuildInfo buildInfo = readSimpleField( "buildInfo", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("340")), + () -> (BuildInfo) ExtensionObjectDefinition.staticParse(readBuffer, (int) (340)), readBuffer)); long secondsTillShutdown = @@ -196,7 +196,7 @@ public static class ServerStatusDataTypeBuilderImpl private final long startTime; private final long currentTime; private final ServerState state; - private final ExtensionObjectDefinition buildInfo; + private final BuildInfo buildInfo; private final long secondsTillShutdown; private final LocalizedText shutdownReason; @@ -204,7 +204,7 @@ public ServerStatusDataTypeBuilderImpl( long startTime, long currentTime, ServerState state, - ExtensionObjectDefinition buildInfo, + BuildInfo buildInfo, long secondsTillShutdown, LocalizedText shutdownReason) { this.startTime = startTime; diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceCounterDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceCounterDataType.java index d9b385aeb47..cf86146fb8d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceCounterDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceCounterDataType.java @@ -38,8 +38,8 @@ public class ServiceCounterDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "873"; + public Integer getExtensionId() { + return (int) 873; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ServiceCounterDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceFault.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceFault.java index 8950248e330..8a1a4685610 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceFault.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ServiceFault.java @@ -38,19 +38,19 @@ public class ServiceFault extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "397"; + public Integer getExtensionId() { + return (int) 397; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; - public ServiceFault(ExtensionObjectDefinition responseHeader) { + public ServiceFault(ResponseHeader responseHeader) { super(); this.responseHeader = responseHeader; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ServiceFault"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); readBuffer.closeContext("ServiceFault"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class ServiceFaultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; - public ServiceFaultBuilderImpl(ExtensionObjectDefinition responseHeader) { + public ServiceFaultBuilderImpl(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionDiagnosticsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionDiagnosticsDataType.java index 7a5bef62e53..55afa6605d6 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionDiagnosticsDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionDiagnosticsDataType.java @@ -38,17 +38,16 @@ public class SessionDiagnosticsDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "867"; + public Integer getExtensionId() { + return (int) 867; } // Properties. protected final NodeId sessionId; protected final PascalString sessionName; - protected final ExtensionObjectDefinition clientDescription; + protected final ApplicationDescription clientDescription; protected final PascalString serverUri; protected final PascalString endpointUrl; - protected final int noOfLocaleIds; protected final List localeIds; protected final double actualSessionTimeout; protected final long maxResponseMessageSize; @@ -57,44 +56,43 @@ public String getIdentifier() { protected final long currentSubscriptionsCount; protected final long currentMonitoredItemsCount; protected final long currentPublishRequestsInQueue; - protected final ExtensionObjectDefinition totalRequestCount; + protected final ServiceCounterDataType totalRequestCount; protected final long unauthorizedRequestCount; - protected final ExtensionObjectDefinition readCount; - protected final ExtensionObjectDefinition historyReadCount; - protected final ExtensionObjectDefinition writeCount; - protected final ExtensionObjectDefinition historyUpdateCount; - protected final ExtensionObjectDefinition callCount; - protected final ExtensionObjectDefinition createMonitoredItemsCount; - protected final ExtensionObjectDefinition modifyMonitoredItemsCount; - protected final ExtensionObjectDefinition setMonitoringModeCount; - protected final ExtensionObjectDefinition setTriggeringCount; - protected final ExtensionObjectDefinition deleteMonitoredItemsCount; - protected final ExtensionObjectDefinition createSubscriptionCount; - protected final ExtensionObjectDefinition modifySubscriptionCount; - protected final ExtensionObjectDefinition setPublishingModeCount; - protected final ExtensionObjectDefinition publishCount; - protected final ExtensionObjectDefinition republishCount; - protected final ExtensionObjectDefinition transferSubscriptionsCount; - protected final ExtensionObjectDefinition deleteSubscriptionsCount; - protected final ExtensionObjectDefinition addNodesCount; - protected final ExtensionObjectDefinition addReferencesCount; - protected final ExtensionObjectDefinition deleteNodesCount; - protected final ExtensionObjectDefinition deleteReferencesCount; - protected final ExtensionObjectDefinition browseCount; - protected final ExtensionObjectDefinition browseNextCount; - protected final ExtensionObjectDefinition translateBrowsePathsToNodeIdsCount; - protected final ExtensionObjectDefinition queryFirstCount; - protected final ExtensionObjectDefinition queryNextCount; - protected final ExtensionObjectDefinition registerNodesCount; - protected final ExtensionObjectDefinition unregisterNodesCount; + protected final ServiceCounterDataType readCount; + protected final ServiceCounterDataType historyReadCount; + protected final ServiceCounterDataType writeCount; + protected final ServiceCounterDataType historyUpdateCount; + protected final ServiceCounterDataType callCount; + protected final ServiceCounterDataType createMonitoredItemsCount; + protected final ServiceCounterDataType modifyMonitoredItemsCount; + protected final ServiceCounterDataType setMonitoringModeCount; + protected final ServiceCounterDataType setTriggeringCount; + protected final ServiceCounterDataType deleteMonitoredItemsCount; + protected final ServiceCounterDataType createSubscriptionCount; + protected final ServiceCounterDataType modifySubscriptionCount; + protected final ServiceCounterDataType setPublishingModeCount; + protected final ServiceCounterDataType publishCount; + protected final ServiceCounterDataType republishCount; + protected final ServiceCounterDataType transferSubscriptionsCount; + protected final ServiceCounterDataType deleteSubscriptionsCount; + protected final ServiceCounterDataType addNodesCount; + protected final ServiceCounterDataType addReferencesCount; + protected final ServiceCounterDataType deleteNodesCount; + protected final ServiceCounterDataType deleteReferencesCount; + protected final ServiceCounterDataType browseCount; + protected final ServiceCounterDataType browseNextCount; + protected final ServiceCounterDataType translateBrowsePathsToNodeIdsCount; + protected final ServiceCounterDataType queryFirstCount; + protected final ServiceCounterDataType queryNextCount; + protected final ServiceCounterDataType registerNodesCount; + protected final ServiceCounterDataType unregisterNodesCount; public SessionDiagnosticsDataType( NodeId sessionId, PascalString sessionName, - ExtensionObjectDefinition clientDescription, + ApplicationDescription clientDescription, PascalString serverUri, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, double actualSessionTimeout, long maxResponseMessageSize, @@ -103,43 +101,42 @@ public SessionDiagnosticsDataType( long currentSubscriptionsCount, long currentMonitoredItemsCount, long currentPublishRequestsInQueue, - ExtensionObjectDefinition totalRequestCount, + ServiceCounterDataType totalRequestCount, long unauthorizedRequestCount, - ExtensionObjectDefinition readCount, - ExtensionObjectDefinition historyReadCount, - ExtensionObjectDefinition writeCount, - ExtensionObjectDefinition historyUpdateCount, - ExtensionObjectDefinition callCount, - ExtensionObjectDefinition createMonitoredItemsCount, - ExtensionObjectDefinition modifyMonitoredItemsCount, - ExtensionObjectDefinition setMonitoringModeCount, - ExtensionObjectDefinition setTriggeringCount, - ExtensionObjectDefinition deleteMonitoredItemsCount, - ExtensionObjectDefinition createSubscriptionCount, - ExtensionObjectDefinition modifySubscriptionCount, - ExtensionObjectDefinition setPublishingModeCount, - ExtensionObjectDefinition publishCount, - ExtensionObjectDefinition republishCount, - ExtensionObjectDefinition transferSubscriptionsCount, - ExtensionObjectDefinition deleteSubscriptionsCount, - ExtensionObjectDefinition addNodesCount, - ExtensionObjectDefinition addReferencesCount, - ExtensionObjectDefinition deleteNodesCount, - ExtensionObjectDefinition deleteReferencesCount, - ExtensionObjectDefinition browseCount, - ExtensionObjectDefinition browseNextCount, - ExtensionObjectDefinition translateBrowsePathsToNodeIdsCount, - ExtensionObjectDefinition queryFirstCount, - ExtensionObjectDefinition queryNextCount, - ExtensionObjectDefinition registerNodesCount, - ExtensionObjectDefinition unregisterNodesCount) { + ServiceCounterDataType readCount, + ServiceCounterDataType historyReadCount, + ServiceCounterDataType writeCount, + ServiceCounterDataType historyUpdateCount, + ServiceCounterDataType callCount, + ServiceCounterDataType createMonitoredItemsCount, + ServiceCounterDataType modifyMonitoredItemsCount, + ServiceCounterDataType setMonitoringModeCount, + ServiceCounterDataType setTriggeringCount, + ServiceCounterDataType deleteMonitoredItemsCount, + ServiceCounterDataType createSubscriptionCount, + ServiceCounterDataType modifySubscriptionCount, + ServiceCounterDataType setPublishingModeCount, + ServiceCounterDataType publishCount, + ServiceCounterDataType republishCount, + ServiceCounterDataType transferSubscriptionsCount, + ServiceCounterDataType deleteSubscriptionsCount, + ServiceCounterDataType addNodesCount, + ServiceCounterDataType addReferencesCount, + ServiceCounterDataType deleteNodesCount, + ServiceCounterDataType deleteReferencesCount, + ServiceCounterDataType browseCount, + ServiceCounterDataType browseNextCount, + ServiceCounterDataType translateBrowsePathsToNodeIdsCount, + ServiceCounterDataType queryFirstCount, + ServiceCounterDataType queryNextCount, + ServiceCounterDataType registerNodesCount, + ServiceCounterDataType unregisterNodesCount) { super(); this.sessionId = sessionId; this.sessionName = sessionName; this.clientDescription = clientDescription; this.serverUri = serverUri; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.actualSessionTimeout = actualSessionTimeout; this.maxResponseMessageSize = maxResponseMessageSize; @@ -188,7 +185,7 @@ public PascalString getSessionName() { return sessionName; } - public ExtensionObjectDefinition getClientDescription() { + public ApplicationDescription getClientDescription() { return clientDescription; } @@ -200,10 +197,6 @@ public PascalString getEndpointUrl() { return endpointUrl; } - public int getNoOfLocaleIds() { - return noOfLocaleIds; - } - public List getLocaleIds() { return localeIds; } @@ -236,7 +229,7 @@ public long getCurrentPublishRequestsInQueue() { return currentPublishRequestsInQueue; } - public ExtensionObjectDefinition getTotalRequestCount() { + public ServiceCounterDataType getTotalRequestCount() { return totalRequestCount; } @@ -244,115 +237,115 @@ public long getUnauthorizedRequestCount() { return unauthorizedRequestCount; } - public ExtensionObjectDefinition getReadCount() { + public ServiceCounterDataType getReadCount() { return readCount; } - public ExtensionObjectDefinition getHistoryReadCount() { + public ServiceCounterDataType getHistoryReadCount() { return historyReadCount; } - public ExtensionObjectDefinition getWriteCount() { + public ServiceCounterDataType getWriteCount() { return writeCount; } - public ExtensionObjectDefinition getHistoryUpdateCount() { + public ServiceCounterDataType getHistoryUpdateCount() { return historyUpdateCount; } - public ExtensionObjectDefinition getCallCount() { + public ServiceCounterDataType getCallCount() { return callCount; } - public ExtensionObjectDefinition getCreateMonitoredItemsCount() { + public ServiceCounterDataType getCreateMonitoredItemsCount() { return createMonitoredItemsCount; } - public ExtensionObjectDefinition getModifyMonitoredItemsCount() { + public ServiceCounterDataType getModifyMonitoredItemsCount() { return modifyMonitoredItemsCount; } - public ExtensionObjectDefinition getSetMonitoringModeCount() { + public ServiceCounterDataType getSetMonitoringModeCount() { return setMonitoringModeCount; } - public ExtensionObjectDefinition getSetTriggeringCount() { + public ServiceCounterDataType getSetTriggeringCount() { return setTriggeringCount; } - public ExtensionObjectDefinition getDeleteMonitoredItemsCount() { + public ServiceCounterDataType getDeleteMonitoredItemsCount() { return deleteMonitoredItemsCount; } - public ExtensionObjectDefinition getCreateSubscriptionCount() { + public ServiceCounterDataType getCreateSubscriptionCount() { return createSubscriptionCount; } - public ExtensionObjectDefinition getModifySubscriptionCount() { + public ServiceCounterDataType getModifySubscriptionCount() { return modifySubscriptionCount; } - public ExtensionObjectDefinition getSetPublishingModeCount() { + public ServiceCounterDataType getSetPublishingModeCount() { return setPublishingModeCount; } - public ExtensionObjectDefinition getPublishCount() { + public ServiceCounterDataType getPublishCount() { return publishCount; } - public ExtensionObjectDefinition getRepublishCount() { + public ServiceCounterDataType getRepublishCount() { return republishCount; } - public ExtensionObjectDefinition getTransferSubscriptionsCount() { + public ServiceCounterDataType getTransferSubscriptionsCount() { return transferSubscriptionsCount; } - public ExtensionObjectDefinition getDeleteSubscriptionsCount() { + public ServiceCounterDataType getDeleteSubscriptionsCount() { return deleteSubscriptionsCount; } - public ExtensionObjectDefinition getAddNodesCount() { + public ServiceCounterDataType getAddNodesCount() { return addNodesCount; } - public ExtensionObjectDefinition getAddReferencesCount() { + public ServiceCounterDataType getAddReferencesCount() { return addReferencesCount; } - public ExtensionObjectDefinition getDeleteNodesCount() { + public ServiceCounterDataType getDeleteNodesCount() { return deleteNodesCount; } - public ExtensionObjectDefinition getDeleteReferencesCount() { + public ServiceCounterDataType getDeleteReferencesCount() { return deleteReferencesCount; } - public ExtensionObjectDefinition getBrowseCount() { + public ServiceCounterDataType getBrowseCount() { return browseCount; } - public ExtensionObjectDefinition getBrowseNextCount() { + public ServiceCounterDataType getBrowseNextCount() { return browseNextCount; } - public ExtensionObjectDefinition getTranslateBrowsePathsToNodeIdsCount() { + public ServiceCounterDataType getTranslateBrowsePathsToNodeIdsCount() { return translateBrowsePathsToNodeIdsCount; } - public ExtensionObjectDefinition getQueryFirstCount() { + public ServiceCounterDataType getQueryFirstCount() { return queryFirstCount; } - public ExtensionObjectDefinition getQueryNextCount() { + public ServiceCounterDataType getQueryNextCount() { return queryNextCount; } - public ExtensionObjectDefinition getRegisterNodesCount() { + public ServiceCounterDataType getRegisterNodesCount() { return registerNodesCount; } - public ExtensionObjectDefinition getUnregisterNodesCount() { + public ServiceCounterDataType getUnregisterNodesCount() { return unregisterNodesCount; } @@ -378,8 +371,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (endpointUrl) writeSimpleField("endpointUrl", endpointUrl, writeComplex(writeBuffer)); - // Simple Field (noOfLocaleIds) - writeSimpleField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); // Array Field (localeIds) writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); @@ -543,7 +538,7 @@ public int getLengthInBits() { // Simple field (endpointUrl) lengthInBits += endpointUrl.getLengthInBits(); - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32; // Array field @@ -670,7 +665,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SessionDiagnosticsDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -682,11 +677,13 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "sessionName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - ExtensionObjectDefinition clientDescription = + ApplicationDescription clientDescription = readSimpleField( "clientDescription", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("310")), + () -> + (ApplicationDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (310)), readBuffer)); PascalString serverUri = @@ -697,7 +694,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readSimpleField( "endpointUrl", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - int noOfLocaleIds = readSimpleField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); List localeIds = readCountArrayField( @@ -726,210 +723,268 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit long currentPublishRequestsInQueue = readSimpleField("currentPublishRequestsInQueue", readUnsignedLong(readBuffer, 32)); - ExtensionObjectDefinition totalRequestCount = + ServiceCounterDataType totalRequestCount = readSimpleField( "totalRequestCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); long unauthorizedRequestCount = readSimpleField("unauthorizedRequestCount", readUnsignedLong(readBuffer, 32)); - ExtensionObjectDefinition readCount = + ServiceCounterDataType readCount = readSimpleField( "readCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition historyReadCount = + ServiceCounterDataType historyReadCount = readSimpleField( "historyReadCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition writeCount = + ServiceCounterDataType writeCount = readSimpleField( "writeCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition historyUpdateCount = + ServiceCounterDataType historyUpdateCount = readSimpleField( "historyUpdateCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition callCount = + ServiceCounterDataType callCount = readSimpleField( "callCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition createMonitoredItemsCount = + ServiceCounterDataType createMonitoredItemsCount = readSimpleField( "createMonitoredItemsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition modifyMonitoredItemsCount = + ServiceCounterDataType modifyMonitoredItemsCount = readSimpleField( "modifyMonitoredItemsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition setMonitoringModeCount = + ServiceCounterDataType setMonitoringModeCount = readSimpleField( "setMonitoringModeCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition setTriggeringCount = + ServiceCounterDataType setTriggeringCount = readSimpleField( "setTriggeringCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition deleteMonitoredItemsCount = + ServiceCounterDataType deleteMonitoredItemsCount = readSimpleField( "deleteMonitoredItemsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition createSubscriptionCount = + ServiceCounterDataType createSubscriptionCount = readSimpleField( "createSubscriptionCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition modifySubscriptionCount = + ServiceCounterDataType modifySubscriptionCount = readSimpleField( "modifySubscriptionCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition setPublishingModeCount = + ServiceCounterDataType setPublishingModeCount = readSimpleField( "setPublishingModeCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition publishCount = + ServiceCounterDataType publishCount = readSimpleField( "publishCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition republishCount = + ServiceCounterDataType republishCount = readSimpleField( "republishCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition transferSubscriptionsCount = + ServiceCounterDataType transferSubscriptionsCount = readSimpleField( "transferSubscriptionsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition deleteSubscriptionsCount = + ServiceCounterDataType deleteSubscriptionsCount = readSimpleField( "deleteSubscriptionsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition addNodesCount = + ServiceCounterDataType addNodesCount = readSimpleField( "addNodesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition addReferencesCount = + ServiceCounterDataType addReferencesCount = readSimpleField( "addReferencesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition deleteNodesCount = + ServiceCounterDataType deleteNodesCount = readSimpleField( "deleteNodesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition deleteReferencesCount = + ServiceCounterDataType deleteReferencesCount = readSimpleField( "deleteReferencesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition browseCount = + ServiceCounterDataType browseCount = readSimpleField( "browseCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition browseNextCount = + ServiceCounterDataType browseNextCount = readSimpleField( "browseNextCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition translateBrowsePathsToNodeIdsCount = + ServiceCounterDataType translateBrowsePathsToNodeIdsCount = readSimpleField( "translateBrowsePathsToNodeIdsCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition queryFirstCount = + ServiceCounterDataType queryFirstCount = readSimpleField( "queryFirstCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition queryNextCount = + ServiceCounterDataType queryNextCount = readSimpleField( "queryNextCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition registerNodesCount = + ServiceCounterDataType registerNodesCount = readSimpleField( "registerNodesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); - ExtensionObjectDefinition unregisterNodesCount = + ServiceCounterDataType unregisterNodesCount = readSimpleField( "unregisterNodesCount", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("873")), + () -> + (ServiceCounterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (873)), readBuffer)); readBuffer.closeContext("SessionDiagnosticsDataType"); @@ -940,7 +995,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit clientDescription, serverUri, endpointUrl, - noOfLocaleIds, localeIds, actualSessionTimeout, maxResponseMessageSize, @@ -985,10 +1039,9 @@ public static class SessionDiagnosticsDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final NodeId sessionId; private final PascalString sessionName; - private final ExtensionObjectDefinition clientDescription; + private final ApplicationDescription clientDescription; private final PascalString serverUri; private final PascalString endpointUrl; - private final int noOfLocaleIds; private final List localeIds; private final double actualSessionTimeout; private final long maxResponseMessageSize; @@ -997,44 +1050,43 @@ public static class SessionDiagnosticsDataTypeBuilderImpl private final long currentSubscriptionsCount; private final long currentMonitoredItemsCount; private final long currentPublishRequestsInQueue; - private final ExtensionObjectDefinition totalRequestCount; + private final ServiceCounterDataType totalRequestCount; private final long unauthorizedRequestCount; - private final ExtensionObjectDefinition readCount; - private final ExtensionObjectDefinition historyReadCount; - private final ExtensionObjectDefinition writeCount; - private final ExtensionObjectDefinition historyUpdateCount; - private final ExtensionObjectDefinition callCount; - private final ExtensionObjectDefinition createMonitoredItemsCount; - private final ExtensionObjectDefinition modifyMonitoredItemsCount; - private final ExtensionObjectDefinition setMonitoringModeCount; - private final ExtensionObjectDefinition setTriggeringCount; - private final ExtensionObjectDefinition deleteMonitoredItemsCount; - private final ExtensionObjectDefinition createSubscriptionCount; - private final ExtensionObjectDefinition modifySubscriptionCount; - private final ExtensionObjectDefinition setPublishingModeCount; - private final ExtensionObjectDefinition publishCount; - private final ExtensionObjectDefinition republishCount; - private final ExtensionObjectDefinition transferSubscriptionsCount; - private final ExtensionObjectDefinition deleteSubscriptionsCount; - private final ExtensionObjectDefinition addNodesCount; - private final ExtensionObjectDefinition addReferencesCount; - private final ExtensionObjectDefinition deleteNodesCount; - private final ExtensionObjectDefinition deleteReferencesCount; - private final ExtensionObjectDefinition browseCount; - private final ExtensionObjectDefinition browseNextCount; - private final ExtensionObjectDefinition translateBrowsePathsToNodeIdsCount; - private final ExtensionObjectDefinition queryFirstCount; - private final ExtensionObjectDefinition queryNextCount; - private final ExtensionObjectDefinition registerNodesCount; - private final ExtensionObjectDefinition unregisterNodesCount; + private final ServiceCounterDataType readCount; + private final ServiceCounterDataType historyReadCount; + private final ServiceCounterDataType writeCount; + private final ServiceCounterDataType historyUpdateCount; + private final ServiceCounterDataType callCount; + private final ServiceCounterDataType createMonitoredItemsCount; + private final ServiceCounterDataType modifyMonitoredItemsCount; + private final ServiceCounterDataType setMonitoringModeCount; + private final ServiceCounterDataType setTriggeringCount; + private final ServiceCounterDataType deleteMonitoredItemsCount; + private final ServiceCounterDataType createSubscriptionCount; + private final ServiceCounterDataType modifySubscriptionCount; + private final ServiceCounterDataType setPublishingModeCount; + private final ServiceCounterDataType publishCount; + private final ServiceCounterDataType republishCount; + private final ServiceCounterDataType transferSubscriptionsCount; + private final ServiceCounterDataType deleteSubscriptionsCount; + private final ServiceCounterDataType addNodesCount; + private final ServiceCounterDataType addReferencesCount; + private final ServiceCounterDataType deleteNodesCount; + private final ServiceCounterDataType deleteReferencesCount; + private final ServiceCounterDataType browseCount; + private final ServiceCounterDataType browseNextCount; + private final ServiceCounterDataType translateBrowsePathsToNodeIdsCount; + private final ServiceCounterDataType queryFirstCount; + private final ServiceCounterDataType queryNextCount; + private final ServiceCounterDataType registerNodesCount; + private final ServiceCounterDataType unregisterNodesCount; public SessionDiagnosticsDataTypeBuilderImpl( NodeId sessionId, PascalString sessionName, - ExtensionObjectDefinition clientDescription, + ApplicationDescription clientDescription, PascalString serverUri, PascalString endpointUrl, - int noOfLocaleIds, List localeIds, double actualSessionTimeout, long maxResponseMessageSize, @@ -1043,42 +1095,41 @@ public SessionDiagnosticsDataTypeBuilderImpl( long currentSubscriptionsCount, long currentMonitoredItemsCount, long currentPublishRequestsInQueue, - ExtensionObjectDefinition totalRequestCount, + ServiceCounterDataType totalRequestCount, long unauthorizedRequestCount, - ExtensionObjectDefinition readCount, - ExtensionObjectDefinition historyReadCount, - ExtensionObjectDefinition writeCount, - ExtensionObjectDefinition historyUpdateCount, - ExtensionObjectDefinition callCount, - ExtensionObjectDefinition createMonitoredItemsCount, - ExtensionObjectDefinition modifyMonitoredItemsCount, - ExtensionObjectDefinition setMonitoringModeCount, - ExtensionObjectDefinition setTriggeringCount, - ExtensionObjectDefinition deleteMonitoredItemsCount, - ExtensionObjectDefinition createSubscriptionCount, - ExtensionObjectDefinition modifySubscriptionCount, - ExtensionObjectDefinition setPublishingModeCount, - ExtensionObjectDefinition publishCount, - ExtensionObjectDefinition republishCount, - ExtensionObjectDefinition transferSubscriptionsCount, - ExtensionObjectDefinition deleteSubscriptionsCount, - ExtensionObjectDefinition addNodesCount, - ExtensionObjectDefinition addReferencesCount, - ExtensionObjectDefinition deleteNodesCount, - ExtensionObjectDefinition deleteReferencesCount, - ExtensionObjectDefinition browseCount, - ExtensionObjectDefinition browseNextCount, - ExtensionObjectDefinition translateBrowsePathsToNodeIdsCount, - ExtensionObjectDefinition queryFirstCount, - ExtensionObjectDefinition queryNextCount, - ExtensionObjectDefinition registerNodesCount, - ExtensionObjectDefinition unregisterNodesCount) { + ServiceCounterDataType readCount, + ServiceCounterDataType historyReadCount, + ServiceCounterDataType writeCount, + ServiceCounterDataType historyUpdateCount, + ServiceCounterDataType callCount, + ServiceCounterDataType createMonitoredItemsCount, + ServiceCounterDataType modifyMonitoredItemsCount, + ServiceCounterDataType setMonitoringModeCount, + ServiceCounterDataType setTriggeringCount, + ServiceCounterDataType deleteMonitoredItemsCount, + ServiceCounterDataType createSubscriptionCount, + ServiceCounterDataType modifySubscriptionCount, + ServiceCounterDataType setPublishingModeCount, + ServiceCounterDataType publishCount, + ServiceCounterDataType republishCount, + ServiceCounterDataType transferSubscriptionsCount, + ServiceCounterDataType deleteSubscriptionsCount, + ServiceCounterDataType addNodesCount, + ServiceCounterDataType addReferencesCount, + ServiceCounterDataType deleteNodesCount, + ServiceCounterDataType deleteReferencesCount, + ServiceCounterDataType browseCount, + ServiceCounterDataType browseNextCount, + ServiceCounterDataType translateBrowsePathsToNodeIdsCount, + ServiceCounterDataType queryFirstCount, + ServiceCounterDataType queryNextCount, + ServiceCounterDataType registerNodesCount, + ServiceCounterDataType unregisterNodesCount) { this.sessionId = sessionId; this.sessionName = sessionName; this.clientDescription = clientDescription; this.serverUri = serverUri; this.endpointUrl = endpointUrl; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.actualSessionTimeout = actualSessionTimeout; this.maxResponseMessageSize = maxResponseMessageSize; @@ -1127,7 +1178,6 @@ public SessionDiagnosticsDataType build() { clientDescription, serverUri, endpointUrl, - noOfLocaleIds, localeIds, actualSessionTimeout, maxResponseMessageSize, @@ -1184,7 +1234,6 @@ public boolean equals(Object o) { && (getClientDescription() == that.getClientDescription()) && (getServerUri() == that.getServerUri()) && (getEndpointUrl() == that.getEndpointUrl()) - && (getNoOfLocaleIds() == that.getNoOfLocaleIds()) && (getLocaleIds() == that.getLocaleIds()) && (getActualSessionTimeout() == that.getActualSessionTimeout()) && (getMaxResponseMessageSize() == that.getMaxResponseMessageSize()) @@ -1236,7 +1285,6 @@ public int hashCode() { getClientDescription(), getServerUri(), getEndpointUrl(), - getNoOfLocaleIds(), getLocaleIds(), getActualSessionTimeout(), getMaxResponseMessageSize(), diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionSecurityDiagnosticsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionSecurityDiagnosticsDataType.java index 18c512e6a5e..e98f1d1d73f 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionSecurityDiagnosticsDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionSecurityDiagnosticsDataType.java @@ -39,14 +39,13 @@ public class SessionSecurityDiagnosticsDataType extends ExtensionObjectDefinitio implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "870"; + public Integer getExtensionId() { + return (int) 870; } // Properties. protected final NodeId sessionId; protected final PascalString clientUserIdOfSession; - protected final int noOfClientUserIdHistory; protected final List clientUserIdHistory; protected final PascalString authenticationMechanism; protected final PascalString encoding; @@ -58,7 +57,6 @@ public String getIdentifier() { public SessionSecurityDiagnosticsDataType( NodeId sessionId, PascalString clientUserIdOfSession, - int noOfClientUserIdHistory, List clientUserIdHistory, PascalString authenticationMechanism, PascalString encoding, @@ -69,7 +67,6 @@ public SessionSecurityDiagnosticsDataType( super(); this.sessionId = sessionId; this.clientUserIdOfSession = clientUserIdOfSession; - this.noOfClientUserIdHistory = noOfClientUserIdHistory; this.clientUserIdHistory = clientUserIdHistory; this.authenticationMechanism = authenticationMechanism; this.encoding = encoding; @@ -87,10 +84,6 @@ public PascalString getClientUserIdOfSession() { return clientUserIdOfSession; } - public int getNoOfClientUserIdHistory() { - return noOfClientUserIdHistory; - } - public List getClientUserIdHistory() { return clientUserIdHistory; } @@ -132,8 +125,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (clientUserIdOfSession) writeSimpleField("clientUserIdOfSession", clientUserIdOfSession, writeComplex(writeBuffer)); - // Simple Field (noOfClientUserIdHistory) - writeSimpleField( + // Implicit Field (noOfClientUserIdHistory) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfClientUserIdHistory = + (int) ((((getClientUserIdHistory()) == (null)) ? -(1) : COUNT(getClientUserIdHistory()))); + writeImplicitField( "noOfClientUserIdHistory", noOfClientUserIdHistory, writeSignedInt(writeBuffer, 32)); // Array Field (clientUserIdHistory) @@ -184,7 +180,7 @@ public int getLengthInBits() { // Simple field (clientUserIdOfSession) lengthInBits += clientUserIdOfSession.getLengthInBits(); - // Simple field (noOfClientUserIdHistory) + // Implicit Field (noOfClientUserIdHistory) lengthInBits += 32; // Array field @@ -218,7 +214,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SessionSecurityDiagnosticsDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -232,7 +228,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); int noOfClientUserIdHistory = - readSimpleField("noOfClientUserIdHistory", readSignedInt(readBuffer, 32)); + readImplicitField("noOfClientUserIdHistory", readSignedInt(readBuffer, 32)); List clientUserIdHistory = readCountArrayField( @@ -275,7 +271,6 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit return new SessionSecurityDiagnosticsDataTypeBuilderImpl( sessionId, clientUserIdOfSession, - noOfClientUserIdHistory, clientUserIdHistory, authenticationMechanism, encoding, @@ -289,7 +284,6 @@ public static class SessionSecurityDiagnosticsDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final NodeId sessionId; private final PascalString clientUserIdOfSession; - private final int noOfClientUserIdHistory; private final List clientUserIdHistory; private final PascalString authenticationMechanism; private final PascalString encoding; @@ -301,7 +295,6 @@ public static class SessionSecurityDiagnosticsDataTypeBuilderImpl public SessionSecurityDiagnosticsDataTypeBuilderImpl( NodeId sessionId, PascalString clientUserIdOfSession, - int noOfClientUserIdHistory, List clientUserIdHistory, PascalString authenticationMechanism, PascalString encoding, @@ -311,7 +304,6 @@ public SessionSecurityDiagnosticsDataTypeBuilderImpl( PascalByteString clientCertificate) { this.sessionId = sessionId; this.clientUserIdOfSession = clientUserIdOfSession; - this.noOfClientUserIdHistory = noOfClientUserIdHistory; this.clientUserIdHistory = clientUserIdHistory; this.authenticationMechanism = authenticationMechanism; this.encoding = encoding; @@ -326,7 +318,6 @@ public SessionSecurityDiagnosticsDataType build() { new SessionSecurityDiagnosticsDataType( sessionId, clientUserIdOfSession, - noOfClientUserIdHistory, clientUserIdHistory, authenticationMechanism, encoding, @@ -349,7 +340,6 @@ public boolean equals(Object o) { SessionSecurityDiagnosticsDataType that = (SessionSecurityDiagnosticsDataType) o; return (getSessionId() == that.getSessionId()) && (getClientUserIdOfSession() == that.getClientUserIdOfSession()) - && (getNoOfClientUserIdHistory() == that.getNoOfClientUserIdHistory()) && (getClientUserIdHistory() == that.getClientUserIdHistory()) && (getAuthenticationMechanism() == that.getAuthenticationMechanism()) && (getEncoding() == that.getEncoding()) @@ -367,7 +357,6 @@ public int hashCode() { super.hashCode(), getSessionId(), getClientUserIdOfSession(), - getNoOfClientUserIdHistory(), getClientUserIdHistory(), getAuthenticationMechanism(), getEncoding(), diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeRequestType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeRequestType.java index 824b4f769ea..31844162d47 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeRequestType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeRequestType.java @@ -38,36 +38,27 @@ public class SessionlessInvokeRequestType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15903"; + public Integer getExtensionId() { + return (int) 15903; } // Properties. protected final long urisVersion; - protected final int noOfNamespaceUris; protected final List namespaceUris; - protected final int noOfServerUris; protected final List serverUris; - protected final int noOfLocaleIds; protected final List localeIds; protected final long serviceId; public SessionlessInvokeRequestType( long urisVersion, - int noOfNamespaceUris, List namespaceUris, - int noOfServerUris, List serverUris, - int noOfLocaleIds, List localeIds, long serviceId) { super(); this.urisVersion = urisVersion; - this.noOfNamespaceUris = noOfNamespaceUris; this.namespaceUris = namespaceUris; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.serviceId = serviceId; } @@ -76,26 +67,14 @@ public long getUrisVersion() { return urisVersion; } - public int getNoOfNamespaceUris() { - return noOfNamespaceUris; - } - public List getNamespaceUris() { return namespaceUris; } - public int getNoOfServerUris() { - return noOfServerUris; - } - public List getServerUris() { return serverUris; } - public int getNoOfLocaleIds() { - return noOfLocaleIds; - } - public List getLocaleIds() { return localeIds; } @@ -114,20 +93,27 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (urisVersion) writeSimpleField("urisVersion", urisVersion, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfNamespaceUris) - writeSimpleField("noOfNamespaceUris", noOfNamespaceUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNamespaceUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNamespaceUris = + (int) ((((getNamespaceUris()) == (null)) ? -(1) : COUNT(getNamespaceUris()))); + writeImplicitField("noOfNamespaceUris", noOfNamespaceUris, writeSignedInt(writeBuffer, 32)); // Array Field (namespaceUris) writeComplexTypeArrayField("namespaceUris", namespaceUris, writeBuffer); - // Simple Field (noOfServerUris) - writeSimpleField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServerUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServerUris = (int) ((((getServerUris()) == (null)) ? -(1) : COUNT(getServerUris()))); + writeImplicitField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); // Array Field (serverUris) writeComplexTypeArrayField("serverUris", serverUris, writeBuffer); - // Simple Field (noOfLocaleIds) - writeSimpleField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); // Array Field (localeIds) writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); @@ -152,7 +138,7 @@ public int getLengthInBits() { // Simple field (urisVersion) lengthInBits += 32; - // Simple field (noOfNamespaceUris) + // Implicit Field (noOfNamespaceUris) lengthInBits += 32; // Array field @@ -164,7 +150,7 @@ public int getLengthInBits() { } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32; // Array field @@ -176,7 +162,7 @@ public int getLengthInBits() { } } - // Simple field (noOfLocaleIds) + // Implicit Field (noOfLocaleIds) lengthInBits += 32; // Array field @@ -195,14 +181,14 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SessionlessInvokeRequestType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); long urisVersion = readSimpleField("urisVersion", readUnsignedLong(readBuffer, 32)); - int noOfNamespaceUris = readSimpleField("noOfNamespaceUris", readSignedInt(readBuffer, 32)); + int noOfNamespaceUris = readImplicitField("noOfNamespaceUris", readSignedInt(readBuffer, 32)); List namespaceUris = readCountArrayField( @@ -210,7 +196,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), noOfNamespaceUris); - int noOfServerUris = readSimpleField("noOfServerUris", readSignedInt(readBuffer, 32)); + int noOfServerUris = readImplicitField("noOfServerUris", readSignedInt(readBuffer, 32)); List serverUris = readCountArrayField( @@ -218,7 +204,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), noOfServerUris); - int noOfLocaleIds = readSimpleField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); List localeIds = readCountArrayField( @@ -231,42 +217,26 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SessionlessInvokeRequestType"); // Create the instance return new SessionlessInvokeRequestTypeBuilderImpl( - urisVersion, - noOfNamespaceUris, - namespaceUris, - noOfServerUris, - serverUris, - noOfLocaleIds, - localeIds, - serviceId); + urisVersion, namespaceUris, serverUris, localeIds, serviceId); } public static class SessionlessInvokeRequestTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final long urisVersion; - private final int noOfNamespaceUris; private final List namespaceUris; - private final int noOfServerUris; private final List serverUris; - private final int noOfLocaleIds; private final List localeIds; private final long serviceId; public SessionlessInvokeRequestTypeBuilderImpl( long urisVersion, - int noOfNamespaceUris, List namespaceUris, - int noOfServerUris, List serverUris, - int noOfLocaleIds, List localeIds, long serviceId) { this.urisVersion = urisVersion; - this.noOfNamespaceUris = noOfNamespaceUris; this.namespaceUris = namespaceUris; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; - this.noOfLocaleIds = noOfLocaleIds; this.localeIds = localeIds; this.serviceId = serviceId; } @@ -274,14 +244,7 @@ public SessionlessInvokeRequestTypeBuilderImpl( public SessionlessInvokeRequestType build() { SessionlessInvokeRequestType sessionlessInvokeRequestType = new SessionlessInvokeRequestType( - urisVersion, - noOfNamespaceUris, - namespaceUris, - noOfServerUris, - serverUris, - noOfLocaleIds, - localeIds, - serviceId); + urisVersion, namespaceUris, serverUris, localeIds, serviceId); return sessionlessInvokeRequestType; } } @@ -296,11 +259,8 @@ public boolean equals(Object o) { } SessionlessInvokeRequestType that = (SessionlessInvokeRequestType) o; return (getUrisVersion() == that.getUrisVersion()) - && (getNoOfNamespaceUris() == that.getNoOfNamespaceUris()) && (getNamespaceUris() == that.getNamespaceUris()) - && (getNoOfServerUris() == that.getNoOfServerUris()) && (getServerUris() == that.getServerUris()) - && (getNoOfLocaleIds() == that.getNoOfLocaleIds()) && (getLocaleIds() == that.getLocaleIds()) && (getServiceId() == that.getServiceId()) && super.equals(that) @@ -312,11 +272,8 @@ public int hashCode() { return Objects.hash( super.hashCode(), getUrisVersion(), - getNoOfNamespaceUris(), getNamespaceUris(), - getNoOfServerUris(), getServerUris(), - getNoOfLocaleIds(), getLocaleIds(), getServiceId()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeResponseType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeResponseType.java index 948e039ad00..1074d8bbd1b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeResponseType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SessionlessInvokeResponseType.java @@ -38,43 +38,27 @@ public class SessionlessInvokeResponseType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "21001"; + public Integer getExtensionId() { + return (int) 21001; } // Properties. - protected final int noOfNamespaceUris; protected final List namespaceUris; - protected final int noOfServerUris; protected final List serverUris; protected final long serviceId; public SessionlessInvokeResponseType( - int noOfNamespaceUris, - List namespaceUris, - int noOfServerUris, - List serverUris, - long serviceId) { + List namespaceUris, List serverUris, long serviceId) { super(); - this.noOfNamespaceUris = noOfNamespaceUris; this.namespaceUris = namespaceUris; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; this.serviceId = serviceId; } - public int getNoOfNamespaceUris() { - return noOfNamespaceUris; - } - public List getNamespaceUris() { return namespaceUris; } - public int getNoOfServerUris() { - return noOfServerUris; - } - public List getServerUris() { return serverUris; } @@ -90,14 +74,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("SessionlessInvokeResponseType"); - // Simple Field (noOfNamespaceUris) - writeSimpleField("noOfNamespaceUris", noOfNamespaceUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNamespaceUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNamespaceUris = + (int) ((((getNamespaceUris()) == (null)) ? -(1) : COUNT(getNamespaceUris()))); + writeImplicitField("noOfNamespaceUris", noOfNamespaceUris, writeSignedInt(writeBuffer, 32)); // Array Field (namespaceUris) writeComplexTypeArrayField("namespaceUris", namespaceUris, writeBuffer); - // Simple Field (noOfServerUris) - writeSimpleField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfServerUris) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfServerUris = (int) ((((getServerUris()) == (null)) ? -(1) : COUNT(getServerUris()))); + writeImplicitField("noOfServerUris", noOfServerUris, writeSignedInt(writeBuffer, 32)); // Array Field (serverUris) writeComplexTypeArrayField("serverUris", serverUris, writeBuffer); @@ -119,7 +108,7 @@ public int getLengthInBits() { SessionlessInvokeResponseType _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Simple field (noOfNamespaceUris) + // Implicit Field (noOfNamespaceUris) lengthInBits += 32; // Array field @@ -131,7 +120,7 @@ public int getLengthInBits() { } } - // Simple field (noOfServerUris) + // Implicit Field (noOfServerUris) lengthInBits += 32; // Array field @@ -150,12 +139,12 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SessionlessInvokeResponseType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int noOfNamespaceUris = readSimpleField("noOfNamespaceUris", readSignedInt(readBuffer, 32)); + int noOfNamespaceUris = readImplicitField("noOfNamespaceUris", readSignedInt(readBuffer, 32)); List namespaceUris = readCountArrayField( @@ -163,7 +152,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), noOfNamespaceUris); - int noOfServerUris = readSimpleField("noOfServerUris", readSignedInt(readBuffer, 32)); + int noOfServerUris = readImplicitField("noOfServerUris", readSignedInt(readBuffer, 32)); List serverUris = readCountArrayField( @@ -175,35 +164,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SessionlessInvokeResponseType"); // Create the instance - return new SessionlessInvokeResponseTypeBuilderImpl( - noOfNamespaceUris, namespaceUris, noOfServerUris, serverUris, serviceId); + return new SessionlessInvokeResponseTypeBuilderImpl(namespaceUris, serverUris, serviceId); } public static class SessionlessInvokeResponseTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final int noOfNamespaceUris; private final List namespaceUris; - private final int noOfServerUris; private final List serverUris; private final long serviceId; public SessionlessInvokeResponseTypeBuilderImpl( - int noOfNamespaceUris, - List namespaceUris, - int noOfServerUris, - List serverUris, - long serviceId) { - this.noOfNamespaceUris = noOfNamespaceUris; + List namespaceUris, List serverUris, long serviceId) { this.namespaceUris = namespaceUris; - this.noOfServerUris = noOfServerUris; this.serverUris = serverUris; this.serviceId = serviceId; } public SessionlessInvokeResponseType build() { SessionlessInvokeResponseType sessionlessInvokeResponseType = - new SessionlessInvokeResponseType( - noOfNamespaceUris, namespaceUris, noOfServerUris, serverUris, serviceId); + new SessionlessInvokeResponseType(namespaceUris, serverUris, serviceId); return sessionlessInvokeResponseType; } } @@ -217,9 +196,7 @@ public boolean equals(Object o) { return false; } SessionlessInvokeResponseType that = (SessionlessInvokeResponseType) o; - return (getNoOfNamespaceUris() == that.getNoOfNamespaceUris()) - && (getNamespaceUris() == that.getNamespaceUris()) - && (getNoOfServerUris() == that.getNoOfServerUris()) + return (getNamespaceUris() == that.getNamespaceUris()) && (getServerUris() == that.getServerUris()) && (getServiceId() == that.getServiceId()) && super.equals(that) @@ -228,13 +205,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getNoOfNamespaceUris(), - getNamespaceUris(), - getNoOfServerUris(), - getServerUris(), - getServiceId()); + return Objects.hash(super.hashCode(), getNamespaceUris(), getServerUris(), getServiceId()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeRequest.java index e696741a04b..469fc8a5066 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeRequest.java @@ -38,32 +38,29 @@ public class SetMonitoringModeRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "769"; + public Integer getExtensionId() { + return (int) 769; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final MonitoringMode monitoringMode; - protected final int noOfMonitoredItemIds; protected final List monitoredItemIds; public SetMonitoringModeRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, MonitoringMode monitoringMode, - int noOfMonitoredItemIds, List monitoredItemIds) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.monitoringMode = monitoringMode; - this.noOfMonitoredItemIds = noOfMonitoredItemIds; this.monitoredItemIds = monitoredItemIds; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -75,10 +72,6 @@ public MonitoringMode getMonitoringMode() { return monitoringMode; } - public int getNoOfMonitoredItemIds() { - return noOfMonitoredItemIds; - } - public List getMonitoredItemIds() { return monitoredItemIds; } @@ -104,8 +97,12 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) writeEnum( MonitoringMode::getValue, MonitoringMode::name, writeUnsignedLong(writeBuffer, 32))); - // Simple Field (noOfMonitoredItemIds) - writeSimpleField("noOfMonitoredItemIds", noOfMonitoredItemIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfMonitoredItemIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfMonitoredItemIds = + (int) ((((getMonitoredItemIds()) == (null)) ? -(1) : COUNT(getMonitoredItemIds()))); + writeImplicitField( + "noOfMonitoredItemIds", noOfMonitoredItemIds, writeSignedInt(writeBuffer, 32)); // Array Field (monitoredItemIds) writeSimpleTypeArrayField( @@ -134,7 +131,7 @@ public int getLengthInBits() { // Simple field (monitoringMode) lengthInBits += 32; - // Simple field (noOfMonitoredItemIds) + // Implicit Field (noOfMonitoredItemIds) lengthInBits += 32; // Array field @@ -146,16 +143,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetMonitoringModeRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); @@ -167,7 +165,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readEnum(MonitoringMode::enumForValue, readUnsignedLong(readBuffer, 32))); int noOfMonitoredItemIds = - readSimpleField("noOfMonitoredItemIds", readSignedInt(readBuffer, 32)); + readImplicitField("noOfMonitoredItemIds", readSignedInt(readBuffer, 32)); List monitoredItemIds = readCountArrayField( @@ -176,38 +174,31 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetMonitoringModeRequest"); // Create the instance return new SetMonitoringModeRequestBuilderImpl( - requestHeader, subscriptionId, monitoringMode, noOfMonitoredItemIds, monitoredItemIds); + requestHeader, subscriptionId, monitoringMode, monitoredItemIds); } public static class SetMonitoringModeRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final MonitoringMode monitoringMode; - private final int noOfMonitoredItemIds; private final List monitoredItemIds; public SetMonitoringModeRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, MonitoringMode monitoringMode, - int noOfMonitoredItemIds, List monitoredItemIds) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.monitoringMode = monitoringMode; - this.noOfMonitoredItemIds = noOfMonitoredItemIds; this.monitoredItemIds = monitoredItemIds; } public SetMonitoringModeRequest build() { SetMonitoringModeRequest setMonitoringModeRequest = new SetMonitoringModeRequest( - requestHeader, - subscriptionId, - monitoringMode, - noOfMonitoredItemIds, - monitoredItemIds); + requestHeader, subscriptionId, monitoringMode, monitoredItemIds); return setMonitoringModeRequest; } } @@ -224,7 +215,6 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getSubscriptionId() == that.getSubscriptionId()) && (getMonitoringMode() == that.getMonitoringMode()) - && (getNoOfMonitoredItemIds() == that.getNoOfMonitoredItemIds()) && (getMonitoredItemIds() == that.getMonitoredItemIds()) && super.equals(that) && true; @@ -237,7 +227,6 @@ public int hashCode() { getRequestHeader(), getSubscriptionId(), getMonitoringMode(), - getNoOfMonitoredItemIds(), getMonitoredItemIds()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeResponse.java index a61744ed3c7..1e1e2ff4ff7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetMonitoringModeResponse.java @@ -38,47 +38,33 @@ public class SetMonitoringModeResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "772"; + public Integer getExtensionId() { + return (int) 772; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public SetMonitoringModeResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetMonitoringModeResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetMonitoringModeResponse"); // Create the instance - return new SetMonitoringModeResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new SetMonitoringModeResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class SetMonitoringModeResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public SetMonitoringModeResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public SetMonitoringModeResponse build() { SetMonitoringModeResponse setMonitoringModeResponse = - new SetMonitoringModeResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new SetMonitoringModeResponse(responseHeader, results, diagnosticInfos); return setMonitoringModeResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } SetMonitoringModeResponse that = (SetMonitoringModeResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeRequest.java index 8ee495720cc..ebfc25df312 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeRequest.java @@ -38,29 +38,24 @@ public class SetPublishingModeRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "799"; + public Integer getExtensionId() { + return (int) 799; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final boolean publishingEnabled; - protected final int noOfSubscriptionIds; protected final List subscriptionIds; public SetPublishingModeRequest( - ExtensionObjectDefinition requestHeader, - boolean publishingEnabled, - int noOfSubscriptionIds, - List subscriptionIds) { + RequestHeader requestHeader, boolean publishingEnabled, List subscriptionIds) { super(); this.requestHeader = requestHeader; this.publishingEnabled = publishingEnabled; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -68,10 +63,6 @@ public boolean getPublishingEnabled() { return publishingEnabled; } - public int getNoOfSubscriptionIds() { - return noOfSubscriptionIds; - } - public List getSubscriptionIds() { return subscriptionIds; } @@ -92,8 +83,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (publishingEnabled) writeSimpleField("publishingEnabled", publishingEnabled, writeBoolean(writeBuffer)); - // Simple Field (noOfSubscriptionIds) - writeSimpleField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfSubscriptionIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSubscriptionIds = + (int) ((((getSubscriptionIds()) == (null)) ? -(1) : COUNT(getSubscriptionIds()))); + writeImplicitField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); // Array Field (subscriptionIds) writeSimpleTypeArrayField( @@ -122,7 +116,7 @@ public int getLengthInBits() { // Simple field (publishingEnabled) lengthInBits += 1; - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32; // Array field @@ -134,16 +128,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetPublishingModeRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); Byte reservedField0 = @@ -151,7 +146,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit boolean publishingEnabled = readSimpleField("publishingEnabled", readBoolean(readBuffer)); - int noOfSubscriptionIds = readSimpleField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); + int noOfSubscriptionIds = + readImplicitField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); List subscriptionIds = readCountArrayField( @@ -160,31 +156,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetPublishingModeRequest"); // Create the instance return new SetPublishingModeRequestBuilderImpl( - requestHeader, publishingEnabled, noOfSubscriptionIds, subscriptionIds); + requestHeader, publishingEnabled, subscriptionIds); } public static class SetPublishingModeRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final boolean publishingEnabled; - private final int noOfSubscriptionIds; private final List subscriptionIds; public SetPublishingModeRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - boolean publishingEnabled, - int noOfSubscriptionIds, - List subscriptionIds) { + RequestHeader requestHeader, boolean publishingEnabled, List subscriptionIds) { this.requestHeader = requestHeader; this.publishingEnabled = publishingEnabled; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; } public SetPublishingModeRequest build() { SetPublishingModeRequest setPublishingModeRequest = - new SetPublishingModeRequest( - requestHeader, publishingEnabled, noOfSubscriptionIds, subscriptionIds); + new SetPublishingModeRequest(requestHeader, publishingEnabled, subscriptionIds); return setPublishingModeRequest; } } @@ -200,7 +190,6 @@ public boolean equals(Object o) { SetPublishingModeRequest that = (SetPublishingModeRequest) o; return (getRequestHeader() == that.getRequestHeader()) && (getPublishingEnabled() == that.getPublishingEnabled()) - && (getNoOfSubscriptionIds() == that.getNoOfSubscriptionIds()) && (getSubscriptionIds() == that.getSubscriptionIds()) && super.equals(that) && true; @@ -209,11 +198,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getPublishingEnabled(), - getNoOfSubscriptionIds(), - getSubscriptionIds()); + super.hashCode(), getRequestHeader(), getPublishingEnabled(), getSubscriptionIds()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeResponse.java index 648f2da2dd7..8fb068f5a50 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetPublishingModeResponse.java @@ -38,47 +38,33 @@ public class SetPublishingModeResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "802"; + public Integer getExtensionId() { + return (int) 802; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public SetPublishingModeResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetPublishingModeResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetPublishingModeResponse"); // Create the instance - return new SetPublishingModeResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new SetPublishingModeResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class SetPublishingModeResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public SetPublishingModeResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public SetPublishingModeResponse build() { SetPublishingModeResponse setPublishingModeResponse = - new SetPublishingModeResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new SetPublishingModeResponse(responseHeader, results, diagnosticInfos); return setPublishingModeResponse; } } @@ -223,9 +208,7 @@ public boolean equals(Object o) { } SetPublishingModeResponse that = (SetPublishingModeResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +216,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringRequest.java index 270789e0846..1c3614df07c 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringRequest.java @@ -38,38 +38,32 @@ public class SetTriggeringRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "775"; + public Integer getExtensionId() { + return (int) 775; } // Properties. - protected final ExtensionObjectDefinition requestHeader; + protected final RequestHeader requestHeader; protected final long subscriptionId; protected final long triggeringItemId; - protected final int noOfLinksToAdd; protected final List linksToAdd; - protected final int noOfLinksToRemove; protected final List linksToRemove; public SetTriggeringRequest( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, long triggeringItemId, - int noOfLinksToAdd, List linksToAdd, - int noOfLinksToRemove, List linksToRemove) { super(); this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.triggeringItemId = triggeringItemId; - this.noOfLinksToAdd = noOfLinksToAdd; this.linksToAdd = linksToAdd; - this.noOfLinksToRemove = noOfLinksToRemove; this.linksToRemove = linksToRemove; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } @@ -81,18 +75,10 @@ public long getTriggeringItemId() { return triggeringItemId; } - public int getNoOfLinksToAdd() { - return noOfLinksToAdd; - } - public List getLinksToAdd() { return linksToAdd; } - public int getNoOfLinksToRemove() { - return noOfLinksToRemove; - } - public List getLinksToRemove() { return linksToRemove; } @@ -113,14 +99,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (triggeringItemId) writeSimpleField("triggeringItemId", triggeringItemId, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfLinksToAdd) - writeSimpleField("noOfLinksToAdd", noOfLinksToAdd, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLinksToAdd) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLinksToAdd = (int) ((((getLinksToAdd()) == (null)) ? -(1) : COUNT(getLinksToAdd()))); + writeImplicitField("noOfLinksToAdd", noOfLinksToAdd, writeSignedInt(writeBuffer, 32)); // Array Field (linksToAdd) writeSimpleTypeArrayField("linksToAdd", linksToAdd, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfLinksToRemove) - writeSimpleField("noOfLinksToRemove", noOfLinksToRemove, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfLinksToRemove) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLinksToRemove = + (int) ((((getLinksToRemove()) == (null)) ? -(1) : COUNT(getLinksToRemove()))); + writeImplicitField("noOfLinksToRemove", noOfLinksToRemove, writeSignedInt(writeBuffer, 32)); // Array Field (linksToRemove) writeSimpleTypeArrayField("linksToRemove", linksToRemove, writeUnsignedLong(writeBuffer, 32)); @@ -148,7 +139,7 @@ public int getLengthInBits() { // Simple field (triggeringItemId) lengthInBits += 32; - // Simple field (noOfLinksToAdd) + // Implicit Field (noOfLinksToAdd) lengthInBits += 32; // Array field @@ -156,7 +147,7 @@ public int getLengthInBits() { lengthInBits += 32 * linksToAdd.size(); } - // Simple field (noOfLinksToRemove) + // Implicit Field (noOfLinksToRemove) lengthInBits += 32; // Array field @@ -168,28 +159,29 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetTriggeringRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); long subscriptionId = readSimpleField("subscriptionId", readUnsignedLong(readBuffer, 32)); long triggeringItemId = readSimpleField("triggeringItemId", readUnsignedLong(readBuffer, 32)); - int noOfLinksToAdd = readSimpleField("noOfLinksToAdd", readSignedInt(readBuffer, 32)); + int noOfLinksToAdd = readImplicitField("noOfLinksToAdd", readSignedInt(readBuffer, 32)); List linksToAdd = readCountArrayField("linksToAdd", readUnsignedLong(readBuffer, 32), noOfLinksToAdd); - int noOfLinksToRemove = readSimpleField("noOfLinksToRemove", readSignedInt(readBuffer, 32)); + int noOfLinksToRemove = readImplicitField("noOfLinksToRemove", readSignedInt(readBuffer, 32)); List linksToRemove = readCountArrayField("linksToRemove", readUnsignedLong(readBuffer, 32), noOfLinksToRemove); @@ -197,52 +189,34 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetTriggeringRequest"); // Create the instance return new SetTriggeringRequestBuilderImpl( - requestHeader, - subscriptionId, - triggeringItemId, - noOfLinksToAdd, - linksToAdd, - noOfLinksToRemove, - linksToRemove); + requestHeader, subscriptionId, triggeringItemId, linksToAdd, linksToRemove); } public static class SetTriggeringRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; + private final RequestHeader requestHeader; private final long subscriptionId; private final long triggeringItemId; - private final int noOfLinksToAdd; private final List linksToAdd; - private final int noOfLinksToRemove; private final List linksToRemove; public SetTriggeringRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, + RequestHeader requestHeader, long subscriptionId, long triggeringItemId, - int noOfLinksToAdd, List linksToAdd, - int noOfLinksToRemove, List linksToRemove) { this.requestHeader = requestHeader; this.subscriptionId = subscriptionId; this.triggeringItemId = triggeringItemId; - this.noOfLinksToAdd = noOfLinksToAdd; this.linksToAdd = linksToAdd; - this.noOfLinksToRemove = noOfLinksToRemove; this.linksToRemove = linksToRemove; } public SetTriggeringRequest build() { SetTriggeringRequest setTriggeringRequest = new SetTriggeringRequest( - requestHeader, - subscriptionId, - triggeringItemId, - noOfLinksToAdd, - linksToAdd, - noOfLinksToRemove, - linksToRemove); + requestHeader, subscriptionId, triggeringItemId, linksToAdd, linksToRemove); return setTriggeringRequest; } } @@ -259,9 +233,7 @@ public boolean equals(Object o) { return (getRequestHeader() == that.getRequestHeader()) && (getSubscriptionId() == that.getSubscriptionId()) && (getTriggeringItemId() == that.getTriggeringItemId()) - && (getNoOfLinksToAdd() == that.getNoOfLinksToAdd()) && (getLinksToAdd() == that.getLinksToAdd()) - && (getNoOfLinksToRemove() == that.getNoOfLinksToRemove()) && (getLinksToRemove() == that.getLinksToRemove()) && super.equals(that) && true; @@ -274,9 +246,7 @@ public int hashCode() { getRequestHeader(), getSubscriptionId(), getTriggeringItemId(), - getNoOfLinksToAdd(), getLinksToAdd(), - getNoOfLinksToRemove(), getLinksToRemove()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringResponse.java index 28863e7865d..3b8682e20c8 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SetTriggeringResponse.java @@ -38,75 +38,47 @@ public class SetTriggeringResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "778"; + public Integer getExtensionId() { + return (int) 778; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfAddResults; + protected final ResponseHeader responseHeader; protected final List addResults; - protected final int noOfAddDiagnosticInfos; protected final List addDiagnosticInfos; - protected final int noOfRemoveResults; protected final List removeResults; - protected final int noOfRemoveDiagnosticInfos; protected final List removeDiagnosticInfos; public SetTriggeringResponse( - ExtensionObjectDefinition responseHeader, - int noOfAddResults, + ResponseHeader responseHeader, List addResults, - int noOfAddDiagnosticInfos, List addDiagnosticInfos, - int noOfRemoveResults, List removeResults, - int noOfRemoveDiagnosticInfos, List removeDiagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfAddResults = noOfAddResults; this.addResults = addResults; - this.noOfAddDiagnosticInfos = noOfAddDiagnosticInfos; this.addDiagnosticInfos = addDiagnosticInfos; - this.noOfRemoveResults = noOfRemoveResults; this.removeResults = removeResults; - this.noOfRemoveDiagnosticInfos = noOfRemoveDiagnosticInfos; this.removeDiagnosticInfos = removeDiagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfAddResults() { - return noOfAddResults; - } - public List getAddResults() { return addResults; } - public int getNoOfAddDiagnosticInfos() { - return noOfAddDiagnosticInfos; - } - public List getAddDiagnosticInfos() { return addDiagnosticInfos; } - public int getNoOfRemoveResults() { - return noOfRemoveResults; - } - public List getRemoveResults() { return removeResults; } - public int getNoOfRemoveDiagnosticInfos() { - return noOfRemoveDiagnosticInfos; - } - public List getRemoveDiagnosticInfos() { return removeDiagnosticInfos; } @@ -121,27 +93,39 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfAddResults) - writeSimpleField("noOfAddResults", noOfAddResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfAddResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfAddResults = (int) ((((getAddResults()) == (null)) ? -(1) : COUNT(getAddResults()))); + writeImplicitField("noOfAddResults", noOfAddResults, writeSignedInt(writeBuffer, 32)); // Array Field (addResults) writeComplexTypeArrayField("addResults", addResults, writeBuffer); - // Simple Field (noOfAddDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfAddDiagnosticInfos) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfAddDiagnosticInfos = + (int) ((((getAddDiagnosticInfos()) == (null)) ? -(1) : COUNT(getAddDiagnosticInfos()))); + writeImplicitField( "noOfAddDiagnosticInfos", noOfAddDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (addDiagnosticInfos) writeComplexTypeArrayField("addDiagnosticInfos", addDiagnosticInfos, writeBuffer); - // Simple Field (noOfRemoveResults) - writeSimpleField("noOfRemoveResults", noOfRemoveResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfRemoveResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfRemoveResults = + (int) ((((getRemoveResults()) == (null)) ? -(1) : COUNT(getRemoveResults()))); + writeImplicitField("noOfRemoveResults", noOfRemoveResults, writeSignedInt(writeBuffer, 32)); // Array Field (removeResults) writeComplexTypeArrayField("removeResults", removeResults, writeBuffer); - // Simple Field (noOfRemoveDiagnosticInfos) - writeSimpleField( + // Implicit Field (noOfRemoveDiagnosticInfos) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfRemoveDiagnosticInfos = + (int) + ((((getRemoveDiagnosticInfos()) == (null)) ? -(1) : COUNT(getRemoveDiagnosticInfos()))); + writeImplicitField( "noOfRemoveDiagnosticInfos", noOfRemoveDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (removeDiagnosticInfos) @@ -164,7 +148,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfAddResults) + // Implicit Field (noOfAddResults) lengthInBits += 32; // Array field @@ -176,7 +160,7 @@ public int getLengthInBits() { } } - // Simple field (noOfAddDiagnosticInfos) + // Implicit Field (noOfAddDiagnosticInfos) lengthInBits += 32; // Array field @@ -188,7 +172,7 @@ public int getLengthInBits() { } } - // Simple field (noOfRemoveResults) + // Implicit Field (noOfRemoveResults) lengthInBits += 32; // Array field @@ -200,7 +184,7 @@ public int getLengthInBits() { } } - // Simple field (noOfRemoveDiagnosticInfos) + // Implicit Field (noOfRemoveDiagnosticInfos) lengthInBits += 32; // Array field @@ -216,19 +200,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SetTriggeringResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfAddResults = readSimpleField("noOfAddResults", readSignedInt(readBuffer, 32)); + int noOfAddResults = readImplicitField("noOfAddResults", readSignedInt(readBuffer, 32)); List addResults = readCountArrayField( @@ -237,7 +222,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfAddResults); int noOfAddDiagnosticInfos = - readSimpleField("noOfAddDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfAddDiagnosticInfos", readSignedInt(readBuffer, 32)); List addDiagnosticInfos = readCountArrayField( @@ -245,7 +230,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> DiagnosticInfo.staticParse(readBuffer), readBuffer), noOfAddDiagnosticInfos); - int noOfRemoveResults = readSimpleField("noOfRemoveResults", readSignedInt(readBuffer, 32)); + int noOfRemoveResults = readImplicitField("noOfRemoveResults", readSignedInt(readBuffer, 32)); List removeResults = readCountArrayField( @@ -254,7 +239,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfRemoveResults); int noOfRemoveDiagnosticInfos = - readSimpleField("noOfRemoveDiagnosticInfos", readSignedInt(readBuffer, 32)); + readImplicitField("noOfRemoveDiagnosticInfos", readSignedInt(readBuffer, 32)); List removeDiagnosticInfos = readCountArrayField( @@ -265,62 +250,34 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("SetTriggeringResponse"); // Create the instance return new SetTriggeringResponseBuilderImpl( - responseHeader, - noOfAddResults, - addResults, - noOfAddDiagnosticInfos, - addDiagnosticInfos, - noOfRemoveResults, - removeResults, - noOfRemoveDiagnosticInfos, - removeDiagnosticInfos); + responseHeader, addResults, addDiagnosticInfos, removeResults, removeDiagnosticInfos); } public static class SetTriggeringResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfAddResults; + private final ResponseHeader responseHeader; private final List addResults; - private final int noOfAddDiagnosticInfos; private final List addDiagnosticInfos; - private final int noOfRemoveResults; private final List removeResults; - private final int noOfRemoveDiagnosticInfos; private final List removeDiagnosticInfos; public SetTriggeringResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfAddResults, + ResponseHeader responseHeader, List addResults, - int noOfAddDiagnosticInfos, List addDiagnosticInfos, - int noOfRemoveResults, List removeResults, - int noOfRemoveDiagnosticInfos, List removeDiagnosticInfos) { this.responseHeader = responseHeader; - this.noOfAddResults = noOfAddResults; this.addResults = addResults; - this.noOfAddDiagnosticInfos = noOfAddDiagnosticInfos; this.addDiagnosticInfos = addDiagnosticInfos; - this.noOfRemoveResults = noOfRemoveResults; this.removeResults = removeResults; - this.noOfRemoveDiagnosticInfos = noOfRemoveDiagnosticInfos; this.removeDiagnosticInfos = removeDiagnosticInfos; } public SetTriggeringResponse build() { SetTriggeringResponse setTriggeringResponse = new SetTriggeringResponse( - responseHeader, - noOfAddResults, - addResults, - noOfAddDiagnosticInfos, - addDiagnosticInfos, - noOfRemoveResults, - removeResults, - noOfRemoveDiagnosticInfos, - removeDiagnosticInfos); + responseHeader, addResults, addDiagnosticInfos, removeResults, removeDiagnosticInfos); return setTriggeringResponse; } } @@ -335,13 +292,9 @@ public boolean equals(Object o) { } SetTriggeringResponse that = (SetTriggeringResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfAddResults() == that.getNoOfAddResults()) && (getAddResults() == that.getAddResults()) - && (getNoOfAddDiagnosticInfos() == that.getNoOfAddDiagnosticInfos()) && (getAddDiagnosticInfos() == that.getAddDiagnosticInfos()) - && (getNoOfRemoveResults() == that.getNoOfRemoveResults()) && (getRemoveResults() == that.getRemoveResults()) - && (getNoOfRemoveDiagnosticInfos() == that.getNoOfRemoveDiagnosticInfos()) && (getRemoveDiagnosticInfos() == that.getRemoveDiagnosticInfos()) && super.equals(that) && true; @@ -352,13 +305,9 @@ public int hashCode() { return Objects.hash( super.hashCode(), getResponseHeader(), - getNoOfAddResults(), getAddResults(), - getNoOfAddDiagnosticInfos(), getAddDiagnosticInfos(), - getNoOfRemoveResults(), getRemoveResults(), - getNoOfRemoveDiagnosticInfos(), getRemoveDiagnosticInfos()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignatureData.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignatureData.java index 8d8eadc2fdf..3c507274efa 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignatureData.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignatureData.java @@ -38,8 +38,8 @@ public class SignatureData extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "458"; + public Integer getExtensionId() { + return (int) 458; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SignatureData"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignedSoftwareCertificate.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignedSoftwareCertificate.java index 93ff1cdc0cb..a2c77f72e46 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignedSoftwareCertificate.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SignedSoftwareCertificate.java @@ -38,8 +38,8 @@ public class SignedSoftwareCertificate extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "346"; + public Integer getExtensionId() { + return (int) 346; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SignedSoftwareCertificate"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleAttributeOperand.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleAttributeOperand.java new file mode 100644 index 00000000000..198bdfcccc2 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleAttributeOperand.java @@ -0,0 +1,233 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class SimpleAttributeOperand extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 603; + } + + // Properties. + protected final NodeId typeDefinitionId; + protected final List browsePath; + protected final long attributeId; + protected final PascalString indexRange; + + public SimpleAttributeOperand( + NodeId typeDefinitionId, + List browsePath, + long attributeId, + PascalString indexRange) { + super(); + this.typeDefinitionId = typeDefinitionId; + this.browsePath = browsePath; + this.attributeId = attributeId; + this.indexRange = indexRange; + } + + public NodeId getTypeDefinitionId() { + return typeDefinitionId; + } + + public List getBrowsePath() { + return browsePath; + } + + public long getAttributeId() { + return attributeId; + } + + public PascalString getIndexRange() { + return indexRange; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("SimpleAttributeOperand"); + + // Simple Field (typeDefinitionId) + writeSimpleField("typeDefinitionId", typeDefinitionId, writeComplex(writeBuffer)); + + // Implicit Field (noOfBrowsePath) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfBrowsePath = (int) ((((getBrowsePath()) == (null)) ? -(1) : COUNT(getBrowsePath()))); + writeImplicitField("noOfBrowsePath", noOfBrowsePath, writeSignedInt(writeBuffer, 32)); + + // Array Field (browsePath) + writeComplexTypeArrayField("browsePath", browsePath, writeBuffer); + + // Simple Field (attributeId) + writeSimpleField("attributeId", attributeId, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (indexRange) + writeSimpleField("indexRange", indexRange, writeComplex(writeBuffer)); + + writeBuffer.popContext("SimpleAttributeOperand"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + SimpleAttributeOperand _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (typeDefinitionId) + lengthInBits += typeDefinitionId.getLengthInBits(); + + // Implicit Field (noOfBrowsePath) + lengthInBits += 32; + + // Array field + if (browsePath != null) { + int i = 0; + for (QualifiedName element : browsePath) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= browsePath.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (attributeId) + lengthInBits += 32; + + // Simple field (indexRange) + lengthInBits += indexRange.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("SimpleAttributeOperand"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId typeDefinitionId = + readSimpleField( + "typeDefinitionId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int noOfBrowsePath = readImplicitField("noOfBrowsePath", readSignedInt(readBuffer, 32)); + + List browsePath = + readCountArrayField( + "browsePath", + readComplex(() -> QualifiedName.staticParse(readBuffer), readBuffer), + noOfBrowsePath); + + long attributeId = readSimpleField("attributeId", readUnsignedLong(readBuffer, 32)); + + PascalString indexRange = + readSimpleField( + "indexRange", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("SimpleAttributeOperand"); + // Create the instance + return new SimpleAttributeOperandBuilderImpl( + typeDefinitionId, browsePath, attributeId, indexRange); + } + + public static class SimpleAttributeOperandBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId typeDefinitionId; + private final List browsePath; + private final long attributeId; + private final PascalString indexRange; + + public SimpleAttributeOperandBuilderImpl( + NodeId typeDefinitionId, + List browsePath, + long attributeId, + PascalString indexRange) { + this.typeDefinitionId = typeDefinitionId; + this.browsePath = browsePath; + this.attributeId = attributeId; + this.indexRange = indexRange; + } + + public SimpleAttributeOperand build() { + SimpleAttributeOperand simpleAttributeOperand = + new SimpleAttributeOperand(typeDefinitionId, browsePath, attributeId, indexRange); + return simpleAttributeOperand; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SimpleAttributeOperand)) { + return false; + } + SimpleAttributeOperand that = (SimpleAttributeOperand) o; + return (getTypeDefinitionId() == that.getTypeDefinitionId()) + && (getBrowsePath() == that.getBrowsePath()) + && (getAttributeId() == that.getAttributeId()) + && (getIndexRange() == that.getIndexRange()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getTypeDefinitionId(), + getBrowsePath(), + getAttributeId(), + getIndexRange()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleTypeDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleTypeDescription.java new file mode 100644 index 00000000000..071ead11e9d --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SimpleTypeDescription.java @@ -0,0 +1,204 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class SimpleTypeDescription extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15007; + } + + // Properties. + protected final NodeId dataTypeId; + protected final QualifiedName name; + protected final NodeId baseDataType; + protected final short builtInType; + + public SimpleTypeDescription( + NodeId dataTypeId, QualifiedName name, NodeId baseDataType, short builtInType) { + super(); + this.dataTypeId = dataTypeId; + this.name = name; + this.baseDataType = baseDataType; + this.builtInType = builtInType; + } + + public NodeId getDataTypeId() { + return dataTypeId; + } + + public QualifiedName getName() { + return name; + } + + public NodeId getBaseDataType() { + return baseDataType; + } + + public short getBuiltInType() { + return builtInType; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("SimpleTypeDescription"); + + // Simple Field (dataTypeId) + writeSimpleField("dataTypeId", dataTypeId, writeComplex(writeBuffer)); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Simple Field (baseDataType) + writeSimpleField("baseDataType", baseDataType, writeComplex(writeBuffer)); + + // Simple Field (builtInType) + writeSimpleField("builtInType", builtInType, writeUnsignedShort(writeBuffer, 8)); + + writeBuffer.popContext("SimpleTypeDescription"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + SimpleTypeDescription _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataTypeId) + lengthInBits += dataTypeId.getLengthInBits(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Simple field (baseDataType) + lengthInBits += baseDataType.getLengthInBits(); + + // Simple field (builtInType) + lengthInBits += 8; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("SimpleTypeDescription"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId dataTypeId = + readSimpleField( + "dataTypeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + QualifiedName name = + readSimpleField( + "name", readComplex(() -> QualifiedName.staticParse(readBuffer), readBuffer)); + + NodeId baseDataType = + readSimpleField( + "baseDataType", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + short builtInType = readSimpleField("builtInType", readUnsignedShort(readBuffer, 8)); + + readBuffer.closeContext("SimpleTypeDescription"); + // Create the instance + return new SimpleTypeDescriptionBuilderImpl(dataTypeId, name, baseDataType, builtInType); + } + + public static class SimpleTypeDescriptionBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId dataTypeId; + private final QualifiedName name; + private final NodeId baseDataType; + private final short builtInType; + + public SimpleTypeDescriptionBuilderImpl( + NodeId dataTypeId, QualifiedName name, NodeId baseDataType, short builtInType) { + this.dataTypeId = dataTypeId; + this.name = name; + this.baseDataType = baseDataType; + this.builtInType = builtInType; + } + + public SimpleTypeDescription build() { + SimpleTypeDescription simpleTypeDescription = + new SimpleTypeDescription(dataTypeId, name, baseDataType, builtInType); + return simpleTypeDescription; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SimpleTypeDescription)) { + return false; + } + SimpleTypeDescription that = (SimpleTypeDescription) o; + return (getDataTypeId() == that.getDataTypeId()) + && (getName() == that.getName()) + && (getBaseDataType() == that.getBaseDataType()) + && (getBuiltInType() == that.getBuiltInType()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getDataTypeId(), getName(), getBaseDataType(), getBuiltInType()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetDataType.java new file mode 100644 index 00000000000..a50d6a5ebe1 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetDataType.java @@ -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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class StandaloneSubscribedDataSetDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23602; + } + + // Properties. + protected final PascalString name; + protected final List dataSetFolder; + protected final DataSetMetaDataType dataSetMetaData; + protected final ExtensionObject subscribedDataSet; + + public StandaloneSubscribedDataSetDataType( + PascalString name, + List dataSetFolder, + DataSetMetaDataType dataSetMetaData, + ExtensionObject subscribedDataSet) { + super(); + this.name = name; + this.dataSetFolder = dataSetFolder; + this.dataSetMetaData = dataSetMetaData; + this.subscribedDataSet = subscribedDataSet; + } + + public PascalString getName() { + return name; + } + + public List getDataSetFolder() { + return dataSetFolder; + } + + public DataSetMetaDataType getDataSetMetaData() { + return dataSetMetaData; + } + + public ExtensionObject getSubscribedDataSet() { + return subscribedDataSet; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("StandaloneSubscribedDataSetDataType"); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Implicit Field (noOfDataSetFolder) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataSetFolder = + (int) ((((getDataSetFolder()) == (null)) ? -(1) : COUNT(getDataSetFolder()))); + writeImplicitField("noOfDataSetFolder", noOfDataSetFolder, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetFolder) + writeComplexTypeArrayField("dataSetFolder", dataSetFolder, writeBuffer); + + // Simple Field (dataSetMetaData) + writeSimpleField("dataSetMetaData", dataSetMetaData, writeComplex(writeBuffer)); + + // Simple Field (subscribedDataSet) + writeSimpleField("subscribedDataSet", subscribedDataSet, writeComplex(writeBuffer)); + + writeBuffer.popContext("StandaloneSubscribedDataSetDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + StandaloneSubscribedDataSetDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Implicit Field (noOfDataSetFolder) + lengthInBits += 32; + + // Array field + if (dataSetFolder != null) { + int i = 0; + for (PascalString element : dataSetFolder) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetFolder.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (dataSetMetaData) + lengthInBits += dataSetMetaData.getLengthInBits(); + + // Simple field (subscribedDataSet) + lengthInBits += subscribedDataSet.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("StandaloneSubscribedDataSetDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfDataSetFolder = readImplicitField("noOfDataSetFolder", readSignedInt(readBuffer, 32)); + + List dataSetFolder = + readCountArrayField( + "dataSetFolder", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfDataSetFolder); + + DataSetMetaDataType dataSetMetaData = + readSimpleField( + "dataSetMetaData", + readComplex( + () -> + (DataSetMetaDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14525)), + readBuffer)); + + ExtensionObject subscribedDataSet = + readSimpleField( + "subscribedDataSet", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + readBuffer.closeContext("StandaloneSubscribedDataSetDataType"); + // Create the instance + return new StandaloneSubscribedDataSetDataTypeBuilderImpl( + name, dataSetFolder, dataSetMetaData, subscribedDataSet); + } + + public static class StandaloneSubscribedDataSetDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString name; + private final List dataSetFolder; + private final DataSetMetaDataType dataSetMetaData; + private final ExtensionObject subscribedDataSet; + + public StandaloneSubscribedDataSetDataTypeBuilderImpl( + PascalString name, + List dataSetFolder, + DataSetMetaDataType dataSetMetaData, + ExtensionObject subscribedDataSet) { + this.name = name; + this.dataSetFolder = dataSetFolder; + this.dataSetMetaData = dataSetMetaData; + this.subscribedDataSet = subscribedDataSet; + } + + public StandaloneSubscribedDataSetDataType build() { + StandaloneSubscribedDataSetDataType standaloneSubscribedDataSetDataType = + new StandaloneSubscribedDataSetDataType( + name, dataSetFolder, dataSetMetaData, subscribedDataSet); + return standaloneSubscribedDataSetDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StandaloneSubscribedDataSetDataType)) { + return false; + } + StandaloneSubscribedDataSetDataType that = (StandaloneSubscribedDataSetDataType) o; + return (getName() == that.getName()) + && (getDataSetFolder() == that.getDataSetFolder()) + && (getDataSetMetaData() == that.getDataSetMetaData()) + && (getSubscribedDataSet() == that.getSubscribedDataSet()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getName(), + getDataSetFolder(), + getDataSetMetaData(), + getSubscribedDataSet()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetRefDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetRefDataType.java new file mode 100644 index 00000000000..e7a9ff09b7e --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StandaloneSubscribedDataSetRefDataType.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class StandaloneSubscribedDataSetRefDataType extends ExtensionObjectDefinition + implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23601; + } + + // Properties. + protected final PascalString dataSetName; + + public StandaloneSubscribedDataSetRefDataType(PascalString dataSetName) { + super(); + this.dataSetName = dataSetName; + } + + public PascalString getDataSetName() { + return dataSetName; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("StandaloneSubscribedDataSetRefDataType"); + + // Simple Field (dataSetName) + writeSimpleField("dataSetName", dataSetName, writeComplex(writeBuffer)); + + writeBuffer.popContext("StandaloneSubscribedDataSetRefDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + StandaloneSubscribedDataSetRefDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataSetName) + lengthInBits += dataSetName.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("StandaloneSubscribedDataSetRefDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString dataSetName = + readSimpleField( + "dataSetName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("StandaloneSubscribedDataSetRefDataType"); + // Create the instance + return new StandaloneSubscribedDataSetRefDataTypeBuilderImpl(dataSetName); + } + + public static class StandaloneSubscribedDataSetRefDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString dataSetName; + + public StandaloneSubscribedDataSetRefDataTypeBuilderImpl(PascalString dataSetName) { + this.dataSetName = dataSetName; + } + + public StandaloneSubscribedDataSetRefDataType build() { + StandaloneSubscribedDataSetRefDataType standaloneSubscribedDataSetRefDataType = + new StandaloneSubscribedDataSetRefDataType(dataSetName); + return standaloneSubscribedDataSetRefDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StandaloneSubscribedDataSetRefDataType)) { + return false; + } + StandaloneSubscribedDataSetRefDataType that = (StandaloneSubscribedDataSetRefDataType) o; + return (getDataSetName() == that.getDataSetName()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getDataSetName()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusChangeNotification.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusChangeNotification.java index 8d311b09a77..1e4cb2a50be 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusChangeNotification.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusChangeNotification.java @@ -38,8 +38,8 @@ public class StatusChangeNotification extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "820"; + public Integer getExtensionId() { + return (int) 820; } // Properties. @@ -67,11 +67,6 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("StatusChangeNotification"); - // Implicit Field (notificationLength) (Used for parsing, but its value is not stored as it's - // implicitly given by the objects content) - int notificationLength = (int) (getLengthInBytes()); - writeImplicitField("notificationLength", notificationLength, writeSignedInt(writeBuffer, 32)); - // Simple Field (status) writeSimpleField("status", status, writeComplex(writeBuffer)); @@ -92,9 +87,6 @@ public int getLengthInBits() { StatusChangeNotification _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Implicit Field (notificationLength) - lengthInBits += 32; - // Simple field (status) lengthInBits += status.getLengthInBits(); @@ -105,13 +97,11 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("StatusChangeNotification"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int notificationLength = readImplicitField("notificationLength", readSignedInt(readBuffer, 32)); - StatusCode status = readSimpleField( "status", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusResult.java index c35fcda2875..5c241beb5cd 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StatusResult.java @@ -38,8 +38,8 @@ public class StatusResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "301"; + public Integer getExtensionId() { + return (int) 301; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("StatusResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDefinition.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDefinition.java new file mode 100644 index 00000000000..3458ad9ec30 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDefinition.java @@ -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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class StructureDefinition extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 101; + } + + // Properties. + protected final NodeId defaultEncodingId; + protected final NodeId baseDataType; + protected final StructureType structureType; + protected final List fields; + + public StructureDefinition( + NodeId defaultEncodingId, + NodeId baseDataType, + StructureType structureType, + List fields) { + super(); + this.defaultEncodingId = defaultEncodingId; + this.baseDataType = baseDataType; + this.structureType = structureType; + this.fields = fields; + } + + public NodeId getDefaultEncodingId() { + return defaultEncodingId; + } + + public NodeId getBaseDataType() { + return baseDataType; + } + + public StructureType getStructureType() { + return structureType; + } + + public List getFields() { + return fields; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("StructureDefinition"); + + // Simple Field (defaultEncodingId) + writeSimpleField("defaultEncodingId", defaultEncodingId, writeComplex(writeBuffer)); + + // Simple Field (baseDataType) + writeSimpleField("baseDataType", baseDataType, writeComplex(writeBuffer)); + + // Simple Field (structureType) + writeSimpleEnumField( + "structureType", + "StructureType", + structureType, + writeEnum( + StructureType::getValue, StructureType::name, writeUnsignedLong(writeBuffer, 32))); + + // Implicit Field (noOfFields) (Used for parsing, but its value is not stored as it's implicitly + // given by the objects content) + int noOfFields = (int) ((((getFields()) == (null)) ? -(1) : COUNT(getFields()))); + writeImplicitField("noOfFields", noOfFields, writeSignedInt(writeBuffer, 32)); + + // Array Field (fields) + writeComplexTypeArrayField("fields", fields, writeBuffer); + + writeBuffer.popContext("StructureDefinition"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + StructureDefinition _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (defaultEncodingId) + lengthInBits += defaultEncodingId.getLengthInBits(); + + // Simple field (baseDataType) + lengthInBits += baseDataType.getLengthInBits(); + + // Simple field (structureType) + lengthInBits += 32; + + // Implicit Field (noOfFields) + lengthInBits += 32; + + // Array field + if (fields != null) { + int i = 0; + for (StructureField element : fields) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= fields.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("StructureDefinition"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId defaultEncodingId = + readSimpleField( + "defaultEncodingId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + NodeId baseDataType = + readSimpleField( + "baseDataType", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + StructureType structureType = + readEnumField( + "structureType", + "StructureType", + readEnum(StructureType::enumForValue, readUnsignedLong(readBuffer, 32))); + + int noOfFields = readImplicitField("noOfFields", readSignedInt(readBuffer, 32)); + + List fields = + readCountArrayField( + "fields", + readComplex( + () -> + (StructureField) ExtensionObjectDefinition.staticParse(readBuffer, (int) (103)), + readBuffer), + noOfFields); + + readBuffer.closeContext("StructureDefinition"); + // Create the instance + return new StructureDefinitionBuilderImpl( + defaultEncodingId, baseDataType, structureType, fields); + } + + public static class StructureDefinitionBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId defaultEncodingId; + private final NodeId baseDataType; + private final StructureType structureType; + private final List fields; + + public StructureDefinitionBuilderImpl( + NodeId defaultEncodingId, + NodeId baseDataType, + StructureType structureType, + List fields) { + this.defaultEncodingId = defaultEncodingId; + this.baseDataType = baseDataType; + this.structureType = structureType; + this.fields = fields; + } + + public StructureDefinition build() { + StructureDefinition structureDefinition = + new StructureDefinition(defaultEncodingId, baseDataType, structureType, fields); + return structureDefinition; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StructureDefinition)) { + return false; + } + StructureDefinition that = (StructureDefinition) o; + return (getDefaultEncodingId() == that.getDefaultEncodingId()) + && (getBaseDataType() == that.getBaseDataType()) + && (getStructureType() == that.getStructureType()) + && (getFields() == that.getFields()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getDefaultEncodingId(), + getBaseDataType(), + getStructureType(), + getFields()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDescription.java new file mode 100644 index 00000000000..0693f6c6683 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureDescription.java @@ -0,0 +1,191 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class StructureDescription extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15489; + } + + // Properties. + protected final NodeId dataTypeId; + protected final QualifiedName name; + protected final StructureDefinition structureDefinition; + + public StructureDescription( + NodeId dataTypeId, QualifiedName name, StructureDefinition structureDefinition) { + super(); + this.dataTypeId = dataTypeId; + this.name = name; + this.structureDefinition = structureDefinition; + } + + public NodeId getDataTypeId() { + return dataTypeId; + } + + public QualifiedName getName() { + return name; + } + + public StructureDefinition getStructureDefinition() { + return structureDefinition; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("StructureDescription"); + + // Simple Field (dataTypeId) + writeSimpleField("dataTypeId", dataTypeId, writeComplex(writeBuffer)); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Simple Field (structureDefinition) + writeSimpleField("structureDefinition", structureDefinition, writeComplex(writeBuffer)); + + writeBuffer.popContext("StructureDescription"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + StructureDescription _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataTypeId) + lengthInBits += dataTypeId.getLengthInBits(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Simple field (structureDefinition) + lengthInBits += structureDefinition.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("StructureDescription"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId dataTypeId = + readSimpleField( + "dataTypeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + QualifiedName name = + readSimpleField( + "name", readComplex(() -> QualifiedName.staticParse(readBuffer), readBuffer)); + + StructureDefinition structureDefinition = + readSimpleField( + "structureDefinition", + readComplex( + () -> + (StructureDefinition) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (101)), + readBuffer)); + + readBuffer.closeContext("StructureDescription"); + // Create the instance + return new StructureDescriptionBuilderImpl(dataTypeId, name, structureDefinition); + } + + public static class StructureDescriptionBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId dataTypeId; + private final QualifiedName name; + private final StructureDefinition structureDefinition; + + public StructureDescriptionBuilderImpl( + NodeId dataTypeId, QualifiedName name, StructureDefinition structureDefinition) { + this.dataTypeId = dataTypeId; + this.name = name; + this.structureDefinition = structureDefinition; + } + + public StructureDescription build() { + StructureDescription structureDescription = + new StructureDescription(dataTypeId, name, structureDefinition); + return structureDescription; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StructureDescription)) { + return false; + } + StructureDescription that = (StructureDescription) o; + return (getDataTypeId() == that.getDataTypeId()) + && (getName() == that.getName()) + && (getStructureDefinition() == that.getStructureDefinition()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getDataTypeId(), getName(), getStructureDefinition()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureField.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureField.java index 6141a8de0c2..dd9871881f2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureField.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/StructureField.java @@ -38,8 +38,8 @@ public class StructureField extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "103"; + public Integer getExtensionId() { + return (int) 103; } // Properties. @@ -47,7 +47,6 @@ public String getIdentifier() { protected final LocalizedText description; protected final NodeId dataType; protected final int valueRank; - protected final int noOfArrayDimensions; protected final List arrayDimensions; protected final long maxStringLength; protected final boolean isOptional; @@ -57,7 +56,6 @@ public StructureField( LocalizedText description, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, long maxStringLength, boolean isOptional) { @@ -66,7 +64,6 @@ public StructureField( this.description = description; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.maxStringLength = maxStringLength; this.isOptional = isOptional; @@ -88,10 +85,6 @@ public int getValueRank() { return valueRank; } - public int getNoOfArrayDimensions() { - return noOfArrayDimensions; - } - public List getArrayDimensions() { return arrayDimensions; } @@ -123,8 +116,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (valueRank) writeSimpleField("valueRank", valueRank, writeSignedInt(writeBuffer, 32)); - // Simple Field (noOfArrayDimensions) - writeSimpleField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfArrayDimensions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfArrayDimensions = + (int) ((((getArrayDimensions()) == (null)) ? -(1) : COUNT(getArrayDimensions()))); + writeImplicitField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); // Array Field (arrayDimensions) writeSimpleTypeArrayField( @@ -165,7 +161,7 @@ public int getLengthInBits() { // Simple field (valueRank) lengthInBits += 32; - // Simple field (noOfArrayDimensions) + // Implicit Field (noOfArrayDimensions) lengthInBits += 32; // Array field @@ -186,7 +182,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("StructureField"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -204,7 +200,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit int valueRank = readSimpleField("valueRank", readSignedInt(readBuffer, 32)); - int noOfArrayDimensions = readSimpleField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); + int noOfArrayDimensions = + readImplicitField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); List arrayDimensions = readCountArrayField( @@ -220,14 +217,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("StructureField"); // Create the instance return new StructureFieldBuilderImpl( - name, - description, - dataType, - valueRank, - noOfArrayDimensions, - arrayDimensions, - maxStringLength, - isOptional); + name, description, dataType, valueRank, arrayDimensions, maxStringLength, isOptional); } public static class StructureFieldBuilderImpl @@ -236,7 +226,6 @@ public static class StructureFieldBuilderImpl private final LocalizedText description; private final NodeId dataType; private final int valueRank; - private final int noOfArrayDimensions; private final List arrayDimensions; private final long maxStringLength; private final boolean isOptional; @@ -246,7 +235,6 @@ public StructureFieldBuilderImpl( LocalizedText description, NodeId dataType, int valueRank, - int noOfArrayDimensions, List arrayDimensions, long maxStringLength, boolean isOptional) { @@ -254,7 +242,6 @@ public StructureFieldBuilderImpl( this.description = description; this.dataType = dataType; this.valueRank = valueRank; - this.noOfArrayDimensions = noOfArrayDimensions; this.arrayDimensions = arrayDimensions; this.maxStringLength = maxStringLength; this.isOptional = isOptional; @@ -263,14 +250,7 @@ public StructureFieldBuilderImpl( public StructureField build() { StructureField structureField = new StructureField( - name, - description, - dataType, - valueRank, - noOfArrayDimensions, - arrayDimensions, - maxStringLength, - isOptional); + name, description, dataType, valueRank, arrayDimensions, maxStringLength, isOptional); return structureField; } } @@ -288,7 +268,6 @@ public boolean equals(Object o) { && (getDescription() == that.getDescription()) && (getDataType() == that.getDataType()) && (getValueRank() == that.getValueRank()) - && (getNoOfArrayDimensions() == that.getNoOfArrayDimensions()) && (getArrayDimensions() == that.getArrayDimensions()) && (getMaxStringLength() == that.getMaxStringLength()) && (getIsOptional() == that.getIsOptional()) @@ -304,7 +283,6 @@ public int hashCode() { getDescription(), getDataType(), getValueRank(), - getNoOfArrayDimensions(), getArrayDimensions(), getMaxStringLength(), getIsOptional()); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetDataType.java index 2f32d58b71d..971b426ed92 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetDataType.java @@ -38,8 +38,8 @@ public class SubscribedDataSetDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15632"; + public Integer getExtensionId() { + return (int) 15632; } public SubscribedDataSetDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SubscribedDataSetDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetMirrorDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetMirrorDataType.java new file mode 100644 index 00000000000..cd2b6121a4f --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscribedDataSetMirrorDataType.java @@ -0,0 +1,191 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class SubscribedDataSetMirrorDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15637; + } + + // Properties. + protected final PascalString parentNodeName; + protected final List rolePermissions; + + public SubscribedDataSetMirrorDataType( + PascalString parentNodeName, List rolePermissions) { + super(); + this.parentNodeName = parentNodeName; + this.rolePermissions = rolePermissions; + } + + public PascalString getParentNodeName() { + return parentNodeName; + } + + public List getRolePermissions() { + return rolePermissions; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("SubscribedDataSetMirrorDataType"); + + // Simple Field (parentNodeName) + writeSimpleField("parentNodeName", parentNodeName, writeComplex(writeBuffer)); + + // Implicit Field (noOfRolePermissions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfRolePermissions = + (int) ((((getRolePermissions()) == (null)) ? -(1) : COUNT(getRolePermissions()))); + writeImplicitField("noOfRolePermissions", noOfRolePermissions, writeSignedInt(writeBuffer, 32)); + + // Array Field (rolePermissions) + writeComplexTypeArrayField("rolePermissions", rolePermissions, writeBuffer); + + writeBuffer.popContext("SubscribedDataSetMirrorDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + SubscribedDataSetMirrorDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (parentNodeName) + lengthInBits += parentNodeName.getLengthInBits(); + + // Implicit Field (noOfRolePermissions) + lengthInBits += 32; + + // Array field + if (rolePermissions != null) { + int i = 0; + for (RolePermissionType element : rolePermissions) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= rolePermissions.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("SubscribedDataSetMirrorDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString parentNodeName = + readSimpleField( + "parentNodeName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfRolePermissions = + readImplicitField("noOfRolePermissions", readSignedInt(readBuffer, 32)); + + List rolePermissions = + readCountArrayField( + "rolePermissions", + readComplex( + () -> + (RolePermissionType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (98)), + readBuffer), + noOfRolePermissions); + + readBuffer.closeContext("SubscribedDataSetMirrorDataType"); + // Create the instance + return new SubscribedDataSetMirrorDataTypeBuilderImpl(parentNodeName, rolePermissions); + } + + public static class SubscribedDataSetMirrorDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString parentNodeName; + private final List rolePermissions; + + public SubscribedDataSetMirrorDataTypeBuilderImpl( + PascalString parentNodeName, List rolePermissions) { + this.parentNodeName = parentNodeName; + this.rolePermissions = rolePermissions; + } + + public SubscribedDataSetMirrorDataType build() { + SubscribedDataSetMirrorDataType subscribedDataSetMirrorDataType = + new SubscribedDataSetMirrorDataType(parentNodeName, rolePermissions); + return subscribedDataSetMirrorDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SubscribedDataSetMirrorDataType)) { + return false; + } + SubscribedDataSetMirrorDataType that = (SubscribedDataSetMirrorDataType) o; + return (getParentNodeName() == that.getParentNodeName()) + && (getRolePermissions() == that.getRolePermissions()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getParentNodeName(), getRolePermissions()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionAcknowledgement.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionAcknowledgement.java index 9aca8c743de..01e8883e3d2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionAcknowledgement.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionAcknowledgement.java @@ -38,8 +38,8 @@ public class SubscriptionAcknowledgement extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "823"; + public Integer getExtensionId() { + return (int) 823; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SubscriptionAcknowledgement"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionDiagnosticsDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionDiagnosticsDataType.java index 47e5f41ea1a..9ae90154b13 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionDiagnosticsDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/SubscriptionDiagnosticsDataType.java @@ -38,8 +38,8 @@ public class SubscriptionDiagnosticsDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "876"; + public Integer getExtensionId() { + return (int) 876; } // Properties. @@ -516,7 +516,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("SubscriptionDiagnosticsDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TargetVariablesDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TargetVariablesDataType.java new file mode 100644 index 00000000000..8dd6f3274d7 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TargetVariablesDataType.java @@ -0,0 +1,168 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class TargetVariablesDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15633; + } + + // Properties. + protected final List targetVariables; + + public TargetVariablesDataType(List targetVariables) { + super(); + this.targetVariables = targetVariables; + } + + public List getTargetVariables() { + return targetVariables; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("TargetVariablesDataType"); + + // Implicit Field (noOfTargetVariables) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfTargetVariables = + (int) ((((getTargetVariables()) == (null)) ? -(1) : COUNT(getTargetVariables()))); + writeImplicitField("noOfTargetVariables", noOfTargetVariables, writeSignedInt(writeBuffer, 32)); + + // Array Field (targetVariables) + writeComplexTypeArrayField("targetVariables", targetVariables, writeBuffer); + + writeBuffer.popContext("TargetVariablesDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + TargetVariablesDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfTargetVariables) + lengthInBits += 32; + + // Array field + if (targetVariables != null) { + int i = 0; + for (FieldTargetDataType element : targetVariables) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= targetVariables.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("TargetVariablesDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfTargetVariables = + readImplicitField("noOfTargetVariables", readSignedInt(readBuffer, 32)); + + List targetVariables = + readCountArrayField( + "targetVariables", + readComplex( + () -> + (FieldTargetDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (14746)), + readBuffer), + noOfTargetVariables); + + readBuffer.closeContext("TargetVariablesDataType"); + // Create the instance + return new TargetVariablesDataTypeBuilderImpl(targetVariables); + } + + public static class TargetVariablesDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List targetVariables; + + public TargetVariablesDataTypeBuilderImpl(List targetVariables) { + this.targetVariables = targetVariables; + } + + public TargetVariablesDataType build() { + TargetVariablesDataType targetVariablesDataType = + new TargetVariablesDataType(targetVariables); + return targetVariablesDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof TargetVariablesDataType)) { + return false; + } + TargetVariablesDataType that = (TargetVariablesDataType) o; + return (getTargetVariables() == that.getTargetVariables()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getTargetVariables()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TimeZoneDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TimeZoneDataType.java index 3c3e1c6c15e..9a0730a3868 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TimeZoneDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TimeZoneDataType.java @@ -38,8 +38,8 @@ public class TimeZoneDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "8914"; + public Integer getExtensionId() { + return (int) 8914; } // Properties. @@ -103,7 +103,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TimeZoneDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransactionErrorType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransactionErrorType.java index 0942869052a..36ce3a7d5bd 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransactionErrorType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransactionErrorType.java @@ -38,8 +38,8 @@ public class TransactionErrorType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "32287"; + public Integer getExtensionId() { + return (int) 32287; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TransactionErrorType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferResult.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferResult.java index 06a81169b1d..671998cfaea 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferResult.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferResult.java @@ -38,22 +38,17 @@ public class TransferResult extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "838"; + public Integer getExtensionId() { + return (int) 838; } // Properties. protected final StatusCode statusCode; - protected final int noOfAvailableSequenceNumbers; protected final List availableSequenceNumbers; - public TransferResult( - StatusCode statusCode, - int noOfAvailableSequenceNumbers, - List availableSequenceNumbers) { + public TransferResult(StatusCode statusCode, List availableSequenceNumbers) { super(); this.statusCode = statusCode; - this.noOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers; this.availableSequenceNumbers = availableSequenceNumbers; } @@ -61,10 +56,6 @@ public StatusCode getStatusCode() { return statusCode; } - public int getNoOfAvailableSequenceNumbers() { - return noOfAvailableSequenceNumbers; - } - public List getAvailableSequenceNumbers() { return availableSequenceNumbers; } @@ -79,8 +70,14 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (statusCode) writeSimpleField("statusCode", statusCode, writeComplex(writeBuffer)); - // Simple Field (noOfAvailableSequenceNumbers) - writeSimpleField( + // Implicit Field (noOfAvailableSequenceNumbers) (Used for parsing, but its value is not stored + // as it's implicitly given by the objects content) + int noOfAvailableSequenceNumbers = + (int) + ((((getAvailableSequenceNumbers()) == (null)) + ? -(1) + : COUNT(getAvailableSequenceNumbers()))); + writeImplicitField( "noOfAvailableSequenceNumbers", noOfAvailableSequenceNumbers, writeSignedInt(writeBuffer, 32)); @@ -106,7 +103,7 @@ public int getLengthInBits() { // Simple field (statusCode) lengthInBits += statusCode.getLengthInBits(); - // Simple field (noOfAvailableSequenceNumbers) + // Implicit Field (noOfAvailableSequenceNumbers) lengthInBits += 32; // Array field @@ -118,7 +115,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TransferResult"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -128,7 +125,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit "statusCode", readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer)); int noOfAvailableSequenceNumbers = - readSimpleField("noOfAvailableSequenceNumbers", readSignedInt(readBuffer, 32)); + readImplicitField("noOfAvailableSequenceNumbers", readSignedInt(readBuffer, 32)); List availableSequenceNumbers = readCountArrayField( @@ -138,28 +135,21 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("TransferResult"); // Create the instance - return new TransferResultBuilderImpl( - statusCode, noOfAvailableSequenceNumbers, availableSequenceNumbers); + return new TransferResultBuilderImpl(statusCode, availableSequenceNumbers); } public static class TransferResultBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final StatusCode statusCode; - private final int noOfAvailableSequenceNumbers; private final List availableSequenceNumbers; - public TransferResultBuilderImpl( - StatusCode statusCode, - int noOfAvailableSequenceNumbers, - List availableSequenceNumbers) { + public TransferResultBuilderImpl(StatusCode statusCode, List availableSequenceNumbers) { this.statusCode = statusCode; - this.noOfAvailableSequenceNumbers = noOfAvailableSequenceNumbers; this.availableSequenceNumbers = availableSequenceNumbers; } public TransferResult build() { - TransferResult transferResult = - new TransferResult(statusCode, noOfAvailableSequenceNumbers, availableSequenceNumbers); + TransferResult transferResult = new TransferResult(statusCode, availableSequenceNumbers); return transferResult; } } @@ -174,7 +164,6 @@ public boolean equals(Object o) { } TransferResult that = (TransferResult) o; return (getStatusCode() == that.getStatusCode()) - && (getNoOfAvailableSequenceNumbers() == that.getNoOfAvailableSequenceNumbers()) && (getAvailableSequenceNumbers() == that.getAvailableSequenceNumbers()) && super.equals(that) && true; @@ -182,11 +171,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getStatusCode(), - getNoOfAvailableSequenceNumbers(), - getAvailableSequenceNumbers()); + return Objects.hash(super.hashCode(), getStatusCode(), getAvailableSequenceNumbers()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsRequest.java index f8078f02a6a..fa8581e0249 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsRequest.java @@ -38,36 +38,27 @@ public class TransferSubscriptionsRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "841"; + public Integer getExtensionId() { + return (int) 841; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfSubscriptionIds; + protected final RequestHeader requestHeader; protected final List subscriptionIds; protected final boolean sendInitialValues; public TransferSubscriptionsRequest( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionIds, - List subscriptionIds, - boolean sendInitialValues) { + RequestHeader requestHeader, List subscriptionIds, boolean sendInitialValues) { super(); this.requestHeader = requestHeader; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; this.sendInitialValues = sendInitialValues; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfSubscriptionIds() { - return noOfSubscriptionIds; - } - public List getSubscriptionIds() { return subscriptionIds; } @@ -86,8 +77,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfSubscriptionIds) - writeSimpleField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfSubscriptionIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSubscriptionIds = + (int) ((((getSubscriptionIds()) == (null)) ? -(1) : COUNT(getSubscriptionIds()))); + writeImplicitField("noOfSubscriptionIds", noOfSubscriptionIds, writeSignedInt(writeBuffer, 32)); // Array Field (subscriptionIds) writeSimpleTypeArrayField( @@ -116,7 +110,7 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfSubscriptionIds) + // Implicit Field (noOfSubscriptionIds) lengthInBits += 32; // Array field @@ -134,19 +128,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TransferSubscriptionsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfSubscriptionIds = readSimpleField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); + int noOfSubscriptionIds = + readImplicitField("noOfSubscriptionIds", readSignedInt(readBuffer, 32)); List subscriptionIds = readCountArrayField( @@ -160,31 +156,25 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("TransferSubscriptionsRequest"); // Create the instance return new TransferSubscriptionsRequestBuilderImpl( - requestHeader, noOfSubscriptionIds, subscriptionIds, sendInitialValues); + requestHeader, subscriptionIds, sendInitialValues); } public static class TransferSubscriptionsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfSubscriptionIds; + private final RequestHeader requestHeader; private final List subscriptionIds; private final boolean sendInitialValues; public TransferSubscriptionsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfSubscriptionIds, - List subscriptionIds, - boolean sendInitialValues) { + RequestHeader requestHeader, List subscriptionIds, boolean sendInitialValues) { this.requestHeader = requestHeader; - this.noOfSubscriptionIds = noOfSubscriptionIds; this.subscriptionIds = subscriptionIds; this.sendInitialValues = sendInitialValues; } public TransferSubscriptionsRequest build() { TransferSubscriptionsRequest transferSubscriptionsRequest = - new TransferSubscriptionsRequest( - requestHeader, noOfSubscriptionIds, subscriptionIds, sendInitialValues); + new TransferSubscriptionsRequest(requestHeader, subscriptionIds, sendInitialValues); return transferSubscriptionsRequest; } } @@ -199,7 +189,6 @@ public boolean equals(Object o) { } TransferSubscriptionsRequest that = (TransferSubscriptionsRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfSubscriptionIds() == that.getNoOfSubscriptionIds()) && (getSubscriptionIds() == that.getSubscriptionIds()) && (getSendInitialValues() == that.getSendInitialValues()) && super.equals(that) @@ -209,11 +198,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - super.hashCode(), - getRequestHeader(), - getNoOfSubscriptionIds(), - getSubscriptionIds(), - getSendInitialValues()); + super.hashCode(), getRequestHeader(), getSubscriptionIds(), getSendInitialValues()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsResponse.java index e6169634c17..ce9d2cfb69d 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransferSubscriptionsResponse.java @@ -38,47 +38,33 @@ public class TransferSubscriptionsResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "844"; + public Integer getExtensionId() { + return (int) 844; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public TransferSubscriptionsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,19 +113,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (TransferResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,29 +141,32 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TransferSubscriptionsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("838")), + () -> + (TransferResult) ExtensionObjectDefinition.staticParse(readBuffer, (int) (838)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -182,35 +176,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("TransferSubscriptionsResponse"); // Create the instance - return new TransferSubscriptionsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new TransferSubscriptionsResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class TransferSubscriptionsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public TransferSubscriptionsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public TransferSubscriptionsResponse build() { TransferSubscriptionsResponse transferSubscriptionsResponse = - new TransferSubscriptionsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new TransferSubscriptionsResponse(responseHeader, results, diagnosticInfos); return transferSubscriptionsResponse; } } @@ -225,9 +211,7 @@ public boolean equals(Object o) { } TransferSubscriptionsResponse that = (TransferSubscriptionsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -235,13 +219,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsRequest.java index 8a7dadfc812..e54812063d9 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsRequest.java @@ -39,34 +39,26 @@ public class TranslateBrowsePathsToNodeIdsRequest extends ExtensionObjectDefinit implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "554"; + public Integer getExtensionId() { + return (int) 554; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfBrowsePaths; - protected final List browsePaths; + protected final RequestHeader requestHeader; + protected final List browsePaths; public TranslateBrowsePathsToNodeIdsRequest( - ExtensionObjectDefinition requestHeader, - int noOfBrowsePaths, - List browsePaths) { + RequestHeader requestHeader, List browsePaths) { super(); this.requestHeader = requestHeader; - this.noOfBrowsePaths = noOfBrowsePaths; this.browsePaths = browsePaths; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfBrowsePaths() { - return noOfBrowsePaths; - } - - public List getBrowsePaths() { + public List getBrowsePaths() { return browsePaths; } @@ -80,8 +72,10 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfBrowsePaths) - writeSimpleField("noOfBrowsePaths", noOfBrowsePaths, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfBrowsePaths) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfBrowsePaths = (int) ((((getBrowsePaths()) == (null)) ? -(1) : COUNT(getBrowsePaths()))); + writeImplicitField("noOfBrowsePaths", noOfBrowsePaths, writeSignedInt(writeBuffer, 32)); // Array Field (browsePaths) writeComplexTypeArrayField("browsePaths", browsePaths, writeBuffer); @@ -103,13 +97,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfBrowsePaths) + // Implicit Field (noOfBrowsePaths) lengthInBits += 32; // Array field if (browsePaths != null) { int i = 0; - for (ExtensionObjectDefinition element : browsePaths) { + for (BrowsePath element : browsePaths) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= browsePaths.size()); lengthInBits += element.getLengthInBits(); } @@ -119,52 +113,48 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TranslateBrowsePathsToNodeIdsRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfBrowsePaths = readSimpleField("noOfBrowsePaths", readSignedInt(readBuffer, 32)); + int noOfBrowsePaths = readImplicitField("noOfBrowsePaths", readSignedInt(readBuffer, 32)); - List browsePaths = + List browsePaths = readCountArrayField( "browsePaths", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("545")), + () -> (BrowsePath) ExtensionObjectDefinition.staticParse(readBuffer, (int) (545)), readBuffer), noOfBrowsePaths); readBuffer.closeContext("TranslateBrowsePathsToNodeIdsRequest"); // Create the instance - return new TranslateBrowsePathsToNodeIdsRequestBuilderImpl( - requestHeader, noOfBrowsePaths, browsePaths); + return new TranslateBrowsePathsToNodeIdsRequestBuilderImpl(requestHeader, browsePaths); } public static class TranslateBrowsePathsToNodeIdsRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfBrowsePaths; - private final List browsePaths; + private final RequestHeader requestHeader; + private final List browsePaths; public TranslateBrowsePathsToNodeIdsRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfBrowsePaths, - List browsePaths) { + RequestHeader requestHeader, List browsePaths) { this.requestHeader = requestHeader; - this.noOfBrowsePaths = noOfBrowsePaths; this.browsePaths = browsePaths; } public TranslateBrowsePathsToNodeIdsRequest build() { TranslateBrowsePathsToNodeIdsRequest translateBrowsePathsToNodeIdsRequest = - new TranslateBrowsePathsToNodeIdsRequest(requestHeader, noOfBrowsePaths, browsePaths); + new TranslateBrowsePathsToNodeIdsRequest(requestHeader, browsePaths); return translateBrowsePathsToNodeIdsRequest; } } @@ -179,7 +169,6 @@ public boolean equals(Object o) { } TranslateBrowsePathsToNodeIdsRequest that = (TranslateBrowsePathsToNodeIdsRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfBrowsePaths() == that.getNoOfBrowsePaths()) && (getBrowsePaths() == that.getBrowsePaths()) && super.equals(that) && true; @@ -187,8 +176,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfBrowsePaths(), getBrowsePaths()); + return Objects.hash(super.hashCode(), getRequestHeader(), getBrowsePaths()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsResponse.java index 3a49f0b59ad..a601279ea2b 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TranslateBrowsePathsToNodeIdsResponse.java @@ -39,47 +39,33 @@ public class TranslateBrowsePathsToNodeIdsResponse extends ExtensionObjectDefini implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "557"; + public Integer getExtensionId() { + return (int) 557; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; - protected final List results; - protected final int noOfDiagnosticInfos; + protected final ResponseHeader responseHeader; + protected final List results; protected final List diagnosticInfos; public TranslateBrowsePathsToNodeIdsResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - - public List getResults() { + public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -94,14 +80,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -123,19 +114,19 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field if (results != null) { int i = 0; - for (ExtensionObjectDefinition element : results) { + for (BrowsePathResult element : results) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= results.size()); lengthInBits += element.getLengthInBits(); } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -151,29 +142,33 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TranslateBrowsePathsToNodeIdsResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); - List results = + List results = readCountArrayField( "results", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("551")), + () -> + (BrowsePathResult) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (551)), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -184,34 +179,27 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("TranslateBrowsePathsToNodeIdsResponse"); // Create the instance return new TranslateBrowsePathsToNodeIdsResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + responseHeader, results, diagnosticInfos); } public static class TranslateBrowsePathsToNodeIdsResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; - private final List results; - private final int noOfDiagnosticInfos; + private final ResponseHeader responseHeader; + private final List results; private final List diagnosticInfos; public TranslateBrowsePathsToNodeIdsResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, - List results, - int noOfDiagnosticInfos, + ResponseHeader responseHeader, + List results, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public TranslateBrowsePathsToNodeIdsResponse build() { TranslateBrowsePathsToNodeIdsResponse translateBrowsePathsToNodeIdsResponse = - new TranslateBrowsePathsToNodeIdsResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + new TranslateBrowsePathsToNodeIdsResponse(responseHeader, results, diagnosticInfos); return translateBrowsePathsToNodeIdsResponse; } } @@ -226,9 +214,7 @@ public boolean equals(Object o) { } TranslateBrowsePathsToNodeIdsResponse that = (TranslateBrowsePathsToNodeIdsResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -236,13 +222,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosDataType.java new file mode 100644 index 00000000000..aa44c80b6ae --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosDataType.java @@ -0,0 +1,122 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class TransmitQosDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23606; + } + + public TransmitQosDataType() { + super(); + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("TransmitQosDataType"); + + writeBuffer.popContext("TransmitQosDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + TransmitQosDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("TransmitQosDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + readBuffer.closeContext("TransmitQosDataType"); + // Create the instance + return new TransmitQosDataTypeBuilderImpl(); + } + + public static class TransmitQosDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + + public TransmitQosDataTypeBuilderImpl() {} + + public TransmitQosDataType build() { + TransmitQosDataType transmitQosDataType = new TransmitQosDataType(); + return transmitQosDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof TransmitQosDataType)) { + return false; + } + TransmitQosDataType that = (TransmitQosDataType) o; + return super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosPriorityDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosPriorityDataType.java new file mode 100644 index 00000000000..3fed5246445 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TransmitQosPriorityDataType.java @@ -0,0 +1,144 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class TransmitQosPriorityDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 23607; + } + + // Properties. + protected final PascalString priorityLabel; + + public TransmitQosPriorityDataType(PascalString priorityLabel) { + super(); + this.priorityLabel = priorityLabel; + } + + public PascalString getPriorityLabel() { + return priorityLabel; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("TransmitQosPriorityDataType"); + + // Simple Field (priorityLabel) + writeSimpleField("priorityLabel", priorityLabel, writeComplex(writeBuffer)); + + writeBuffer.popContext("TransmitQosPriorityDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + TransmitQosPriorityDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (priorityLabel) + lengthInBits += priorityLabel.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("TransmitQosPriorityDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString priorityLabel = + readSimpleField( + "priorityLabel", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("TransmitQosPriorityDataType"); + // Create the instance + return new TransmitQosPriorityDataTypeBuilderImpl(priorityLabel); + } + + public static class TransmitQosPriorityDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString priorityLabel; + + public TransmitQosPriorityDataTypeBuilderImpl(PascalString priorityLabel) { + this.priorityLabel = priorityLabel; + } + + public TransmitQosPriorityDataType build() { + TransmitQosPriorityDataType transmitQosPriorityDataType = + new TransmitQosPriorityDataType(priorityLabel); + return transmitQosPriorityDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof TransmitQosPriorityDataType)) { + return false; + } + TransmitQosPriorityDataType that = (TransmitQosPriorityDataType) o; + return (getPriorityLabel() == that.getPriorityLabel()) && super.equals(that) && true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), getPriorityLabel()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TrustListDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TrustListDataType.java index 46db769b033..b98f022ab2a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TrustListDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/TrustListDataType.java @@ -38,40 +38,28 @@ public class TrustListDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12556"; + public Integer getExtensionId() { + return (int) 12556; } // Properties. protected final long specifiedLists; - protected final int noOfTrustedCertificates; protected final List trustedCertificates; - protected final int noOfTrustedCrls; protected final List trustedCrls; - protected final int noOfIssuerCertificates; protected final List issuerCertificates; - protected final int noOfIssuerCrls; protected final List issuerCrls; public TrustListDataType( long specifiedLists, - int noOfTrustedCertificates, List trustedCertificates, - int noOfTrustedCrls, List trustedCrls, - int noOfIssuerCertificates, List issuerCertificates, - int noOfIssuerCrls, List issuerCrls) { super(); this.specifiedLists = specifiedLists; - this.noOfTrustedCertificates = noOfTrustedCertificates; this.trustedCertificates = trustedCertificates; - this.noOfTrustedCrls = noOfTrustedCrls; this.trustedCrls = trustedCrls; - this.noOfIssuerCertificates = noOfIssuerCertificates; this.issuerCertificates = issuerCertificates; - this.noOfIssuerCrls = noOfIssuerCrls; this.issuerCrls = issuerCrls; } @@ -79,34 +67,18 @@ public long getSpecifiedLists() { return specifiedLists; } - public int getNoOfTrustedCertificates() { - return noOfTrustedCertificates; - } - public List getTrustedCertificates() { return trustedCertificates; } - public int getNoOfTrustedCrls() { - return noOfTrustedCrls; - } - public List getTrustedCrls() { return trustedCrls; } - public int getNoOfIssuerCertificates() { - return noOfIssuerCertificates; - } - public List getIssuerCertificates() { return issuerCertificates; } - public int getNoOfIssuerCrls() { - return noOfIssuerCrls; - } - public List getIssuerCrls() { return issuerCrls; } @@ -121,28 +93,38 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (specifiedLists) writeSimpleField("specifiedLists", specifiedLists, writeUnsignedLong(writeBuffer, 32)); - // Simple Field (noOfTrustedCertificates) - writeSimpleField( + // Implicit Field (noOfTrustedCertificates) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfTrustedCertificates = + (int) ((((getTrustedCertificates()) == (null)) ? -(1) : COUNT(getTrustedCertificates()))); + writeImplicitField( "noOfTrustedCertificates", noOfTrustedCertificates, writeSignedInt(writeBuffer, 32)); // Array Field (trustedCertificates) writeComplexTypeArrayField("trustedCertificates", trustedCertificates, writeBuffer); - // Simple Field (noOfTrustedCrls) - writeSimpleField("noOfTrustedCrls", noOfTrustedCrls, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfTrustedCrls) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfTrustedCrls = (int) ((((getTrustedCrls()) == (null)) ? -(1) : COUNT(getTrustedCrls()))); + writeImplicitField("noOfTrustedCrls", noOfTrustedCrls, writeSignedInt(writeBuffer, 32)); // Array Field (trustedCrls) writeComplexTypeArrayField("trustedCrls", trustedCrls, writeBuffer); - // Simple Field (noOfIssuerCertificates) - writeSimpleField( + // Implicit Field (noOfIssuerCertificates) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfIssuerCertificates = + (int) ((((getIssuerCertificates()) == (null)) ? -(1) : COUNT(getIssuerCertificates()))); + writeImplicitField( "noOfIssuerCertificates", noOfIssuerCertificates, writeSignedInt(writeBuffer, 32)); // Array Field (issuerCertificates) writeComplexTypeArrayField("issuerCertificates", issuerCertificates, writeBuffer); - // Simple Field (noOfIssuerCrls) - writeSimpleField("noOfIssuerCrls", noOfIssuerCrls, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfIssuerCrls) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfIssuerCrls = (int) ((((getIssuerCrls()) == (null)) ? -(1) : COUNT(getIssuerCrls()))); + writeImplicitField("noOfIssuerCrls", noOfIssuerCrls, writeSignedInt(writeBuffer, 32)); // Array Field (issuerCrls) writeComplexTypeArrayField("issuerCrls", issuerCrls, writeBuffer); @@ -164,7 +146,7 @@ public int getLengthInBits() { // Simple field (specifiedLists) lengthInBits += 32; - // Simple field (noOfTrustedCertificates) + // Implicit Field (noOfTrustedCertificates) lengthInBits += 32; // Array field @@ -176,7 +158,7 @@ public int getLengthInBits() { } } - // Simple field (noOfTrustedCrls) + // Implicit Field (noOfTrustedCrls) lengthInBits += 32; // Array field @@ -188,7 +170,7 @@ public int getLengthInBits() { } } - // Simple field (noOfIssuerCertificates) + // Implicit Field (noOfIssuerCertificates) lengthInBits += 32; // Array field @@ -200,7 +182,7 @@ public int getLengthInBits() { } } - // Simple field (noOfIssuerCrls) + // Implicit Field (noOfIssuerCrls) lengthInBits += 32; // Array field @@ -216,7 +198,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("TrustListDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); @@ -224,7 +206,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit long specifiedLists = readSimpleField("specifiedLists", readUnsignedLong(readBuffer, 32)); int noOfTrustedCertificates = - readSimpleField("noOfTrustedCertificates", readSignedInt(readBuffer, 32)); + readImplicitField("noOfTrustedCertificates", readSignedInt(readBuffer, 32)); List trustedCertificates = readCountArrayField( @@ -232,7 +214,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer), noOfTrustedCertificates); - int noOfTrustedCrls = readSimpleField("noOfTrustedCrls", readSignedInt(readBuffer, 32)); + int noOfTrustedCrls = readImplicitField("noOfTrustedCrls", readSignedInt(readBuffer, 32)); List trustedCrls = readCountArrayField( @@ -241,7 +223,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit noOfTrustedCrls); int noOfIssuerCertificates = - readSimpleField("noOfIssuerCertificates", readSignedInt(readBuffer, 32)); + readImplicitField("noOfIssuerCertificates", readSignedInt(readBuffer, 32)); List issuerCertificates = readCountArrayField( @@ -249,7 +231,7 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> PascalByteString.staticParse(readBuffer), readBuffer), noOfIssuerCertificates); - int noOfIssuerCrls = readSimpleField("noOfIssuerCrls", readSignedInt(readBuffer, 32)); + int noOfIssuerCrls = readImplicitField("noOfIssuerCrls", readSignedInt(readBuffer, 32)); List issuerCrls = readCountArrayField( @@ -260,62 +242,34 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("TrustListDataType"); // Create the instance return new TrustListDataTypeBuilderImpl( - specifiedLists, - noOfTrustedCertificates, - trustedCertificates, - noOfTrustedCrls, - trustedCrls, - noOfIssuerCertificates, - issuerCertificates, - noOfIssuerCrls, - issuerCrls); + specifiedLists, trustedCertificates, trustedCrls, issuerCertificates, issuerCrls); } public static class TrustListDataTypeBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final long specifiedLists; - private final int noOfTrustedCertificates; private final List trustedCertificates; - private final int noOfTrustedCrls; private final List trustedCrls; - private final int noOfIssuerCertificates; private final List issuerCertificates; - private final int noOfIssuerCrls; private final List issuerCrls; public TrustListDataTypeBuilderImpl( long specifiedLists, - int noOfTrustedCertificates, List trustedCertificates, - int noOfTrustedCrls, List trustedCrls, - int noOfIssuerCertificates, List issuerCertificates, - int noOfIssuerCrls, List issuerCrls) { this.specifiedLists = specifiedLists; - this.noOfTrustedCertificates = noOfTrustedCertificates; this.trustedCertificates = trustedCertificates; - this.noOfTrustedCrls = noOfTrustedCrls; this.trustedCrls = trustedCrls; - this.noOfIssuerCertificates = noOfIssuerCertificates; this.issuerCertificates = issuerCertificates; - this.noOfIssuerCrls = noOfIssuerCrls; this.issuerCrls = issuerCrls; } public TrustListDataType build() { TrustListDataType trustListDataType = new TrustListDataType( - specifiedLists, - noOfTrustedCertificates, - trustedCertificates, - noOfTrustedCrls, - trustedCrls, - noOfIssuerCertificates, - issuerCertificates, - noOfIssuerCrls, - issuerCrls); + specifiedLists, trustedCertificates, trustedCrls, issuerCertificates, issuerCrls); return trustListDataType; } } @@ -330,13 +284,9 @@ public boolean equals(Object o) { } TrustListDataType that = (TrustListDataType) o; return (getSpecifiedLists() == that.getSpecifiedLists()) - && (getNoOfTrustedCertificates() == that.getNoOfTrustedCertificates()) && (getTrustedCertificates() == that.getTrustedCertificates()) - && (getNoOfTrustedCrls() == that.getNoOfTrustedCrls()) && (getTrustedCrls() == that.getTrustedCrls()) - && (getNoOfIssuerCertificates() == that.getNoOfIssuerCertificates()) && (getIssuerCertificates() == that.getIssuerCertificates()) - && (getNoOfIssuerCrls() == that.getNoOfIssuerCrls()) && (getIssuerCrls() == that.getIssuerCrls()) && super.equals(that) && true; @@ -347,13 +297,9 @@ public int hashCode() { return Objects.hash( super.hashCode(), getSpecifiedLists(), - getNoOfTrustedCertificates(), getTrustedCertificates(), - getNoOfTrustedCrls(), getTrustedCrls(), - getNoOfIssuerCertificates(), getIssuerCertificates(), - getNoOfIssuerCrls(), getIssuerCrls()); } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UABinaryFileDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UABinaryFileDataType.java new file mode 100644 index 00000000000..03f0af8580e --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UABinaryFileDataType.java @@ -0,0 +1,406 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UABinaryFileDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15008; + } + + // Properties. + protected final List namespaces; + protected final List structureDataTypes; + protected final List enumDataTypes; + protected final List simpleDataTypes; + protected final PascalString schemaLocation; + protected final List fileHeader; + protected final Variant body; + + public UABinaryFileDataType( + List namespaces, + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes, + PascalString schemaLocation, + List fileHeader, + Variant body) { + super(); + this.namespaces = namespaces; + this.structureDataTypes = structureDataTypes; + this.enumDataTypes = enumDataTypes; + this.simpleDataTypes = simpleDataTypes; + this.schemaLocation = schemaLocation; + this.fileHeader = fileHeader; + this.body = body; + } + + public List getNamespaces() { + return namespaces; + } + + public List getStructureDataTypes() { + return structureDataTypes; + } + + public List getEnumDataTypes() { + return enumDataTypes; + } + + public List getSimpleDataTypes() { + return simpleDataTypes; + } + + public PascalString getSchemaLocation() { + return schemaLocation; + } + + public List getFileHeader() { + return fileHeader; + } + + public Variant getBody() { + return body; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UABinaryFileDataType"); + + // Implicit Field (noOfNamespaces) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNamespaces = (int) ((((getNamespaces()) == (null)) ? -(1) : COUNT(getNamespaces()))); + writeImplicitField("noOfNamespaces", noOfNamespaces, writeSignedInt(writeBuffer, 32)); + + // Array Field (namespaces) + writeComplexTypeArrayField("namespaces", namespaces, writeBuffer); + + // Implicit Field (noOfStructureDataTypes) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfStructureDataTypes = + (int) ((((getStructureDataTypes()) == (null)) ? -(1) : COUNT(getStructureDataTypes()))); + writeImplicitField( + "noOfStructureDataTypes", noOfStructureDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (structureDataTypes) + writeComplexTypeArrayField("structureDataTypes", structureDataTypes, writeBuffer); + + // Implicit Field (noOfEnumDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEnumDataTypes = + (int) ((((getEnumDataTypes()) == (null)) ? -(1) : COUNT(getEnumDataTypes()))); + writeImplicitField("noOfEnumDataTypes", noOfEnumDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (enumDataTypes) + writeComplexTypeArrayField("enumDataTypes", enumDataTypes, writeBuffer); + + // Implicit Field (noOfSimpleDataTypes) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfSimpleDataTypes = + (int) ((((getSimpleDataTypes()) == (null)) ? -(1) : COUNT(getSimpleDataTypes()))); + writeImplicitField("noOfSimpleDataTypes", noOfSimpleDataTypes, writeSignedInt(writeBuffer, 32)); + + // Array Field (simpleDataTypes) + writeComplexTypeArrayField("simpleDataTypes", simpleDataTypes, writeBuffer); + + // Simple Field (schemaLocation) + writeSimpleField("schemaLocation", schemaLocation, writeComplex(writeBuffer)); + + // Implicit Field (noOfFileHeader) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfFileHeader = (int) ((((getFileHeader()) == (null)) ? -(1) : COUNT(getFileHeader()))); + writeImplicitField("noOfFileHeader", noOfFileHeader, writeSignedInt(writeBuffer, 32)); + + // Array Field (fileHeader) + writeComplexTypeArrayField("fileHeader", fileHeader, writeBuffer); + + // Simple Field (body) + writeSimpleField("body", body, writeComplex(writeBuffer)); + + writeBuffer.popContext("UABinaryFileDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UABinaryFileDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Implicit Field (noOfNamespaces) + lengthInBits += 32; + + // Array field + if (namespaces != null) { + int i = 0; + for (PascalString element : namespaces) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= namespaces.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfStructureDataTypes) + lengthInBits += 32; + + // Array field + if (structureDataTypes != null) { + int i = 0; + for (StructureDescription element : structureDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= structureDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfEnumDataTypes) + lengthInBits += 32; + + // Array field + if (enumDataTypes != null) { + int i = 0; + for (EnumDescription element : enumDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= enumDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Implicit Field (noOfSimpleDataTypes) + lengthInBits += 32; + + // Array field + if (simpleDataTypes != null) { + int i = 0; + for (SimpleTypeDescription element : simpleDataTypes) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= simpleDataTypes.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (schemaLocation) + lengthInBits += schemaLocation.getLengthInBits(); + + // Implicit Field (noOfFileHeader) + lengthInBits += 32; + + // Array field + if (fileHeader != null) { + int i = 0; + for (KeyValuePair element : fileHeader) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= fileHeader.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (body) + lengthInBits += body.getLengthInBits(); + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UABinaryFileDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + int noOfNamespaces = readImplicitField("noOfNamespaces", readSignedInt(readBuffer, 32)); + + List namespaces = + readCountArrayField( + "namespaces", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfNamespaces); + + int noOfStructureDataTypes = + readImplicitField("noOfStructureDataTypes", readSignedInt(readBuffer, 32)); + + List structureDataTypes = + readCountArrayField( + "structureDataTypes", + readComplex( + () -> + (StructureDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15489)), + readBuffer), + noOfStructureDataTypes); + + int noOfEnumDataTypes = readImplicitField("noOfEnumDataTypes", readSignedInt(readBuffer, 32)); + + List enumDataTypes = + readCountArrayField( + "enumDataTypes", + readComplex( + () -> + (EnumDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15490)), + readBuffer), + noOfEnumDataTypes); + + int noOfSimpleDataTypes = + readImplicitField("noOfSimpleDataTypes", readSignedInt(readBuffer, 32)); + + List simpleDataTypes = + readCountArrayField( + "simpleDataTypes", + readComplex( + () -> + (SimpleTypeDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15007)), + readBuffer), + noOfSimpleDataTypes); + + PascalString schemaLocation = + readSimpleField( + "schemaLocation", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfFileHeader = readImplicitField("noOfFileHeader", readSignedInt(readBuffer, 32)); + + List fileHeader = + readCountArrayField( + "fileHeader", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfFileHeader); + + Variant body = + readSimpleField("body", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + readBuffer.closeContext("UABinaryFileDataType"); + // Create the instance + return new UABinaryFileDataTypeBuilderImpl( + namespaces, + structureDataTypes, + enumDataTypes, + simpleDataTypes, + schemaLocation, + fileHeader, + body); + } + + public static class UABinaryFileDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final List namespaces; + private final List structureDataTypes; + private final List enumDataTypes; + private final List simpleDataTypes; + private final PascalString schemaLocation; + private final List fileHeader; + private final Variant body; + + public UABinaryFileDataTypeBuilderImpl( + List namespaces, + List structureDataTypes, + List enumDataTypes, + List simpleDataTypes, + PascalString schemaLocation, + List fileHeader, + Variant body) { + this.namespaces = namespaces; + this.structureDataTypes = structureDataTypes; + this.enumDataTypes = enumDataTypes; + this.simpleDataTypes = simpleDataTypes; + this.schemaLocation = schemaLocation; + this.fileHeader = fileHeader; + this.body = body; + } + + public UABinaryFileDataType build() { + UABinaryFileDataType uABinaryFileDataType = + new UABinaryFileDataType( + namespaces, + structureDataTypes, + enumDataTypes, + simpleDataTypes, + schemaLocation, + fileHeader, + body); + return uABinaryFileDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UABinaryFileDataType)) { + return false; + } + UABinaryFileDataType that = (UABinaryFileDataType) o; + return (getNamespaces() == that.getNamespaces()) + && (getStructureDataTypes() == that.getStructureDataTypes()) + && (getEnumDataTypes() == that.getEnumDataTypes()) + && (getSimpleDataTypes() == that.getSimpleDataTypes()) + && (getSchemaLocation() == that.getSchemaLocation()) + && (getFileHeader() == that.getFileHeader()) + && (getBody() == that.getBody()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getNamespaces(), + getStructureDataTypes(), + getEnumDataTypes(), + getSimpleDataTypes(), + getSchemaLocation(), + getFileHeader(), + getBody()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetReaderMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetReaderMessageDataType.java new file mode 100644 index 00000000000..98102d912b0 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetReaderMessageDataType.java @@ -0,0 +1,354 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UadpDataSetReaderMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15655; + } + + // Properties. + protected final long groupVersion; + protected final int networkMessageNumber; + protected final int dataSetOffset; + protected final GuidValue dataSetClassId; + protected final UadpNetworkMessageContentMask networkMessageContentMask; + protected final UadpDataSetMessageContentMask dataSetMessageContentMask; + protected final double publishingInterval; + protected final double receiveOffset; + protected final double processingOffset; + + public UadpDataSetReaderMessageDataType( + long groupVersion, + int networkMessageNumber, + int dataSetOffset, + GuidValue dataSetClassId, + UadpNetworkMessageContentMask networkMessageContentMask, + UadpDataSetMessageContentMask dataSetMessageContentMask, + double publishingInterval, + double receiveOffset, + double processingOffset) { + super(); + this.groupVersion = groupVersion; + this.networkMessageNumber = networkMessageNumber; + this.dataSetOffset = dataSetOffset; + this.dataSetClassId = dataSetClassId; + this.networkMessageContentMask = networkMessageContentMask; + this.dataSetMessageContentMask = dataSetMessageContentMask; + this.publishingInterval = publishingInterval; + this.receiveOffset = receiveOffset; + this.processingOffset = processingOffset; + } + + public long getGroupVersion() { + return groupVersion; + } + + public int getNetworkMessageNumber() { + return networkMessageNumber; + } + + public int getDataSetOffset() { + return dataSetOffset; + } + + public GuidValue getDataSetClassId() { + return dataSetClassId; + } + + public UadpNetworkMessageContentMask getNetworkMessageContentMask() { + return networkMessageContentMask; + } + + public UadpDataSetMessageContentMask getDataSetMessageContentMask() { + return dataSetMessageContentMask; + } + + public double getPublishingInterval() { + return publishingInterval; + } + + public double getReceiveOffset() { + return receiveOffset; + } + + public double getProcessingOffset() { + return processingOffset; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UadpDataSetReaderMessageDataType"); + + // Simple Field (groupVersion) + writeSimpleField("groupVersion", groupVersion, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (networkMessageNumber) + writeSimpleField( + "networkMessageNumber", networkMessageNumber, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (dataSetOffset) + writeSimpleField("dataSetOffset", dataSetOffset, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (dataSetClassId) + writeSimpleField("dataSetClassId", dataSetClassId, writeComplex(writeBuffer)); + + // Simple Field (networkMessageContentMask) + writeSimpleEnumField( + "networkMessageContentMask", + "UadpNetworkMessageContentMask", + networkMessageContentMask, + writeEnum( + UadpNetworkMessageContentMask::getValue, + UadpNetworkMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (dataSetMessageContentMask) + writeSimpleEnumField( + "dataSetMessageContentMask", + "UadpDataSetMessageContentMask", + dataSetMessageContentMask, + writeEnum( + UadpDataSetMessageContentMask::getValue, + UadpDataSetMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (publishingInterval) + writeSimpleField("publishingInterval", publishingInterval, writeDouble(writeBuffer, 64)); + + // Simple Field (receiveOffset) + writeSimpleField("receiveOffset", receiveOffset, writeDouble(writeBuffer, 64)); + + // Simple Field (processingOffset) + writeSimpleField("processingOffset", processingOffset, writeDouble(writeBuffer, 64)); + + writeBuffer.popContext("UadpDataSetReaderMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UadpDataSetReaderMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (groupVersion) + lengthInBits += 32; + + // Simple field (networkMessageNumber) + lengthInBits += 16; + + // Simple field (dataSetOffset) + lengthInBits += 16; + + // Simple field (dataSetClassId) + lengthInBits += dataSetClassId.getLengthInBits(); + + // Simple field (networkMessageContentMask) + lengthInBits += 32; + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32; + + // Simple field (publishingInterval) + lengthInBits += 64; + + // Simple field (receiveOffset) + lengthInBits += 64; + + // Simple field (processingOffset) + lengthInBits += 64; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UadpDataSetReaderMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long groupVersion = readSimpleField("groupVersion", readUnsignedLong(readBuffer, 32)); + + int networkMessageNumber = + readSimpleField("networkMessageNumber", readUnsignedInt(readBuffer, 16)); + + int dataSetOffset = readSimpleField("dataSetOffset", readUnsignedInt(readBuffer, 16)); + + GuidValue dataSetClassId = + readSimpleField( + "dataSetClassId", readComplex(() -> GuidValue.staticParse(readBuffer), readBuffer)); + + UadpNetworkMessageContentMask networkMessageContentMask = + readEnumField( + "networkMessageContentMask", + "UadpNetworkMessageContentMask", + readEnum( + UadpNetworkMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + UadpDataSetMessageContentMask dataSetMessageContentMask = + readEnumField( + "dataSetMessageContentMask", + "UadpDataSetMessageContentMask", + readEnum( + UadpDataSetMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + double publishingInterval = readSimpleField("publishingInterval", readDouble(readBuffer, 64)); + + double receiveOffset = readSimpleField("receiveOffset", readDouble(readBuffer, 64)); + + double processingOffset = readSimpleField("processingOffset", readDouble(readBuffer, 64)); + + readBuffer.closeContext("UadpDataSetReaderMessageDataType"); + // Create the instance + return new UadpDataSetReaderMessageDataTypeBuilderImpl( + groupVersion, + networkMessageNumber, + dataSetOffset, + dataSetClassId, + networkMessageContentMask, + dataSetMessageContentMask, + publishingInterval, + receiveOffset, + processingOffset); + } + + public static class UadpDataSetReaderMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long groupVersion; + private final int networkMessageNumber; + private final int dataSetOffset; + private final GuidValue dataSetClassId; + private final UadpNetworkMessageContentMask networkMessageContentMask; + private final UadpDataSetMessageContentMask dataSetMessageContentMask; + private final double publishingInterval; + private final double receiveOffset; + private final double processingOffset; + + public UadpDataSetReaderMessageDataTypeBuilderImpl( + long groupVersion, + int networkMessageNumber, + int dataSetOffset, + GuidValue dataSetClassId, + UadpNetworkMessageContentMask networkMessageContentMask, + UadpDataSetMessageContentMask dataSetMessageContentMask, + double publishingInterval, + double receiveOffset, + double processingOffset) { + this.groupVersion = groupVersion; + this.networkMessageNumber = networkMessageNumber; + this.dataSetOffset = dataSetOffset; + this.dataSetClassId = dataSetClassId; + this.networkMessageContentMask = networkMessageContentMask; + this.dataSetMessageContentMask = dataSetMessageContentMask; + this.publishingInterval = publishingInterval; + this.receiveOffset = receiveOffset; + this.processingOffset = processingOffset; + } + + public UadpDataSetReaderMessageDataType build() { + UadpDataSetReaderMessageDataType uadpDataSetReaderMessageDataType = + new UadpDataSetReaderMessageDataType( + groupVersion, + networkMessageNumber, + dataSetOffset, + dataSetClassId, + networkMessageContentMask, + dataSetMessageContentMask, + publishingInterval, + receiveOffset, + processingOffset); + return uadpDataSetReaderMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UadpDataSetReaderMessageDataType)) { + return false; + } + UadpDataSetReaderMessageDataType that = (UadpDataSetReaderMessageDataType) o; + return (getGroupVersion() == that.getGroupVersion()) + && (getNetworkMessageNumber() == that.getNetworkMessageNumber()) + && (getDataSetOffset() == that.getDataSetOffset()) + && (getDataSetClassId() == that.getDataSetClassId()) + && (getNetworkMessageContentMask() == that.getNetworkMessageContentMask()) + && (getDataSetMessageContentMask() == that.getDataSetMessageContentMask()) + && (getPublishingInterval() == that.getPublishingInterval()) + && (getReceiveOffset() == that.getReceiveOffset()) + && (getProcessingOffset() == that.getProcessingOffset()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getGroupVersion(), + getNetworkMessageNumber(), + getDataSetOffset(), + getDataSetClassId(), + getNetworkMessageContentMask(), + getDataSetMessageContentMask(), + getPublishingInterval(), + getReceiveOffset(), + getProcessingOffset()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetWriterMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetWriterMessageDataType.java new file mode 100644 index 00000000000..bcae7741da9 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpDataSetWriterMessageDataType.java @@ -0,0 +1,224 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UadpDataSetWriterMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15654; + } + + // Properties. + protected final UadpDataSetMessageContentMask dataSetMessageContentMask; + protected final int configuredSize; + protected final int networkMessageNumber; + protected final int dataSetOffset; + + public UadpDataSetWriterMessageDataType( + UadpDataSetMessageContentMask dataSetMessageContentMask, + int configuredSize, + int networkMessageNumber, + int dataSetOffset) { + super(); + this.dataSetMessageContentMask = dataSetMessageContentMask; + this.configuredSize = configuredSize; + this.networkMessageNumber = networkMessageNumber; + this.dataSetOffset = dataSetOffset; + } + + public UadpDataSetMessageContentMask getDataSetMessageContentMask() { + return dataSetMessageContentMask; + } + + public int getConfiguredSize() { + return configuredSize; + } + + public int getNetworkMessageNumber() { + return networkMessageNumber; + } + + public int getDataSetOffset() { + return dataSetOffset; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UadpDataSetWriterMessageDataType"); + + // Simple Field (dataSetMessageContentMask) + writeSimpleEnumField( + "dataSetMessageContentMask", + "UadpDataSetMessageContentMask", + dataSetMessageContentMask, + writeEnum( + UadpDataSetMessageContentMask::getValue, + UadpDataSetMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (configuredSize) + writeSimpleField("configuredSize", configuredSize, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (networkMessageNumber) + writeSimpleField( + "networkMessageNumber", networkMessageNumber, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (dataSetOffset) + writeSimpleField("dataSetOffset", dataSetOffset, writeUnsignedInt(writeBuffer, 16)); + + writeBuffer.popContext("UadpDataSetWriterMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UadpDataSetWriterMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (dataSetMessageContentMask) + lengthInBits += 32; + + // Simple field (configuredSize) + lengthInBits += 16; + + // Simple field (networkMessageNumber) + lengthInBits += 16; + + // Simple field (dataSetOffset) + lengthInBits += 16; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UadpDataSetWriterMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + UadpDataSetMessageContentMask dataSetMessageContentMask = + readEnumField( + "dataSetMessageContentMask", + "UadpDataSetMessageContentMask", + readEnum( + UadpDataSetMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + int configuredSize = readSimpleField("configuredSize", readUnsignedInt(readBuffer, 16)); + + int networkMessageNumber = + readSimpleField("networkMessageNumber", readUnsignedInt(readBuffer, 16)); + + int dataSetOffset = readSimpleField("dataSetOffset", readUnsignedInt(readBuffer, 16)); + + readBuffer.closeContext("UadpDataSetWriterMessageDataType"); + // Create the instance + return new UadpDataSetWriterMessageDataTypeBuilderImpl( + dataSetMessageContentMask, configuredSize, networkMessageNumber, dataSetOffset); + } + + public static class UadpDataSetWriterMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final UadpDataSetMessageContentMask dataSetMessageContentMask; + private final int configuredSize; + private final int networkMessageNumber; + private final int dataSetOffset; + + public UadpDataSetWriterMessageDataTypeBuilderImpl( + UadpDataSetMessageContentMask dataSetMessageContentMask, + int configuredSize, + int networkMessageNumber, + int dataSetOffset) { + this.dataSetMessageContentMask = dataSetMessageContentMask; + this.configuredSize = configuredSize; + this.networkMessageNumber = networkMessageNumber; + this.dataSetOffset = dataSetOffset; + } + + public UadpDataSetWriterMessageDataType build() { + UadpDataSetWriterMessageDataType uadpDataSetWriterMessageDataType = + new UadpDataSetWriterMessageDataType( + dataSetMessageContentMask, configuredSize, networkMessageNumber, dataSetOffset); + return uadpDataSetWriterMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UadpDataSetWriterMessageDataType)) { + return false; + } + UadpDataSetWriterMessageDataType that = (UadpDataSetWriterMessageDataType) o; + return (getDataSetMessageContentMask() == that.getDataSetMessageContentMask()) + && (getConfiguredSize() == that.getConfiguredSize()) + && (getNetworkMessageNumber() == that.getNetworkMessageNumber()) + && (getDataSetOffset() == that.getDataSetOffset()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getDataSetMessageContentMask(), + getConfiguredSize(), + getNetworkMessageNumber(), + getDataSetOffset()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpWriterGroupMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpWriterGroupMessageDataType.java new file mode 100644 index 00000000000..cdf4d535c6a --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UadpWriterGroupMessageDataType.java @@ -0,0 +1,273 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UadpWriterGroupMessageDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15647; + } + + // Properties. + protected final long groupVersion; + protected final DataSetOrderingType dataSetOrdering; + protected final UadpNetworkMessageContentMask networkMessageContentMask; + protected final double samplingOffset; + protected final List publishingOffset; + + public UadpWriterGroupMessageDataType( + long groupVersion, + DataSetOrderingType dataSetOrdering, + UadpNetworkMessageContentMask networkMessageContentMask, + double samplingOffset, + List publishingOffset) { + super(); + this.groupVersion = groupVersion; + this.dataSetOrdering = dataSetOrdering; + this.networkMessageContentMask = networkMessageContentMask; + this.samplingOffset = samplingOffset; + this.publishingOffset = publishingOffset; + } + + public long getGroupVersion() { + return groupVersion; + } + + public DataSetOrderingType getDataSetOrdering() { + return dataSetOrdering; + } + + public UadpNetworkMessageContentMask getNetworkMessageContentMask() { + return networkMessageContentMask; + } + + public double getSamplingOffset() { + return samplingOffset; + } + + public List getPublishingOffset() { + return publishingOffset; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UadpWriterGroupMessageDataType"); + + // Simple Field (groupVersion) + writeSimpleField("groupVersion", groupVersion, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (dataSetOrdering) + writeSimpleEnumField( + "dataSetOrdering", + "DataSetOrderingType", + dataSetOrdering, + writeEnum( + DataSetOrderingType::getValue, + DataSetOrderingType::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (networkMessageContentMask) + writeSimpleEnumField( + "networkMessageContentMask", + "UadpNetworkMessageContentMask", + networkMessageContentMask, + writeEnum( + UadpNetworkMessageContentMask::getValue, + UadpNetworkMessageContentMask::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (samplingOffset) + writeSimpleField("samplingOffset", samplingOffset, writeDouble(writeBuffer, 64)); + + // Implicit Field (noOfPublishingOffset) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfPublishingOffset = + (int) ((((getPublishingOffset()) == (null)) ? -(1) : COUNT(getPublishingOffset()))); + writeImplicitField( + "noOfPublishingOffset", noOfPublishingOffset, writeSignedInt(writeBuffer, 32)); + + // Array Field (publishingOffset) + writeSimpleTypeArrayField("publishingOffset", publishingOffset, writeDouble(writeBuffer, 64)); + + writeBuffer.popContext("UadpWriterGroupMessageDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UadpWriterGroupMessageDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (groupVersion) + lengthInBits += 32; + + // Simple field (dataSetOrdering) + lengthInBits += 32; + + // Simple field (networkMessageContentMask) + lengthInBits += 32; + + // Simple field (samplingOffset) + lengthInBits += 64; + + // Implicit Field (noOfPublishingOffset) + lengthInBits += 32; + + // Array field + if (publishingOffset != null) { + lengthInBits += 64 * publishingOffset.size(); + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UadpWriterGroupMessageDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long groupVersion = readSimpleField("groupVersion", readUnsignedLong(readBuffer, 32)); + + DataSetOrderingType dataSetOrdering = + readEnumField( + "dataSetOrdering", + "DataSetOrderingType", + readEnum(DataSetOrderingType::enumForValue, readUnsignedLong(readBuffer, 32))); + + UadpNetworkMessageContentMask networkMessageContentMask = + readEnumField( + "networkMessageContentMask", + "UadpNetworkMessageContentMask", + readEnum( + UadpNetworkMessageContentMask::enumForValue, readUnsignedLong(readBuffer, 32))); + + double samplingOffset = readSimpleField("samplingOffset", readDouble(readBuffer, 64)); + + int noOfPublishingOffset = + readImplicitField("noOfPublishingOffset", readSignedInt(readBuffer, 32)); + + List publishingOffset = + readCountArrayField("publishingOffset", readDouble(readBuffer, 64), noOfPublishingOffset); + + readBuffer.closeContext("UadpWriterGroupMessageDataType"); + // Create the instance + return new UadpWriterGroupMessageDataTypeBuilderImpl( + groupVersion, dataSetOrdering, networkMessageContentMask, samplingOffset, publishingOffset); + } + + public static class UadpWriterGroupMessageDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long groupVersion; + private final DataSetOrderingType dataSetOrdering; + private final UadpNetworkMessageContentMask networkMessageContentMask; + private final double samplingOffset; + private final List publishingOffset; + + public UadpWriterGroupMessageDataTypeBuilderImpl( + long groupVersion, + DataSetOrderingType dataSetOrdering, + UadpNetworkMessageContentMask networkMessageContentMask, + double samplingOffset, + List publishingOffset) { + this.groupVersion = groupVersion; + this.dataSetOrdering = dataSetOrdering; + this.networkMessageContentMask = networkMessageContentMask; + this.samplingOffset = samplingOffset; + this.publishingOffset = publishingOffset; + } + + public UadpWriterGroupMessageDataType build() { + UadpWriterGroupMessageDataType uadpWriterGroupMessageDataType = + new UadpWriterGroupMessageDataType( + groupVersion, + dataSetOrdering, + networkMessageContentMask, + samplingOffset, + publishingOffset); + return uadpWriterGroupMessageDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UadpWriterGroupMessageDataType)) { + return false; + } + UadpWriterGroupMessageDataType that = (UadpWriterGroupMessageDataType) o; + return (getGroupVersion() == that.getGroupVersion()) + && (getDataSetOrdering() == that.getDataSetOrdering()) + && (getNetworkMessageContentMask() == that.getNetworkMessageContentMask()) + && (getSamplingOffset() == that.getSamplingOffset()) + && (getPublishingOffset() == that.getPublishingOffset()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getGroupVersion(), + getDataSetOrdering(), + getNetworkMessageContentMask(), + getSamplingOffset(), + getPublishingOffset()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Union.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Union.java index f5f4d041f59..441a2647946 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Union.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/Union.java @@ -38,8 +38,8 @@ public class Union extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12758"; + public Integer getExtensionId() { + return (int) 12758; } public Union() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("Union"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesRequest.java index 8b6c9ac012a..7e4578526d5 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesRequest.java @@ -38,33 +38,24 @@ public class UnregisterNodesRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "566"; + public Integer getExtensionId() { + return (int) 566; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfNodesToUnregister; + protected final RequestHeader requestHeader; protected final List nodesToUnregister; - public UnregisterNodesRequest( - ExtensionObjectDefinition requestHeader, - int noOfNodesToUnregister, - List nodesToUnregister) { + public UnregisterNodesRequest(RequestHeader requestHeader, List nodesToUnregister) { super(); this.requestHeader = requestHeader; - this.noOfNodesToUnregister = noOfNodesToUnregister; this.nodesToUnregister = nodesToUnregister; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfNodesToUnregister() { - return noOfNodesToUnregister; - } - public List getNodesToUnregister() { return nodesToUnregister; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfNodesToUnregister) - writeSimpleField( + // Implicit Field (noOfNodesToUnregister) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToUnregister = + (int) ((((getNodesToUnregister()) == (null)) ? -(1) : COUNT(getNodesToUnregister()))); + writeImplicitField( "noOfNodesToUnregister", noOfNodesToUnregister, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToUnregister) @@ -103,7 +97,7 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfNodesToUnregister) + // Implicit Field (noOfNodesToUnregister) lengthInBits += 32; // Array field @@ -119,20 +113,21 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UnregisterNodesRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); int noOfNodesToUnregister = - readSimpleField("noOfNodesToUnregister", readSignedInt(readBuffer, 32)); + readImplicitField("noOfNodesToUnregister", readSignedInt(readBuffer, 32)); List nodesToUnregister = readCountArrayField( @@ -142,28 +137,23 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("UnregisterNodesRequest"); // Create the instance - return new UnregisterNodesRequestBuilderImpl( - requestHeader, noOfNodesToUnregister, nodesToUnregister); + return new UnregisterNodesRequestBuilderImpl(requestHeader, nodesToUnregister); } public static class UnregisterNodesRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfNodesToUnregister; + private final RequestHeader requestHeader; private final List nodesToUnregister; public UnregisterNodesRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfNodesToUnregister, - List nodesToUnregister) { + RequestHeader requestHeader, List nodesToUnregister) { this.requestHeader = requestHeader; - this.noOfNodesToUnregister = noOfNodesToUnregister; this.nodesToUnregister = nodesToUnregister; } public UnregisterNodesRequest build() { UnregisterNodesRequest unregisterNodesRequest = - new UnregisterNodesRequest(requestHeader, noOfNodesToUnregister, nodesToUnregister); + new UnregisterNodesRequest(requestHeader, nodesToUnregister); return unregisterNodesRequest; } } @@ -178,7 +168,6 @@ public boolean equals(Object o) { } UnregisterNodesRequest that = (UnregisterNodesRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfNodesToUnregister() == that.getNoOfNodesToUnregister()) && (getNodesToUnregister() == that.getNodesToUnregister()) && super.equals(that) && true; @@ -186,8 +175,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfNodesToUnregister(), getNodesToUnregister()); + return Objects.hash(super.hashCode(), getRequestHeader(), getNodesToUnregister()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesResponse.java index fca4c11d1e1..51fcff85326 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnregisterNodesResponse.java @@ -38,19 +38,19 @@ public class UnregisterNodesResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "569"; + public Integer getExtensionId() { + return (int) 569; } // Properties. - protected final ExtensionObjectDefinition responseHeader; + protected final ResponseHeader responseHeader; - public UnregisterNodesResponse(ExtensionObjectDefinition responseHeader) { + public UnregisterNodesResponse(ResponseHeader responseHeader) { super(); this.responseHeader = responseHeader; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } @@ -85,16 +85,17 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UnregisterNodesResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); readBuffer.closeContext("UnregisterNodesResponse"); @@ -104,9 +105,9 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit public static class UnregisterNodesResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; + private final ResponseHeader responseHeader; - public UnregisterNodesResponseBuilderImpl(ExtensionObjectDefinition responseHeader) { + public UnregisterNodesResponseBuilderImpl(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnsignedRationalNumber.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnsignedRationalNumber.java index 739f3418d1b..983ff43eae2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnsignedRationalNumber.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UnsignedRationalNumber.java @@ -38,8 +38,8 @@ public class UnsignedRationalNumber extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "24109"; + public Integer getExtensionId() { + return (int) 24109; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UnsignedRationalNumber"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateDataDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateDataDetails.java new file mode 100644 index 00000000000..0b12e29c3a7 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateDataDetails.java @@ -0,0 +1,214 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UpdateDataDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 682; + } + + // Properties. + protected final NodeId nodeId; + protected final PerformUpdateType performInsertReplace; + protected final List updateValues; + + public UpdateDataDetails( + NodeId nodeId, PerformUpdateType performInsertReplace, List updateValues) { + super(); + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.updateValues = updateValues; + } + + public NodeId getNodeId() { + return nodeId; + } + + public PerformUpdateType getPerformInsertReplace() { + return performInsertReplace; + } + + public List getUpdateValues() { + return updateValues; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UpdateDataDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Simple Field (performInsertReplace) + writeSimpleEnumField( + "performInsertReplace", + "PerformUpdateType", + performInsertReplace, + writeEnum( + PerformUpdateType::getValue, + PerformUpdateType::name, + writeUnsignedLong(writeBuffer, 32))); + + // Implicit Field (noOfUpdateValues) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfUpdateValues = + (int) ((((getUpdateValues()) == (null)) ? -(1) : COUNT(getUpdateValues()))); + writeImplicitField("noOfUpdateValues", noOfUpdateValues, writeSignedInt(writeBuffer, 32)); + + // Array Field (updateValues) + writeComplexTypeArrayField("updateValues", updateValues, writeBuffer); + + writeBuffer.popContext("UpdateDataDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UpdateDataDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Simple field (performInsertReplace) + lengthInBits += 32; + + // Implicit Field (noOfUpdateValues) + lengthInBits += 32; + + // Array field + if (updateValues != null) { + int i = 0; + for (DataValue element : updateValues) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= updateValues.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UpdateDataDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + PerformUpdateType performInsertReplace = + readEnumField( + "performInsertReplace", + "PerformUpdateType", + readEnum(PerformUpdateType::enumForValue, readUnsignedLong(readBuffer, 32))); + + int noOfUpdateValues = readImplicitField("noOfUpdateValues", readSignedInt(readBuffer, 32)); + + List updateValues = + readCountArrayField( + "updateValues", + readComplex(() -> DataValue.staticParse(readBuffer), readBuffer), + noOfUpdateValues); + + readBuffer.closeContext("UpdateDataDetails"); + // Create the instance + return new UpdateDataDetailsBuilderImpl(nodeId, performInsertReplace, updateValues); + } + + public static class UpdateDataDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final PerformUpdateType performInsertReplace; + private final List updateValues; + + public UpdateDataDetailsBuilderImpl( + NodeId nodeId, PerformUpdateType performInsertReplace, List updateValues) { + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.updateValues = updateValues; + } + + public UpdateDataDetails build() { + UpdateDataDetails updateDataDetails = + new UpdateDataDetails(nodeId, performInsertReplace, updateValues); + return updateDataDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UpdateDataDetails)) { + return false; + } + UpdateDataDetails that = (UpdateDataDetails) o; + return (getNodeId() == that.getNodeId()) + && (getPerformInsertReplace() == that.getPerformInsertReplace()) + && (getUpdateValues() == that.getUpdateValues()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNodeId(), getPerformInsertReplace(), getUpdateValues()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateEventDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateEventDetails.java new file mode 100644 index 00000000000..22bd44bcdd3 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateEventDetails.java @@ -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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UpdateEventDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 685; + } + + // Properties. + protected final NodeId nodeId; + protected final PerformUpdateType performInsertReplace; + protected final EventFilter filter; + protected final List eventData; + + public UpdateEventDetails( + NodeId nodeId, + PerformUpdateType performInsertReplace, + EventFilter filter, + List eventData) { + super(); + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.filter = filter; + this.eventData = eventData; + } + + public NodeId getNodeId() { + return nodeId; + } + + public PerformUpdateType getPerformInsertReplace() { + return performInsertReplace; + } + + public EventFilter getFilter() { + return filter; + } + + public List getEventData() { + return eventData; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UpdateEventDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Simple Field (performInsertReplace) + writeSimpleEnumField( + "performInsertReplace", + "PerformUpdateType", + performInsertReplace, + writeEnum( + PerformUpdateType::getValue, + PerformUpdateType::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (filter) + writeSimpleField("filter", filter, writeComplex(writeBuffer)); + + // Implicit Field (noOfEventData) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfEventData = (int) ((((getEventData()) == (null)) ? -(1) : COUNT(getEventData()))); + writeImplicitField("noOfEventData", noOfEventData, writeSignedInt(writeBuffer, 32)); + + // Array Field (eventData) + writeComplexTypeArrayField("eventData", eventData, writeBuffer); + + writeBuffer.popContext("UpdateEventDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UpdateEventDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Simple field (performInsertReplace) + lengthInBits += 32; + + // Simple field (filter) + lengthInBits += filter.getLengthInBits(); + + // Implicit Field (noOfEventData) + lengthInBits += 32; + + // Array field + if (eventData != null) { + int i = 0; + for (HistoryEventFieldList element : eventData) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= eventData.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UpdateEventDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + PerformUpdateType performInsertReplace = + readEnumField( + "performInsertReplace", + "PerformUpdateType", + readEnum(PerformUpdateType::enumForValue, readUnsignedLong(readBuffer, 32))); + + EventFilter filter = + readSimpleField( + "filter", + readComplex( + () -> (EventFilter) ExtensionObjectDefinition.staticParse(readBuffer, (int) (727)), + readBuffer)); + + int noOfEventData = readImplicitField("noOfEventData", readSignedInt(readBuffer, 32)); + + List eventData = + readCountArrayField( + "eventData", + readComplex( + () -> + (HistoryEventFieldList) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (922)), + readBuffer), + noOfEventData); + + readBuffer.closeContext("UpdateEventDetails"); + // Create the instance + return new UpdateEventDetailsBuilderImpl(nodeId, performInsertReplace, filter, eventData); + } + + public static class UpdateEventDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final PerformUpdateType performInsertReplace; + private final EventFilter filter; + private final List eventData; + + public UpdateEventDetailsBuilderImpl( + NodeId nodeId, + PerformUpdateType performInsertReplace, + EventFilter filter, + List eventData) { + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.filter = filter; + this.eventData = eventData; + } + + public UpdateEventDetails build() { + UpdateEventDetails updateEventDetails = + new UpdateEventDetails(nodeId, performInsertReplace, filter, eventData); + return updateEventDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UpdateEventDetails)) { + return false; + } + UpdateEventDetails that = (UpdateEventDetails) o; + return (getNodeId() == that.getNodeId()) + && (getPerformInsertReplace() == that.getPerformInsertReplace()) + && (getFilter() == that.getFilter()) + && (getEventData() == that.getEventData()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNodeId(), getPerformInsertReplace(), getFilter(), getEventData()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateStructureDataDetails.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateStructureDataDetails.java new file mode 100644 index 00000000000..f0bda437436 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UpdateStructureDataDetails.java @@ -0,0 +1,214 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class UpdateStructureDataDetails extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 11297; + } + + // Properties. + protected final NodeId nodeId; + protected final PerformUpdateType performInsertReplace; + protected final List updateValues; + + public UpdateStructureDataDetails( + NodeId nodeId, PerformUpdateType performInsertReplace, List updateValues) { + super(); + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.updateValues = updateValues; + } + + public NodeId getNodeId() { + return nodeId; + } + + public PerformUpdateType getPerformInsertReplace() { + return performInsertReplace; + } + + public List getUpdateValues() { + return updateValues; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("UpdateStructureDataDetails"); + + // Simple Field (nodeId) + writeSimpleField("nodeId", nodeId, writeComplex(writeBuffer)); + + // Simple Field (performInsertReplace) + writeSimpleEnumField( + "performInsertReplace", + "PerformUpdateType", + performInsertReplace, + writeEnum( + PerformUpdateType::getValue, + PerformUpdateType::name, + writeUnsignedLong(writeBuffer, 32))); + + // Implicit Field (noOfUpdateValues) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfUpdateValues = + (int) ((((getUpdateValues()) == (null)) ? -(1) : COUNT(getUpdateValues()))); + writeImplicitField("noOfUpdateValues", noOfUpdateValues, writeSignedInt(writeBuffer, 32)); + + // Array Field (updateValues) + writeComplexTypeArrayField("updateValues", updateValues, writeBuffer); + + writeBuffer.popContext("UpdateStructureDataDetails"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + UpdateStructureDataDetails _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (nodeId) + lengthInBits += nodeId.getLengthInBits(); + + // Simple field (performInsertReplace) + lengthInBits += 32; + + // Implicit Field (noOfUpdateValues) + lengthInBits += 32; + + // Array field + if (updateValues != null) { + int i = 0; + for (DataValue element : updateValues) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= updateValues.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("UpdateStructureDataDetails"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + NodeId nodeId = + readSimpleField("nodeId", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + PerformUpdateType performInsertReplace = + readEnumField( + "performInsertReplace", + "PerformUpdateType", + readEnum(PerformUpdateType::enumForValue, readUnsignedLong(readBuffer, 32))); + + int noOfUpdateValues = readImplicitField("noOfUpdateValues", readSignedInt(readBuffer, 32)); + + List updateValues = + readCountArrayField( + "updateValues", + readComplex(() -> DataValue.staticParse(readBuffer), readBuffer), + noOfUpdateValues); + + readBuffer.closeContext("UpdateStructureDataDetails"); + // Create the instance + return new UpdateStructureDataDetailsBuilderImpl(nodeId, performInsertReplace, updateValues); + } + + public static class UpdateStructureDataDetailsBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final NodeId nodeId; + private final PerformUpdateType performInsertReplace; + private final List updateValues; + + public UpdateStructureDataDetailsBuilderImpl( + NodeId nodeId, PerformUpdateType performInsertReplace, List updateValues) { + this.nodeId = nodeId; + this.performInsertReplace = performInsertReplace; + this.updateValues = updateValues; + } + + public UpdateStructureDataDetails build() { + UpdateStructureDataDetails updateStructureDataDetails = + new UpdateStructureDataDetails(nodeId, performInsertReplace, updateValues); + return updateStructureDataDetails; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UpdateStructureDataDetails)) { + return false; + } + UpdateStructureDataDetails that = (UpdateStructureDataDetails) o; + return (getNodeId() == that.getNodeId()) + && (getPerformInsertReplace() == that.getPerformInsertReplace()) + && (getUpdateValues() == that.getUpdateValues()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), getNodeId(), getPerformInsertReplace(), getUpdateValues()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityToken.java index 8015fb95a78..583689b7318 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserIdentityToken.java @@ -38,29 +38,22 @@ public class UserIdentityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "316"; + public Integer getExtensionId() { + return (int) 318; } // Properties. protected final PascalString policyId; - protected final UserIdentityTokenDefinition userIdentityTokenDefinition; - public UserIdentityToken( - PascalString policyId, UserIdentityTokenDefinition userIdentityTokenDefinition) { + public UserIdentityToken(PascalString policyId) { super(); this.policyId = policyId; - this.userIdentityTokenDefinition = userIdentityTokenDefinition; } public PascalString getPolicyId() { return policyId; } - public UserIdentityTokenDefinition getUserIdentityTokenDefinition() { - return userIdentityTokenDefinition; - } - @Override protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { @@ -68,21 +61,9 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("UserIdentityToken"); - // Implicit Field (policyLength) (Used for parsing, but its value is not stored as it's - // implicitly given by the objects content) - int policyLength = - (int) - ((getPolicyId().getLengthInBytes()) - + (getUserIdentityTokenDefinition().getLengthInBytes())); - writeImplicitField("policyLength", policyLength, writeSignedInt(writeBuffer, 32)); - // Simple Field (policyId) writeSimpleField("policyId", policyId, writeComplex(writeBuffer)); - // Simple Field (userIdentityTokenDefinition) - writeSimpleField( - "userIdentityTokenDefinition", userIdentityTokenDefinition, writeComplex(writeBuffer)); - writeBuffer.popContext("UserIdentityToken"); } @@ -97,58 +78,37 @@ public int getLengthInBits() { UserIdentityToken _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - // Implicit Field (policyLength) - lengthInBits += 32; - // Simple field (policyId) lengthInBits += policyId.getLengthInBits(); - // Simple field (userIdentityTokenDefinition) - lengthInBits += userIdentityTokenDefinition.getLengthInBits(); - return lengthInBits; } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UserIdentityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - int policyLength = readImplicitField("policyLength", readSignedInt(readBuffer, 32)); - PascalString policyId = readSimpleField( "policyId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); - UserIdentityTokenDefinition userIdentityTokenDefinition = - readSimpleField( - "userIdentityTokenDefinition", - readComplex( - () -> - UserIdentityTokenDefinition.staticParse( - readBuffer, (String) (policyId.getStringValue())), - readBuffer)); - readBuffer.closeContext("UserIdentityToken"); // Create the instance - return new UserIdentityTokenBuilderImpl(policyId, userIdentityTokenDefinition); + return new UserIdentityTokenBuilderImpl(policyId); } public static class UserIdentityTokenBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { private final PascalString policyId; - private final UserIdentityTokenDefinition userIdentityTokenDefinition; - public UserIdentityTokenBuilderImpl( - PascalString policyId, UserIdentityTokenDefinition userIdentityTokenDefinition) { + public UserIdentityTokenBuilderImpl(PascalString policyId) { this.policyId = policyId; - this.userIdentityTokenDefinition = userIdentityTokenDefinition; } public UserIdentityToken build() { - UserIdentityToken userIdentityToken = - new UserIdentityToken(policyId, userIdentityTokenDefinition); + UserIdentityToken userIdentityToken = new UserIdentityToken(policyId); return userIdentityToken; } } @@ -162,15 +122,12 @@ public boolean equals(Object o) { return false; } UserIdentityToken that = (UserIdentityToken) o; - return (getPolicyId() == that.getPolicyId()) - && (getUserIdentityTokenDefinition() == that.getUserIdentityTokenDefinition()) - && super.equals(that) - && true; + return (getPolicyId() == that.getPolicyId()) && super.equals(that) && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getPolicyId(), getUserIdentityTokenDefinition()); + return Objects.hash(super.hashCode(), getPolicyId()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserManagementDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserManagementDataType.java index 17c5b2d5f8e..a9cbb54aebf 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserManagementDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserManagementDataType.java @@ -38,8 +38,8 @@ public class UserManagementDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "24283"; + public Integer getExtensionId() { + return (int) 24283; } // Properties. @@ -117,7 +117,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UserManagementDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserNameIdentityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserNameIdentityToken.java index 1ba27b9c505..5924c85a093 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserNameIdentityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserNameIdentityToken.java @@ -35,26 +35,35 @@ // Code generated by code-generation. DO NOT EDIT. -public class UserNameIdentityToken extends UserIdentityTokenDefinition implements Message { +public class UserNameIdentityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "username"; + public Integer getExtensionId() { + return (int) 324; } // Properties. + protected final PascalString policyId; protected final PascalString userName; protected final PascalByteString password; protected final PascalString encryptionAlgorithm; public UserNameIdentityToken( - PascalString userName, PascalByteString password, PascalString encryptionAlgorithm) { + PascalString policyId, + PascalString userName, + PascalByteString password, + PascalString encryptionAlgorithm) { super(); + this.policyId = policyId; this.userName = userName; this.password = password; this.encryptionAlgorithm = encryptionAlgorithm; } + public PascalString getPolicyId() { + return policyId; + } + public PascalString getUserName() { return userName; } @@ -68,12 +77,15 @@ public PascalString getEncryptionAlgorithm() { } @Override - protected void serializeUserIdentityTokenDefinitionChild(WriteBuffer writeBuffer) + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("UserNameIdentityToken"); + // Simple Field (policyId) + writeSimpleField("policyId", policyId, writeComplex(writeBuffer)); + // Simple Field (userName) writeSimpleField("userName", userName, writeComplex(writeBuffer)); @@ -97,6 +109,9 @@ public int getLengthInBits() { UserNameIdentityToken _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + // Simple field (policyId) + lengthInBits += policyId.getLengthInBits(); + // Simple field (userName) lengthInBits += userName.getLengthInBits(); @@ -109,12 +124,16 @@ public int getLengthInBits() { return lengthInBits; } - public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UserNameIdentityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + PascalString policyId = + readSimpleField( + "policyId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + PascalString userName = readSimpleField( "userName", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); @@ -130,17 +149,22 @@ public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDef readBuffer.closeContext("UserNameIdentityToken"); // Create the instance - return new UserNameIdentityTokenBuilderImpl(userName, password, encryptionAlgorithm); + return new UserNameIdentityTokenBuilderImpl(policyId, userName, password, encryptionAlgorithm); } public static class UserNameIdentityTokenBuilderImpl - implements UserIdentityTokenDefinition.UserIdentityTokenDefinitionBuilder { + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString policyId; private final PascalString userName; private final PascalByteString password; private final PascalString encryptionAlgorithm; public UserNameIdentityTokenBuilderImpl( - PascalString userName, PascalByteString password, PascalString encryptionAlgorithm) { + PascalString policyId, + PascalString userName, + PascalByteString password, + PascalString encryptionAlgorithm) { + this.policyId = policyId; this.userName = userName; this.password = password; this.encryptionAlgorithm = encryptionAlgorithm; @@ -148,7 +172,7 @@ public UserNameIdentityTokenBuilderImpl( public UserNameIdentityToken build() { UserNameIdentityToken userNameIdentityToken = - new UserNameIdentityToken(userName, password, encryptionAlgorithm); + new UserNameIdentityToken(policyId, userName, password, encryptionAlgorithm); return userNameIdentityToken; } } @@ -162,7 +186,8 @@ public boolean equals(Object o) { return false; } UserNameIdentityToken that = (UserNameIdentityToken) o; - return (getUserName() == that.getUserName()) + return (getPolicyId() == that.getPolicyId()) + && (getUserName() == that.getUserName()) && (getPassword() == that.getPassword()) && (getEncryptionAlgorithm() == that.getEncryptionAlgorithm()) && super.equals(that) @@ -171,7 +196,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(super.hashCode(), getUserName(), getPassword(), getEncryptionAlgorithm()); + return Objects.hash( + super.hashCode(), getPolicyId(), getUserName(), getPassword(), getEncryptionAlgorithm()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserTokenPolicy.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserTokenPolicy.java index 86ba9316791..b489347a3d7 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserTokenPolicy.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/UserTokenPolicy.java @@ -38,8 +38,8 @@ public class UserTokenPolicy extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "306"; + public Integer getExtensionId() { + return (int) 306; } // Properties. @@ -143,7 +143,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("UserTokenPolicy"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableAttributes.java new file mode 100644 index 00000000000..579eab1c71b --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableAttributes.java @@ -0,0 +1,450 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class VariableAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 357; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final Variant value; + protected final NodeId dataType; + protected final int valueRank; + protected final List arrayDimensions; + protected final short accessLevel; + protected final short userAccessLevel; + protected final double minimumSamplingInterval; + protected final boolean historizing; + + public VariableAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + Variant value, + NodeId dataType, + int valueRank, + List arrayDimensions, + short accessLevel, + short userAccessLevel, + double minimumSamplingInterval, + boolean historizing) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.value = value; + this.dataType = dataType; + this.valueRank = valueRank; + this.arrayDimensions = arrayDimensions; + this.accessLevel = accessLevel; + this.userAccessLevel = userAccessLevel; + this.minimumSamplingInterval = minimumSamplingInterval; + this.historizing = historizing; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public Variant getValue() { + return value; + } + + public NodeId getDataType() { + return dataType; + } + + public int getValueRank() { + return valueRank; + } + + public List getArrayDimensions() { + return arrayDimensions; + } + + public short getAccessLevel() { + return accessLevel; + } + + public short getUserAccessLevel() { + return userAccessLevel; + } + + public double getMinimumSamplingInterval() { + return minimumSamplingInterval; + } + + public boolean getHistorizing() { + return historizing; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("VariableAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (value) + writeSimpleField("value", value, writeComplex(writeBuffer)); + + // Simple Field (dataType) + writeSimpleField("dataType", dataType, writeComplex(writeBuffer)); + + // Simple Field (valueRank) + writeSimpleField("valueRank", valueRank, writeSignedInt(writeBuffer, 32)); + + // Implicit Field (noOfArrayDimensions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfArrayDimensions = + (int) ((((getArrayDimensions()) == (null)) ? -(1) : COUNT(getArrayDimensions()))); + writeImplicitField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); + + // Array Field (arrayDimensions) + writeSimpleTypeArrayField( + "arrayDimensions", arrayDimensions, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (accessLevel) + writeSimpleField("accessLevel", accessLevel, writeUnsignedShort(writeBuffer, 8)); + + // Simple Field (userAccessLevel) + writeSimpleField("userAccessLevel", userAccessLevel, writeUnsignedShort(writeBuffer, 8)); + + // Simple Field (minimumSamplingInterval) + writeSimpleField( + "minimumSamplingInterval", minimumSamplingInterval, writeDouble(writeBuffer, 64)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (historizing) + writeSimpleField("historizing", historizing, writeBoolean(writeBuffer)); + + writeBuffer.popContext("VariableAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + VariableAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Simple field (value) + lengthInBits += value.getLengthInBits(); + + // Simple field (dataType) + lengthInBits += dataType.getLengthInBits(); + + // Simple field (valueRank) + lengthInBits += 32; + + // Implicit Field (noOfArrayDimensions) + lengthInBits += 32; + + // Array field + if (arrayDimensions != null) { + lengthInBits += 32 * arrayDimensions.size(); + } + + // Simple field (accessLevel) + lengthInBits += 8; + + // Simple field (userAccessLevel) + lengthInBits += 8; + + // Simple field (minimumSamplingInterval) + lengthInBits += 64; + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (historizing) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("VariableAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Variant value = + readSimpleField("value", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + NodeId dataType = + readSimpleField("dataType", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int valueRank = readSimpleField("valueRank", readSignedInt(readBuffer, 32)); + + int noOfArrayDimensions = + readImplicitField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); + + List arrayDimensions = + readCountArrayField( + "arrayDimensions", readUnsignedLong(readBuffer, 32), noOfArrayDimensions); + + short accessLevel = readSimpleField("accessLevel", readUnsignedShort(readBuffer, 8)); + + short userAccessLevel = readSimpleField("userAccessLevel", readUnsignedShort(readBuffer, 8)); + + double minimumSamplingInterval = + readSimpleField("minimumSamplingInterval", readDouble(readBuffer, 64)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean historizing = readSimpleField("historizing", readBoolean(readBuffer)); + + readBuffer.closeContext("VariableAttributes"); + // Create the instance + return new VariableAttributesBuilderImpl( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + value, + dataType, + valueRank, + arrayDimensions, + accessLevel, + userAccessLevel, + minimumSamplingInterval, + historizing); + } + + public static class VariableAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final Variant value; + private final NodeId dataType; + private final int valueRank; + private final List arrayDimensions; + private final short accessLevel; + private final short userAccessLevel; + private final double minimumSamplingInterval; + private final boolean historizing; + + public VariableAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + Variant value, + NodeId dataType, + int valueRank, + List arrayDimensions, + short accessLevel, + short userAccessLevel, + double minimumSamplingInterval, + boolean historizing) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.value = value; + this.dataType = dataType; + this.valueRank = valueRank; + this.arrayDimensions = arrayDimensions; + this.accessLevel = accessLevel; + this.userAccessLevel = userAccessLevel; + this.minimumSamplingInterval = minimumSamplingInterval; + this.historizing = historizing; + } + + public VariableAttributes build() { + VariableAttributes variableAttributes = + new VariableAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + value, + dataType, + valueRank, + arrayDimensions, + accessLevel, + userAccessLevel, + minimumSamplingInterval, + historizing); + return variableAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof VariableAttributes)) { + return false; + } + VariableAttributes that = (VariableAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getValue() == that.getValue()) + && (getDataType() == that.getDataType()) + && (getValueRank() == that.getValueRank()) + && (getArrayDimensions() == that.getArrayDimensions()) + && (getAccessLevel() == that.getAccessLevel()) + && (getUserAccessLevel() == that.getUserAccessLevel()) + && (getMinimumSamplingInterval() == that.getMinimumSamplingInterval()) + && (getHistorizing() == that.getHistorizing()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getValue(), + getDataType(), + getValueRank(), + getArrayDimensions(), + getAccessLevel(), + getUserAccessLevel(), + getMinimumSamplingInterval(), + getHistorizing()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableTypeAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableTypeAttributes.java new file mode 100644 index 00000000000..9c20844eaf1 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/VariableTypeAttributes.java @@ -0,0 +1,382 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class VariableTypeAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 366; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final Variant value; + protected final NodeId dataType; + protected final int valueRank; + protected final List arrayDimensions; + protected final boolean isAbstract; + + public VariableTypeAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + Variant value, + NodeId dataType, + int valueRank, + List arrayDimensions, + boolean isAbstract) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.value = value; + this.dataType = dataType; + this.valueRank = valueRank; + this.arrayDimensions = arrayDimensions; + this.isAbstract = isAbstract; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public Variant getValue() { + return value; + } + + public NodeId getDataType() { + return dataType; + } + + public int getValueRank() { + return valueRank; + } + + public List getArrayDimensions() { + return arrayDimensions; + } + + public boolean getIsAbstract() { + return isAbstract; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("VariableTypeAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (value) + writeSimpleField("value", value, writeComplex(writeBuffer)); + + // Simple Field (dataType) + writeSimpleField("dataType", dataType, writeComplex(writeBuffer)); + + // Simple Field (valueRank) + writeSimpleField("valueRank", valueRank, writeSignedInt(writeBuffer, 32)); + + // Implicit Field (noOfArrayDimensions) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfArrayDimensions = + (int) ((((getArrayDimensions()) == (null)) ? -(1) : COUNT(getArrayDimensions()))); + writeImplicitField("noOfArrayDimensions", noOfArrayDimensions, writeSignedInt(writeBuffer, 32)); + + // Array Field (arrayDimensions) + writeSimpleTypeArrayField( + "arrayDimensions", arrayDimensions, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (isAbstract) + writeSimpleField("isAbstract", isAbstract, writeBoolean(writeBuffer)); + + writeBuffer.popContext("VariableTypeAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + VariableTypeAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Simple field (value) + lengthInBits += value.getLengthInBits(); + + // Simple field (dataType) + lengthInBits += dataType.getLengthInBits(); + + // Simple field (valueRank) + lengthInBits += 32; + + // Implicit Field (noOfArrayDimensions) + lengthInBits += 32; + + // Array field + if (arrayDimensions != null) { + lengthInBits += 32 * arrayDimensions.size(); + } + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (isAbstract) + lengthInBits += 1; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("VariableTypeAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Variant value = + readSimpleField("value", readComplex(() -> Variant.staticParse(readBuffer), readBuffer)); + + NodeId dataType = + readSimpleField("dataType", readComplex(() -> NodeId.staticParse(readBuffer), readBuffer)); + + int valueRank = readSimpleField("valueRank", readSignedInt(readBuffer, 32)); + + int noOfArrayDimensions = + readImplicitField("noOfArrayDimensions", readSignedInt(readBuffer, 32)); + + List arrayDimensions = + readCountArrayField( + "arrayDimensions", readUnsignedLong(readBuffer, 32), noOfArrayDimensions); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean isAbstract = readSimpleField("isAbstract", readBoolean(readBuffer)); + + readBuffer.closeContext("VariableTypeAttributes"); + // Create the instance + return new VariableTypeAttributesBuilderImpl( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + value, + dataType, + valueRank, + arrayDimensions, + isAbstract); + } + + public static class VariableTypeAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final Variant value; + private final NodeId dataType; + private final int valueRank; + private final List arrayDimensions; + private final boolean isAbstract; + + public VariableTypeAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + Variant value, + NodeId dataType, + int valueRank, + List arrayDimensions, + boolean isAbstract) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.value = value; + this.dataType = dataType; + this.valueRank = valueRank; + this.arrayDimensions = arrayDimensions; + this.isAbstract = isAbstract; + } + + public VariableTypeAttributes build() { + VariableTypeAttributes variableTypeAttributes = + new VariableTypeAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + value, + dataType, + valueRank, + arrayDimensions, + isAbstract); + return variableTypeAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof VariableTypeAttributes)) { + return false; + } + VariableTypeAttributes that = (VariableTypeAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getValue() == that.getValue()) + && (getDataType() == that.getDataType()) + && (getValueRank() == that.getValueRank()) + && (getArrayDimensions() == that.getArrayDimensions()) + && (getIsAbstract() == that.getIsAbstract()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getValue(), + getDataType(), + getValueRank(), + getArrayDimensions(), + getIsAbstract()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewAttributes.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewAttributes.java new file mode 100644 index 00000000000..e2e27724287 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewAttributes.java @@ -0,0 +1,297 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class ViewAttributes extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 375; + } + + // Properties. + protected final long specifiedAttributes; + protected final LocalizedText displayName; + protected final LocalizedText description; + protected final long writeMask; + protected final long userWriteMask; + protected final boolean containsNoLoops; + protected final short eventNotifier; + + public ViewAttributes( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean containsNoLoops, + short eventNotifier) { + super(); + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.containsNoLoops = containsNoLoops; + this.eventNotifier = eventNotifier; + } + + public long getSpecifiedAttributes() { + return specifiedAttributes; + } + + public LocalizedText getDisplayName() { + return displayName; + } + + public LocalizedText getDescription() { + return description; + } + + public long getWriteMask() { + return writeMask; + } + + public long getUserWriteMask() { + return userWriteMask; + } + + public boolean getContainsNoLoops() { + return containsNoLoops; + } + + public short getEventNotifier() { + return eventNotifier; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("ViewAttributes"); + + // Simple Field (specifiedAttributes) + writeSimpleField( + "specifiedAttributes", specifiedAttributes, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (displayName) + writeSimpleField("displayName", displayName, writeComplex(writeBuffer)); + + // Simple Field (description) + writeSimpleField("description", description, writeComplex(writeBuffer)); + + // Simple Field (writeMask) + writeSimpleField("writeMask", writeMask, writeUnsignedLong(writeBuffer, 32)); + + // Simple Field (userWriteMask) + writeSimpleField("userWriteMask", userWriteMask, writeUnsignedLong(writeBuffer, 32)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (containsNoLoops) + writeSimpleField("containsNoLoops", containsNoLoops, writeBoolean(writeBuffer)); + + // Simple Field (eventNotifier) + writeSimpleField("eventNotifier", eventNotifier, writeUnsignedShort(writeBuffer, 8)); + + writeBuffer.popContext("ViewAttributes"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + ViewAttributes _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (specifiedAttributes) + lengthInBits += 32; + + // Simple field (displayName) + lengthInBits += displayName.getLengthInBits(); + + // Simple field (description) + lengthInBits += description.getLengthInBits(); + + // Simple field (writeMask) + lengthInBits += 32; + + // Simple field (userWriteMask) + lengthInBits += 32; + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (containsNoLoops) + lengthInBits += 1; + + // Simple field (eventNotifier) + lengthInBits += 8; + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("ViewAttributes"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + long specifiedAttributes = + readSimpleField("specifiedAttributes", readUnsignedLong(readBuffer, 32)); + + LocalizedText displayName = + readSimpleField( + "displayName", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + LocalizedText description = + readSimpleField( + "description", readComplex(() -> LocalizedText.staticParse(readBuffer), readBuffer)); + + long writeMask = readSimpleField("writeMask", readUnsignedLong(readBuffer, 32)); + + long userWriteMask = readSimpleField("userWriteMask", readUnsignedLong(readBuffer, 32)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean containsNoLoops = readSimpleField("containsNoLoops", readBoolean(readBuffer)); + + short eventNotifier = readSimpleField("eventNotifier", readUnsignedShort(readBuffer, 8)); + + readBuffer.closeContext("ViewAttributes"); + // Create the instance + return new ViewAttributesBuilderImpl( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + containsNoLoops, + eventNotifier); + } + + public static class ViewAttributesBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final long specifiedAttributes; + private final LocalizedText displayName; + private final LocalizedText description; + private final long writeMask; + private final long userWriteMask; + private final boolean containsNoLoops; + private final short eventNotifier; + + public ViewAttributesBuilderImpl( + long specifiedAttributes, + LocalizedText displayName, + LocalizedText description, + long writeMask, + long userWriteMask, + boolean containsNoLoops, + short eventNotifier) { + this.specifiedAttributes = specifiedAttributes; + this.displayName = displayName; + this.description = description; + this.writeMask = writeMask; + this.userWriteMask = userWriteMask; + this.containsNoLoops = containsNoLoops; + this.eventNotifier = eventNotifier; + } + + public ViewAttributes build() { + ViewAttributes viewAttributes = + new ViewAttributes( + specifiedAttributes, + displayName, + description, + writeMask, + userWriteMask, + containsNoLoops, + eventNotifier); + return viewAttributes; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ViewAttributes)) { + return false; + } + ViewAttributes that = (ViewAttributes) o; + return (getSpecifiedAttributes() == that.getSpecifiedAttributes()) + && (getDisplayName() == that.getDisplayName()) + && (getDescription() == that.getDescription()) + && (getWriteMask() == that.getWriteMask()) + && (getUserWriteMask() == that.getUserWriteMask()) + && (getContainsNoLoops() == that.getContainsNoLoops()) + && (getEventNotifier() == that.getEventNotifier()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getSpecifiedAttributes(), + getDisplayName(), + getDescription(), + getWriteMask(), + getUserWriteMask(), + getContainsNoLoops(), + getEventNotifier()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewDescription.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewDescription.java index eabcc42abb6..acaf44d1a28 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewDescription.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/ViewDescription.java @@ -38,8 +38,8 @@ public class ViewDescription extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "513"; + public Integer getExtensionId() { + return (int) 513; } // Properties. @@ -109,7 +109,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("ViewDescription"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteRequest.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteRequest.java index 8ac1e5a382d..8e6e2718e85 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteRequest.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteRequest.java @@ -38,34 +38,25 @@ public class WriteRequest extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "673"; + public Integer getExtensionId() { + return (int) 673; } // Properties. - protected final ExtensionObjectDefinition requestHeader; - protected final int noOfNodesToWrite; - protected final List nodesToWrite; - - public WriteRequest( - ExtensionObjectDefinition requestHeader, - int noOfNodesToWrite, - List nodesToWrite) { + protected final RequestHeader requestHeader; + protected final List nodesToWrite; + + public WriteRequest(RequestHeader requestHeader, List nodesToWrite) { super(); this.requestHeader = requestHeader; - this.noOfNodesToWrite = noOfNodesToWrite; this.nodesToWrite = nodesToWrite; } - public ExtensionObjectDefinition getRequestHeader() { + public RequestHeader getRequestHeader() { return requestHeader; } - public int getNoOfNodesToWrite() { - return noOfNodesToWrite; - } - - public List getNodesToWrite() { + public List getNodesToWrite() { return nodesToWrite; } @@ -79,8 +70,11 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (requestHeader) writeSimpleField("requestHeader", requestHeader, writeComplex(writeBuffer)); - // Simple Field (noOfNodesToWrite) - writeSimpleField("noOfNodesToWrite", noOfNodesToWrite, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfNodesToWrite) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfNodesToWrite = + (int) ((((getNodesToWrite()) == (null)) ? -(1) : COUNT(getNodesToWrite()))); + writeImplicitField("noOfNodesToWrite", noOfNodesToWrite, writeSignedInt(writeBuffer, 32)); // Array Field (nodesToWrite) writeComplexTypeArrayField("nodesToWrite", nodesToWrite, writeBuffer); @@ -102,13 +96,13 @@ public int getLengthInBits() { // Simple field (requestHeader) lengthInBits += requestHeader.getLengthInBits(); - // Simple field (noOfNodesToWrite) + // Implicit Field (noOfNodesToWrite) lengthInBits += 32; // Array field if (nodesToWrite != null) { int i = 0; - for (ExtensionObjectDefinition element : nodesToWrite) { + for (WriteValue element : nodesToWrite) { ThreadLocalHelper.lastItemThreadLocal.set(++i >= nodesToWrite.size()); lengthInBits += element.getLengthInBits(); } @@ -118,50 +112,46 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("WriteRequest"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition requestHeader = + RequestHeader requestHeader = readSimpleField( "requestHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("391")), + () -> + (RequestHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (391)), readBuffer)); - int noOfNodesToWrite = readSimpleField("noOfNodesToWrite", readSignedInt(readBuffer, 32)); + int noOfNodesToWrite = readImplicitField("noOfNodesToWrite", readSignedInt(readBuffer, 32)); - List nodesToWrite = + List nodesToWrite = readCountArrayField( "nodesToWrite", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("670")), + () -> (WriteValue) ExtensionObjectDefinition.staticParse(readBuffer, (int) (670)), readBuffer), noOfNodesToWrite); readBuffer.closeContext("WriteRequest"); // Create the instance - return new WriteRequestBuilderImpl(requestHeader, noOfNodesToWrite, nodesToWrite); + return new WriteRequestBuilderImpl(requestHeader, nodesToWrite); } public static class WriteRequestBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition requestHeader; - private final int noOfNodesToWrite; - private final List nodesToWrite; - - public WriteRequestBuilderImpl( - ExtensionObjectDefinition requestHeader, - int noOfNodesToWrite, - List nodesToWrite) { + private final RequestHeader requestHeader; + private final List nodesToWrite; + + public WriteRequestBuilderImpl(RequestHeader requestHeader, List nodesToWrite) { this.requestHeader = requestHeader; - this.noOfNodesToWrite = noOfNodesToWrite; this.nodesToWrite = nodesToWrite; } public WriteRequest build() { - WriteRequest writeRequest = new WriteRequest(requestHeader, noOfNodesToWrite, nodesToWrite); + WriteRequest writeRequest = new WriteRequest(requestHeader, nodesToWrite); return writeRequest; } } @@ -176,7 +166,6 @@ public boolean equals(Object o) { } WriteRequest that = (WriteRequest) o; return (getRequestHeader() == that.getRequestHeader()) - && (getNoOfNodesToWrite() == that.getNoOfNodesToWrite()) && (getNodesToWrite() == that.getNodesToWrite()) && super.equals(that) && true; @@ -184,8 +173,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), getRequestHeader(), getNoOfNodesToWrite(), getNodesToWrite()); + return Objects.hash(super.hashCode(), getRequestHeader(), getNodesToWrite()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteResponse.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteResponse.java index 6803579ab26..4e333a923e2 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteResponse.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteResponse.java @@ -38,47 +38,33 @@ public class WriteResponse extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "676"; + public Integer getExtensionId() { + return (int) 676; } // Properties. - protected final ExtensionObjectDefinition responseHeader; - protected final int noOfResults; + protected final ResponseHeader responseHeader; protected final List results; - protected final int noOfDiagnosticInfos; protected final List diagnosticInfos; public WriteResponse( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { super(); this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } - public ExtensionObjectDefinition getResponseHeader() { + public ResponseHeader getResponseHeader() { return responseHeader; } - public int getNoOfResults() { - return noOfResults; - } - public List getResults() { return results; } - public int getNoOfDiagnosticInfos() { - return noOfDiagnosticInfos; - } - public List getDiagnosticInfos() { return diagnosticInfos; } @@ -93,14 +79,19 @@ protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) // Simple Field (responseHeader) writeSimpleField("responseHeader", responseHeader, writeComplex(writeBuffer)); - // Simple Field (noOfResults) - writeSimpleField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfResults) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfResults = (int) ((((getResults()) == (null)) ? -(1) : COUNT(getResults()))); + writeImplicitField("noOfResults", noOfResults, writeSignedInt(writeBuffer, 32)); // Array Field (results) writeComplexTypeArrayField("results", results, writeBuffer); - // Simple Field (noOfDiagnosticInfos) - writeSimpleField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); + // Implicit Field (noOfDiagnosticInfos) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDiagnosticInfos = + (int) ((((getDiagnosticInfos()) == (null)) ? -(1) : COUNT(getDiagnosticInfos()))); + writeImplicitField("noOfDiagnosticInfos", noOfDiagnosticInfos, writeSignedInt(writeBuffer, 32)); // Array Field (diagnosticInfos) writeComplexTypeArrayField("diagnosticInfos", diagnosticInfos, writeBuffer); @@ -122,7 +113,7 @@ public int getLengthInBits() { // Simple field (responseHeader) lengthInBits += responseHeader.getLengthInBits(); - // Simple field (noOfResults) + // Implicit Field (noOfResults) lengthInBits += 32; // Array field @@ -134,7 +125,7 @@ public int getLengthInBits() { } } - // Simple field (noOfDiagnosticInfos) + // Implicit Field (noOfDiagnosticInfos) lengthInBits += 32; // Array field @@ -150,19 +141,20 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("WriteResponse"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); - ExtensionObjectDefinition responseHeader = + ResponseHeader responseHeader = readSimpleField( "responseHeader", readComplex( - () -> ExtensionObjectDefinition.staticParse(readBuffer, (String) ("394")), + () -> + (ResponseHeader) ExtensionObjectDefinition.staticParse(readBuffer, (int) (394)), readBuffer)); - int noOfResults = readSimpleField("noOfResults", readSignedInt(readBuffer, 32)); + int noOfResults = readImplicitField("noOfResults", readSignedInt(readBuffer, 32)); List results = readCountArrayField( @@ -170,7 +162,8 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readComplex(() -> StatusCode.staticParse(readBuffer), readBuffer), noOfResults); - int noOfDiagnosticInfos = readSimpleField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); + int noOfDiagnosticInfos = + readImplicitField("noOfDiagnosticInfos", readSignedInt(readBuffer, 32)); List diagnosticInfos = readCountArrayField( @@ -180,35 +173,26 @@ public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinit readBuffer.closeContext("WriteResponse"); // Create the instance - return new WriteResponseBuilderImpl( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + return new WriteResponseBuilderImpl(responseHeader, results, diagnosticInfos); } public static class WriteResponseBuilderImpl implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { - private final ExtensionObjectDefinition responseHeader; - private final int noOfResults; + private final ResponseHeader responseHeader; private final List results; - private final int noOfDiagnosticInfos; private final List diagnosticInfos; public WriteResponseBuilderImpl( - ExtensionObjectDefinition responseHeader, - int noOfResults, + ResponseHeader responseHeader, List results, - int noOfDiagnosticInfos, List diagnosticInfos) { this.responseHeader = responseHeader; - this.noOfResults = noOfResults; this.results = results; - this.noOfDiagnosticInfos = noOfDiagnosticInfos; this.diagnosticInfos = diagnosticInfos; } public WriteResponse build() { - WriteResponse writeResponse = - new WriteResponse( - responseHeader, noOfResults, results, noOfDiagnosticInfos, diagnosticInfos); + WriteResponse writeResponse = new WriteResponse(responseHeader, results, diagnosticInfos); return writeResponse; } } @@ -223,9 +207,7 @@ public boolean equals(Object o) { } WriteResponse that = (WriteResponse) o; return (getResponseHeader() == that.getResponseHeader()) - && (getNoOfResults() == that.getNoOfResults()) && (getResults() == that.getResults()) - && (getNoOfDiagnosticInfos() == that.getNoOfDiagnosticInfos()) && (getDiagnosticInfos() == that.getDiagnosticInfos()) && super.equals(that) && true; @@ -233,13 +215,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( - super.hashCode(), - getResponseHeader(), - getNoOfResults(), - getResults(), - getNoOfDiagnosticInfos(), - getDiagnosticInfos()); + return Objects.hash(super.hashCode(), getResponseHeader(), getResults(), getDiagnosticInfos()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteValue.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteValue.java index 09598517ccf..67f1675860a 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteValue.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriteValue.java @@ -38,8 +38,8 @@ public class WriteValue extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "670"; + public Integer getExtensionId() { + return (int) 670; } // Properties. @@ -121,7 +121,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("WriteValue"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupDataType.java new file mode 100644 index 00000000000..0232e112531 --- /dev/null +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupDataType.java @@ -0,0 +1,613 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua.readwrite; + +import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*; +import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*; +import static org.apache.plc4x.java.spi.generation.StaticHelper.*; + +import java.time.*; +import java.util.*; +import org.apache.plc4x.java.api.exceptions.*; +import org.apache.plc4x.java.api.value.*; +import org.apache.plc4x.java.spi.codegen.*; +import org.apache.plc4x.java.spi.codegen.fields.*; +import org.apache.plc4x.java.spi.codegen.io.*; +import org.apache.plc4x.java.spi.generation.*; + +// Code generated by code-generation. DO NOT EDIT. + +public class WriterGroupDataType extends ExtensionObjectDefinition implements Message { + + // Accessors for discriminator values. + public Integer getExtensionId() { + return (int) 15482; + } + + // Properties. + protected final PascalString name; + protected final boolean enabled; + protected final MessageSecurityMode securityMode; + protected final PascalString securityGroupId; + protected final List securityKeyServices; + protected final long maxNetworkMessageSize; + protected final List groupProperties; + protected final int writerGroupId; + protected final double publishingInterval; + protected final double keepAliveTime; + protected final short priority; + protected final List localeIds; + protected final PascalString headerLayoutUri; + protected final ExtensionObject transportSettings; + protected final ExtensionObject messageSettings; + protected final List dataSetWriters; + + public WriterGroupDataType( + PascalString name, + boolean enabled, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + long maxNetworkMessageSize, + List groupProperties, + int writerGroupId, + double publishingInterval, + double keepAliveTime, + short priority, + List localeIds, + PascalString headerLayoutUri, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + List dataSetWriters) { + super(); + this.name = name; + this.enabled = enabled; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.maxNetworkMessageSize = maxNetworkMessageSize; + this.groupProperties = groupProperties; + this.writerGroupId = writerGroupId; + this.publishingInterval = publishingInterval; + this.keepAliveTime = keepAliveTime; + this.priority = priority; + this.localeIds = localeIds; + this.headerLayoutUri = headerLayoutUri; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.dataSetWriters = dataSetWriters; + } + + public PascalString getName() { + return name; + } + + public boolean getEnabled() { + return enabled; + } + + public MessageSecurityMode getSecurityMode() { + return securityMode; + } + + public PascalString getSecurityGroupId() { + return securityGroupId; + } + + public List getSecurityKeyServices() { + return securityKeyServices; + } + + public long getMaxNetworkMessageSize() { + return maxNetworkMessageSize; + } + + public List getGroupProperties() { + return groupProperties; + } + + public int getWriterGroupId() { + return writerGroupId; + } + + public double getPublishingInterval() { + return publishingInterval; + } + + public double getKeepAliveTime() { + return keepAliveTime; + } + + public short getPriority() { + return priority; + } + + public List getLocaleIds() { + return localeIds; + } + + public PascalString getHeaderLayoutUri() { + return headerLayoutUri; + } + + public ExtensionObject getTransportSettings() { + return transportSettings; + } + + public ExtensionObject getMessageSettings() { + return messageSettings; + } + + public List getDataSetWriters() { + return dataSetWriters; + } + + @Override + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) + throws SerializationException { + PositionAware positionAware = writeBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + writeBuffer.pushContext("WriterGroupDataType"); + + // Simple Field (name) + writeSimpleField("name", name, writeComplex(writeBuffer)); + + // Reserved Field (reserved) + writeReservedField("reserved", (byte) 0x00, writeUnsignedByte(writeBuffer, 7)); + + // Simple Field (enabled) + writeSimpleField("enabled", enabled, writeBoolean(writeBuffer)); + + // Simple Field (securityMode) + writeSimpleEnumField( + "securityMode", + "MessageSecurityMode", + securityMode, + writeEnum( + MessageSecurityMode::getValue, + MessageSecurityMode::name, + writeUnsignedLong(writeBuffer, 32))); + + // Simple Field (securityGroupId) + writeSimpleField("securityGroupId", securityGroupId, writeComplex(writeBuffer)); + + // Implicit Field (noOfSecurityKeyServices) (Used for parsing, but its value is not stored as + // it's implicitly given by the objects content) + int noOfSecurityKeyServices = + (int) ((((getSecurityKeyServices()) == (null)) ? -(1) : COUNT(getSecurityKeyServices()))); + writeImplicitField( + "noOfSecurityKeyServices", noOfSecurityKeyServices, writeSignedInt(writeBuffer, 32)); + + // Array Field (securityKeyServices) + writeComplexTypeArrayField("securityKeyServices", securityKeyServices, writeBuffer); + + // Simple Field (maxNetworkMessageSize) + writeSimpleField( + "maxNetworkMessageSize", maxNetworkMessageSize, writeUnsignedLong(writeBuffer, 32)); + + // Implicit Field (noOfGroupProperties) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfGroupProperties = + (int) ((((getGroupProperties()) == (null)) ? -(1) : COUNT(getGroupProperties()))); + writeImplicitField("noOfGroupProperties", noOfGroupProperties, writeSignedInt(writeBuffer, 32)); + + // Array Field (groupProperties) + writeComplexTypeArrayField("groupProperties", groupProperties, writeBuffer); + + // Simple Field (writerGroupId) + writeSimpleField("writerGroupId", writerGroupId, writeUnsignedInt(writeBuffer, 16)); + + // Simple Field (publishingInterval) + writeSimpleField("publishingInterval", publishingInterval, writeDouble(writeBuffer, 64)); + + // Simple Field (keepAliveTime) + writeSimpleField("keepAliveTime", keepAliveTime, writeDouble(writeBuffer, 64)); + + // Simple Field (priority) + writeSimpleField("priority", priority, writeUnsignedShort(writeBuffer, 8)); + + // Implicit Field (noOfLocaleIds) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfLocaleIds = (int) ((((getLocaleIds()) == (null)) ? -(1) : COUNT(getLocaleIds()))); + writeImplicitField("noOfLocaleIds", noOfLocaleIds, writeSignedInt(writeBuffer, 32)); + + // Array Field (localeIds) + writeComplexTypeArrayField("localeIds", localeIds, writeBuffer); + + // Simple Field (headerLayoutUri) + writeSimpleField("headerLayoutUri", headerLayoutUri, writeComplex(writeBuffer)); + + // Simple Field (transportSettings) + writeSimpleField("transportSettings", transportSettings, writeComplex(writeBuffer)); + + // Simple Field (messageSettings) + writeSimpleField("messageSettings", messageSettings, writeComplex(writeBuffer)); + + // Implicit Field (noOfDataSetWriters) (Used for parsing, but its value is not stored as it's + // implicitly given by the objects content) + int noOfDataSetWriters = + (int) ((((getDataSetWriters()) == (null)) ? -(1) : COUNT(getDataSetWriters()))); + writeImplicitField("noOfDataSetWriters", noOfDataSetWriters, writeSignedInt(writeBuffer, 32)); + + // Array Field (dataSetWriters) + writeComplexTypeArrayField("dataSetWriters", dataSetWriters, writeBuffer); + + writeBuffer.popContext("WriterGroupDataType"); + } + + @Override + public int getLengthInBytes() { + return (int) Math.ceil((float) getLengthInBits() / 8.0); + } + + @Override + public int getLengthInBits() { + int lengthInBits = super.getLengthInBits(); + WriterGroupDataType _value = this; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + // Simple field (name) + lengthInBits += name.getLengthInBits(); + + // Reserved Field (reserved) + lengthInBits += 7; + + // Simple field (enabled) + lengthInBits += 1; + + // Simple field (securityMode) + lengthInBits += 32; + + // Simple field (securityGroupId) + lengthInBits += securityGroupId.getLengthInBits(); + + // Implicit Field (noOfSecurityKeyServices) + lengthInBits += 32; + + // Array field + if (securityKeyServices != null) { + int i = 0; + for (EndpointDescription element : securityKeyServices) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= securityKeyServices.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (maxNetworkMessageSize) + lengthInBits += 32; + + // Implicit Field (noOfGroupProperties) + lengthInBits += 32; + + // Array field + if (groupProperties != null) { + int i = 0; + for (KeyValuePair element : groupProperties) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= groupProperties.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (writerGroupId) + lengthInBits += 16; + + // Simple field (publishingInterval) + lengthInBits += 64; + + // Simple field (keepAliveTime) + lengthInBits += 64; + + // Simple field (priority) + lengthInBits += 8; + + // Implicit Field (noOfLocaleIds) + lengthInBits += 32; + + // Array field + if (localeIds != null) { + int i = 0; + for (PascalString element : localeIds) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= localeIds.size()); + lengthInBits += element.getLengthInBits(); + } + } + + // Simple field (headerLayoutUri) + lengthInBits += headerLayoutUri.getLengthInBits(); + + // Simple field (transportSettings) + lengthInBits += transportSettings.getLengthInBits(); + + // Simple field (messageSettings) + lengthInBits += messageSettings.getLengthInBits(); + + // Implicit Field (noOfDataSetWriters) + lengthInBits += 32; + + // Array field + if (dataSetWriters != null) { + int i = 0; + for (DataSetWriterDataType element : dataSetWriters) { + ThreadLocalHelper.lastItemThreadLocal.set(++i >= dataSetWriters.size()); + lengthInBits += element.getLengthInBits(); + } + } + + return lengthInBits; + } + + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { + readBuffer.pullContext("WriterGroupDataType"); + PositionAware positionAware = readBuffer; + boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + + PascalString name = + readSimpleField( + "name", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + Byte reservedField0 = + readReservedField("reserved", readUnsignedByte(readBuffer, 7), (byte) 0x00); + + boolean enabled = readSimpleField("enabled", readBoolean(readBuffer)); + + MessageSecurityMode securityMode = + readEnumField( + "securityMode", + "MessageSecurityMode", + readEnum(MessageSecurityMode::enumForValue, readUnsignedLong(readBuffer, 32))); + + PascalString securityGroupId = + readSimpleField( + "securityGroupId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + int noOfSecurityKeyServices = + readImplicitField("noOfSecurityKeyServices", readSignedInt(readBuffer, 32)); + + List securityKeyServices = + readCountArrayField( + "securityKeyServices", + readComplex( + () -> + (EndpointDescription) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (314)), + readBuffer), + noOfSecurityKeyServices); + + long maxNetworkMessageSize = + readSimpleField("maxNetworkMessageSize", readUnsignedLong(readBuffer, 32)); + + int noOfGroupProperties = + readImplicitField("noOfGroupProperties", readSignedInt(readBuffer, 32)); + + List groupProperties = + readCountArrayField( + "groupProperties", + readComplex( + () -> + (KeyValuePair) ExtensionObjectDefinition.staticParse(readBuffer, (int) (14535)), + readBuffer), + noOfGroupProperties); + + int writerGroupId = readSimpleField("writerGroupId", readUnsignedInt(readBuffer, 16)); + + double publishingInterval = readSimpleField("publishingInterval", readDouble(readBuffer, 64)); + + double keepAliveTime = readSimpleField("keepAliveTime", readDouble(readBuffer, 64)); + + short priority = readSimpleField("priority", readUnsignedShort(readBuffer, 8)); + + int noOfLocaleIds = readImplicitField("noOfLocaleIds", readSignedInt(readBuffer, 32)); + + List localeIds = + readCountArrayField( + "localeIds", + readComplex(() -> PascalString.staticParse(readBuffer), readBuffer), + noOfLocaleIds); + + PascalString headerLayoutUri = + readSimpleField( + "headerLayoutUri", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + + ExtensionObject transportSettings = + readSimpleField( + "transportSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + ExtensionObject messageSettings = + readSimpleField( + "messageSettings", + readComplex( + () -> ExtensionObject.staticParse(readBuffer, (boolean) (true)), readBuffer)); + + int noOfDataSetWriters = readImplicitField("noOfDataSetWriters", readSignedInt(readBuffer, 32)); + + List dataSetWriters = + readCountArrayField( + "dataSetWriters", + readComplex( + () -> + (DataSetWriterDataType) + ExtensionObjectDefinition.staticParse(readBuffer, (int) (15599)), + readBuffer), + noOfDataSetWriters); + + readBuffer.closeContext("WriterGroupDataType"); + // Create the instance + return new WriterGroupDataTypeBuilderImpl( + name, + enabled, + securityMode, + securityGroupId, + securityKeyServices, + maxNetworkMessageSize, + groupProperties, + writerGroupId, + publishingInterval, + keepAliveTime, + priority, + localeIds, + headerLayoutUri, + transportSettings, + messageSettings, + dataSetWriters); + } + + public static class WriterGroupDataTypeBuilderImpl + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString name; + private final boolean enabled; + private final MessageSecurityMode securityMode; + private final PascalString securityGroupId; + private final List securityKeyServices; + private final long maxNetworkMessageSize; + private final List groupProperties; + private final int writerGroupId; + private final double publishingInterval; + private final double keepAliveTime; + private final short priority; + private final List localeIds; + private final PascalString headerLayoutUri; + private final ExtensionObject transportSettings; + private final ExtensionObject messageSettings; + private final List dataSetWriters; + + public WriterGroupDataTypeBuilderImpl( + PascalString name, + boolean enabled, + MessageSecurityMode securityMode, + PascalString securityGroupId, + List securityKeyServices, + long maxNetworkMessageSize, + List groupProperties, + int writerGroupId, + double publishingInterval, + double keepAliveTime, + short priority, + List localeIds, + PascalString headerLayoutUri, + ExtensionObject transportSettings, + ExtensionObject messageSettings, + List dataSetWriters) { + this.name = name; + this.enabled = enabled; + this.securityMode = securityMode; + this.securityGroupId = securityGroupId; + this.securityKeyServices = securityKeyServices; + this.maxNetworkMessageSize = maxNetworkMessageSize; + this.groupProperties = groupProperties; + this.writerGroupId = writerGroupId; + this.publishingInterval = publishingInterval; + this.keepAliveTime = keepAliveTime; + this.priority = priority; + this.localeIds = localeIds; + this.headerLayoutUri = headerLayoutUri; + this.transportSettings = transportSettings; + this.messageSettings = messageSettings; + this.dataSetWriters = dataSetWriters; + } + + public WriterGroupDataType build() { + WriterGroupDataType writerGroupDataType = + new WriterGroupDataType( + name, + enabled, + securityMode, + securityGroupId, + securityKeyServices, + maxNetworkMessageSize, + groupProperties, + writerGroupId, + publishingInterval, + keepAliveTime, + priority, + localeIds, + headerLayoutUri, + transportSettings, + messageSettings, + dataSetWriters); + return writerGroupDataType; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof WriterGroupDataType)) { + return false; + } + WriterGroupDataType that = (WriterGroupDataType) o; + return (getName() == that.getName()) + && (getEnabled() == that.getEnabled()) + && (getSecurityMode() == that.getSecurityMode()) + && (getSecurityGroupId() == that.getSecurityGroupId()) + && (getSecurityKeyServices() == that.getSecurityKeyServices()) + && (getMaxNetworkMessageSize() == that.getMaxNetworkMessageSize()) + && (getGroupProperties() == that.getGroupProperties()) + && (getWriterGroupId() == that.getWriterGroupId()) + && (getPublishingInterval() == that.getPublishingInterval()) + && (getKeepAliveTime() == that.getKeepAliveTime()) + && (getPriority() == that.getPriority()) + && (getLocaleIds() == that.getLocaleIds()) + && (getHeaderLayoutUri() == that.getHeaderLayoutUri()) + && (getTransportSettings() == that.getTransportSettings()) + && (getMessageSettings() == that.getMessageSettings()) + && (getDataSetWriters() == that.getDataSetWriters()) + && super.equals(that) + && true; + } + + @Override + public int hashCode() { + return Objects.hash( + super.hashCode(), + getName(), + getEnabled(), + getSecurityMode(), + getSecurityGroupId(), + getSecurityKeyServices(), + getMaxNetworkMessageSize(), + getGroupProperties(), + getWriterGroupId(), + getPublishingInterval(), + getKeepAliveTime(), + getPriority(), + getLocaleIds(), + getHeaderLayoutUri(), + getTransportSettings(), + getMessageSettings(), + getDataSetWriters()); + } + + @Override + public String toString() { + WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true, true); + try { + writeBufferBoxBased.writeSerializable(this); + } catch (SerializationException e) { + throw new RuntimeException(e); + } + return "\n" + writeBufferBoxBased.getBox().toString() + "\n"; + } +} diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupMessageDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupMessageDataType.java index cdf8099e77e..ca36a3763d1 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupMessageDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupMessageDataType.java @@ -38,8 +38,8 @@ public class WriterGroupMessageDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15618"; + public Integer getExtensionId() { + return (int) 15618; } public WriterGroupMessageDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("WriterGroupMessageDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupTransportDataType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupTransportDataType.java index c0f40a21179..3edbdd71e69 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupTransportDataType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/WriterGroupTransportDataType.java @@ -38,8 +38,8 @@ public class WriterGroupTransportDataType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "15613"; + public Integer getExtensionId() { + return (int) 15613; } public WriterGroupTransportDataType() { @@ -71,7 +71,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("WriterGroupTransportDataType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/X509IdentityToken.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/X509IdentityToken.java index 2540eacc8b9..c48336dc2cc 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/X509IdentityToken.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/X509IdentityToken.java @@ -35,32 +35,41 @@ // Code generated by code-generation. DO NOT EDIT. -public class X509IdentityToken extends UserIdentityTokenDefinition implements Message { +public class X509IdentityToken extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "certificate"; + public Integer getExtensionId() { + return (int) 327; } // Properties. + protected final PascalString policyId; protected final PascalByteString certificateData; - public X509IdentityToken(PascalByteString certificateData) { + public X509IdentityToken(PascalString policyId, PascalByteString certificateData) { super(); + this.policyId = policyId; this.certificateData = certificateData; } + public PascalString getPolicyId() { + return policyId; + } + public PascalByteString getCertificateData() { return certificateData; } @Override - protected void serializeUserIdentityTokenDefinitionChild(WriteBuffer writeBuffer) + protected void serializeExtensionObjectDefinitionChild(WriteBuffer writeBuffer) throws SerializationException { PositionAware positionAware = writeBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); writeBuffer.pushContext("X509IdentityToken"); + // Simple Field (policyId) + writeSimpleField("policyId", policyId, writeComplex(writeBuffer)); + // Simple Field (certificateData) writeSimpleField("certificateData", certificateData, writeComplex(writeBuffer)); @@ -78,18 +87,25 @@ public int getLengthInBits() { X509IdentityToken _value = this; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + // Simple field (policyId) + lengthInBits += policyId.getLengthInBits(); + // Simple field (certificateData) lengthInBits += certificateData.getLengthInBits(); return lengthInBits; } - public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("X509IdentityToken"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); + PascalString policyId = + readSimpleField( + "policyId", readComplex(() -> PascalString.staticParse(readBuffer), readBuffer)); + PascalByteString certificateData = readSimpleField( "certificateData", @@ -97,19 +113,21 @@ public static UserIdentityTokenDefinitionBuilder staticParseUserIdentityTokenDef readBuffer.closeContext("X509IdentityToken"); // Create the instance - return new X509IdentityTokenBuilderImpl(certificateData); + return new X509IdentityTokenBuilderImpl(policyId, certificateData); } public static class X509IdentityTokenBuilderImpl - implements UserIdentityTokenDefinition.UserIdentityTokenDefinitionBuilder { + implements ExtensionObjectDefinition.ExtensionObjectDefinitionBuilder { + private final PascalString policyId; private final PascalByteString certificateData; - public X509IdentityTokenBuilderImpl(PascalByteString certificateData) { + public X509IdentityTokenBuilderImpl(PascalString policyId, PascalByteString certificateData) { + this.policyId = policyId; this.certificateData = certificateData; } public X509IdentityToken build() { - X509IdentityToken x509IdentityToken = new X509IdentityToken(certificateData); + X509IdentityToken x509IdentityToken = new X509IdentityToken(policyId, certificateData); return x509IdentityToken; } } @@ -123,12 +141,15 @@ public boolean equals(Object o) { return false; } X509IdentityToken that = (X509IdentityToken) o; - return (getCertificateData() == that.getCertificateData()) && super.equals(that) && true; + return (getPolicyId() == that.getPolicyId()) + && (getCertificateData() == that.getCertificateData()) + && super.equals(that) + && true; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), getCertificateData()); + return Objects.hash(super.hashCode(), getPolicyId(), getCertificateData()); } @Override diff --git a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/XVType.java b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/XVType.java index 182d648e924..cb9e26313df 100644 --- a/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/XVType.java +++ b/plc4j/drivers/opcua/src/main/generated/org/apache/plc4x/java/opcua/readwrite/XVType.java @@ -38,8 +38,8 @@ public class XVType extends ExtensionObjectDefinition implements Message { // Accessors for discriminator values. - public String getIdentifier() { - return (String) "12082"; + public Integer getExtensionId() { + return (int) 12082; } // Properties. @@ -97,7 +97,7 @@ public int getLengthInBits() { } public static ExtensionObjectDefinitionBuilder staticParseExtensionObjectDefinitionBuilder( - ReadBuffer readBuffer, String identifier) throws ParseException { + ReadBuffer readBuffer, Integer extensionId) throws ParseException { readBuffer.pullContext("XVType"); PositionAware positionAware = readBuffer; boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java index f430497d03a..a1200481b73 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java @@ -102,7 +102,7 @@ protected boolean awaitDiscoverComplete() { @Override protected ProtocolStackConfigurer getStackConfigurer() { - return SingleProtocolStackConfigurer.builder(OpcuaAPU.class, io -> OpcuaAPU.staticParse(io, true)) + return SingleProtocolStackConfigurer.builder(OpcuaAPU.class, io -> OpcuaAPU.staticParse(io, true, true)) .withProtocol(OpcuaProtocolLogic.class) .withPacketSizeEstimator(ByteLengthEstimator.class) .withDriverContext(OpcuaDriverContext.class) diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/Conversation.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/Conversation.java index 8721f90a159..c2ef7978eae 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/Conversation.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/Conversation.java @@ -50,7 +50,7 @@ import org.apache.plc4x.java.opcua.readwrite.NodeIdFourByte; import org.apache.plc4x.java.opcua.readwrite.NodeIdTwoByte; import org.apache.plc4x.java.opcua.readwrite.NodeIdTypeDefinition; -import org.apache.plc4x.java.opcua.readwrite.NullExtension; +import org.apache.plc4x.java.opcua.readwrite.NullExtensionObjectWithMask; import org.apache.plc4x.java.opcua.readwrite.OpcuaAPU; import org.apache.plc4x.java.opcua.readwrite.OpcuaAcknowledgeResponse; import org.apache.plc4x.java.opcua.readwrite.OpcuaCloseRequest; @@ -66,6 +66,7 @@ import org.apache.plc4x.java.opcua.readwrite.Payload; import org.apache.plc4x.java.opcua.readwrite.RequestHeader; import org.apache.plc4x.java.opcua.readwrite.ResponseHeader; +import org.apache.plc4x.java.opcua.readwrite.RootExtensionObject; import org.apache.plc4x.java.opcua.readwrite.SecurityHeader; import org.apache.plc4x.java.opcua.readwrite.SequenceHeader; import org.apache.plc4x.java.opcua.readwrite.ServiceFault; @@ -89,10 +90,10 @@ public class Conversation { null ); - protected static final ExtensionObject NULL_EXTENSION_OBJECT = new ExtensionObject( + protected static final ExtensionObject NULL_EXTENSION_OBJECT = new NullExtensionObjectWithMask( NULL_EXPANDED_NODE_ID, - new ExtensionObjectEncodingMask(false, false, false), - new NullExtension()); // Body + new ExtensionObjectEncodingMask(false, false, false) + ); private final Logger logger = LoggerFactory.getLogger(Conversation.class); @@ -274,14 +275,13 @@ private CompletableFuture submit(ExtensionObjectDefinition requestDefini ExpandedNodeId expandedNodeId = new ExpandedNodeId( false, //Namespace Uri Specified false, //Server Index Specified - new NodeIdFourByte((short) 0, Integer.parseInt(requestDefinition.getIdentifier())), + new NodeIdFourByte((short) 0, requestDefinition.getExtensionId()), null, null ); - ExtensionObject requestObject = new ExtensionObject(expandedNodeId, null, requestDefinition); ExtensiblePayload payload = new ExtensiblePayload( new SequenceHeader(tm.getSequenceSupplier().get(), requestId), - requestObject + new RootExtensionObject(expandedNodeId, requestDefinition) ); MemoryChunkStorage chunkStorage = new MemoryChunkStorage(); diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java index 2d1ebaa2342..99ce4c3e8fb 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java @@ -82,6 +82,8 @@ public class SecureChannel { private static final PascalString PRODUCT_URI = new PascalString("urn:apache:plc4x:client"); private static final PascalString APPLICATION_TEXT = new PascalString("OPCUA client for the Apache PLC4X:PLC4J project"); public static final ScheduledExecutorService KEEP_ALIVE_EXECUTOR = newSingleThreadScheduledExecutor(runnable -> new Thread(runnable, "plc4x-opcua-keep-alive")); + public static final ExtensionObjectEncodingMask BINARY_ENCODING_MASK = new ExtensionObjectEncodingMask( + false, false, true); private final String sessionName = "UaSession:" + APPLICATION_TEXT.getStringValue() + ":" + RandomStringUtils.random(20, true, true); private final PascalByteString localCertificateString; private final PascalByteString remoteCertificateThumbprint; @@ -183,10 +185,9 @@ public CompletableFuture onConnectOpenSecureChannel(S } ExpandedNodeId expandedNodeId = new ExpandedNodeId(false, false, - new NodeIdFourByte((short) 0, Integer.parseInt(openSecureChannelRequest.getIdentifier())), + new NodeIdFourByte((short) 0, openSecureChannelRequest.getExtensionId()), null, null ); - ExtensionObject extObject = new ExtensionObject(expandedNodeId, null, openSecureChannelRequest); Function openRequest = context -> { LOGGER.debug("Submitting OpenSecureChannel with id of {}", context.getRequestId()); @@ -197,7 +198,7 @@ public CompletableFuture onConnectOpenSecureChannel(S ), new ExtensiblePayload( new SequenceHeader(context.getNextSequenceNumber(), context.getRequestId()), - extObject + new RootExtensionObject(expandedNodeId, openSecureChannelRequest) )); }; @@ -209,7 +210,7 @@ public CompletableFuture onConnectOpenSecureChannel(S .thenApply(this::onOpenResponse) .thenApply(openSecureChannelResponse -> { ChannelSecurityToken securityToken = (ChannelSecurityToken) openSecureChannelResponse.getSecurityToken(); - LOGGER.debug("Opened secure response id: {}, channel id:{}, token:{} lifetime:{}", openSecureChannelResponse.getIdentifier(), + LOGGER.debug("Opened secure response id: {}, channel id:{}, token:{} lifetime:{}", openSecureChannelResponse.getExtensionId(), securityToken.getChannelId(), securityToken.getTokenId(), securityToken.getRevisedLifetime()); // store server and client nonce @@ -232,7 +233,6 @@ public CompletableFuture onConnectCreateSessionRequest() APPLICATION_TEXT ); - int noOfDiscoveryUrls = -1; List discoveryUrls = new ArrayList<>(0); ApplicationDescription clientDescription = new ApplicationDescription( @@ -242,7 +242,6 @@ public CompletableFuture onConnectCreateSessionRequest() ApplicationType.applicationTypeClient, NULL_STRING, NULL_STRING, - noOfDiscoveryUrls, discoveryUrls ); @@ -316,19 +315,22 @@ private CompletableFuture onConnectActivateSessionReque conversation.setRemoteNonce(sessionResponse.getServerNonce().getStringValue()); List contactPoints = new ArrayList<>(3); + String port = driverContext.getPort() == null ? "" : ":" + driverContext.getPort(); try { InetAddress address = InetAddress.getByName(driverContext.getHost()); - contactPoints.add("opc.tcp://" + address.getHostAddress() + ":" + driverContext.getPort() + driverContext.getTransportEndpoint()); - contactPoints.add("opc.tcp://" + address.getHostName() + ":" + driverContext.getPort() + driverContext.getTransportEndpoint()); - contactPoints.add("opc.tcp://" + address.getCanonicalHostName() + ":" + driverContext.getPort() + driverContext.getTransportEndpoint()); + contactPoints.add("opc.tcp://" + address.getHostAddress() + port + driverContext.getTransportEndpoint()); + contactPoints.add("opc.tcp://" + address.getHostName() + port + driverContext.getTransportEndpoint()); + contactPoints.add("opc.tcp://" + address.getCanonicalHostName() + port + driverContext.getTransportEndpoint()); } catch (UnknownHostException e) { - LOGGER.debug("error getting host", e); + // fall back to declared host + contactPoints.add("opc.tcp://" + driverContext.getHost() + port + driverContext.getTransportEndpoint()); + LOGGER.warn("Could not reach host {}, possible network failure", driverContext.getHost(), e); } Entry selectedEndpoint = selectEndpoint(sessionResponse.getServerEndpoints(), contactPoints, configuration.getSecurityPolicy(), configuration.getMessageSecurity()); if (selectedEndpoint == null) { - throw new PlcRuntimeException("Unable to find endpoint matching - " + contactPoints.get(1)); + throw new PlcRuntimeException("Unable to find endpoint matching " + contactPoints.get(0)); } PascalString policyId = selectedEndpoint.getValue().getPolicyId(); @@ -347,9 +349,7 @@ private CompletableFuture onConnectActivateSessionReque ActivateSessionRequest activateSessionRequest = new ActivateSessionRequest( requestHeader, clientSignature, - 0, null, - 0, null, userIdentityToken, clientSignature @@ -382,7 +382,7 @@ private void onDisconnectCloseSecureChannel() { CloseSecureChannelRequest closeSecureChannelRequest = new CloseSecureChannelRequest(requestHeader); ExpandedNodeId expandedNodeId = new ExpandedNodeId(false, false, - new NodeIdFourByte((short) 0, Integer.parseInt(closeSecureChannelRequest.getIdentifier())), + new NodeIdFourByte((short) 0, closeSecureChannelRequest.getExtensionId()), null, null ); @@ -390,7 +390,7 @@ private void onDisconnectCloseSecureChannel() { new OpcuaCloseRequest(FINAL, ctx.getSecurityHeader(), new ExtensiblePayload( new SequenceHeader(ctx.getNextSequenceNumber(), ctx.getRequestId()), - new ExtensionObject(expandedNodeId, null, closeSecureChannelRequest) + new RootExtensionObject(expandedNodeId, closeSecureChannelRequest) ) ); @@ -416,20 +416,15 @@ public CompletableFuture onDiscoverGetEndpointsRequest() { GetEndpointsRequest endpointsRequest = new GetEndpointsRequest( requestHeader, this.endpoint, - 0, null, - 0, null ); return conversation.submit(endpointsRequest, GetEndpointsResponse.class).thenApply(response -> { - List endpoints = response.getEndpoints(); Entry entry = selectEndpoint(response.getEndpoints(), this.endpoints, this.configuration.getSecurityPolicy(), this.configuration.getMessageSecurity()); if (entry == null) { - Set endpointUris = endpoints.stream() - .filter(EndpointDescription.class::isInstance) - .map(EndpointDescription.class::cast) + Set endpointUris = response.getEndpoints().stream() .map(EndpointDescription::getEndpointUrl) .map(PascalString::getStringValue) .collect(Collectors.toSet()); @@ -504,18 +499,13 @@ private static ReadBufferByteBased toBuffer(Supplier supplier) { * @param messageSecurity Message security needed by client. * @return Endpoint matching given. */ - private Entry selectEndpoint(List extensionObjects, Collection contactPoints, + private Entry selectEndpoint(List extensionObjects, Collection contactPoints, SecurityPolicy securityPolicy, MessageSecurity messageSecurity) throws PlcRuntimeException { // Get a list of the endpoints which match ours. MessageSecurityMode effectiveMessageSecurity = SecurityPolicy.NONE == securityPolicy ? MessageSecurityMode.messageSecurityModeNone : messageSecurity.getMode(); List> serverEndpoints = new ArrayList<>(); - for (ExtensionObjectDefinition extensionObject : extensionObjects) { - if (!(extensionObject instanceof EndpointDescription)) { - continue; - } - - EndpointDescription endpointDescription = (EndpointDescription) extensionObject; + for (EndpointDescription endpointDescription : extensionObjects) { if (isMatchingEndpoint(endpointDescription, contactPoints)) { boolean policyMatch = endpointDescription.getSecurityPolicyUri().getStringValue().equals(securityPolicy.getSecurityPolicyUri()); boolean msgSecurityMatch = endpointDescription.getSecurityMode().equals(effectiveMessageSecurity); @@ -524,12 +514,9 @@ private Entry selectEndpoint(List implements HasConfiguration, PlcSubscriber { private static final Logger LOGGER = LoggerFactory.getLogger(OpcuaProtocolLogic.class); - protected static final PascalString NULL_STRING = new PascalString(""); + protected static final PascalString NULL_STRING = new PascalString(null); private static final ExpandedNodeId NULL_EXPANDED_NODEID = new ExpandedNodeId(false, false, new NodeIdTwoByte((short) 0), @@ -81,10 +85,9 @@ public class OpcuaProtocolLogic extends Plc4xProtocolBase implements H null ); - protected static final ExtensionObject NULL_EXTENSION_OBJECT = new ExtensionObject( + protected static final ExtensionObject NULL_EXTENSION_OBJECT = new NullExtensionObjectWithMask( NULL_EXPANDED_NODEID, - new ExtensionObjectEncodingMask(false, false, false), - new NullExtension()); // Body + new ExtensionObjectEncodingMask(false, false, false)); private static final long EPOCH_OFFSET = 116444736000000000L; //Offset between OPC UA epoch time and linux epoch time. private final Map subscriptions = new ConcurrentHashMap<>(); @@ -115,7 +118,7 @@ public void onDisconnect(ConversationContext context) { if (channel == null) { return; } - for (Map.Entry subscriber : subscriptions.entrySet()) { + for (Entry subscriber : subscriptions.entrySet()) { subscriber.getValue().stopSubscriber(); } @@ -158,7 +161,7 @@ public void onConnect(ConversationContext context) { LOGGER.error("Failed to establish connection", error); return; } - LOGGER.info("Established connection to server", error); + LOGGER.info("Established connection to server"); context.fireConnected(); }); } @@ -213,7 +216,7 @@ public CompletableFuture read(PlcReadRequest readRequest) { DefaultPlcReadRequest request = (DefaultPlcReadRequest) readRequest; RequestHeader requestHeader = conversation.createRequestHeader(); - List readValueArray = new ArrayList<>(request.getTagNames().size()); + List readValueArray = new ArrayList<>(request.getTagNames().size()); Iterator iterator = request.getTagNames().iterator(); Map tagMap = new LinkedHashMap<>(); for (int i = 0; i < request.getTagNames().size(); i++) { @@ -225,7 +228,7 @@ public CompletableFuture read(PlcReadRequest readRequest) { NodeId nodeId = generateNodeId(tag); readValueArray.add(new ReadValueId(nodeId, - 0xD, + tag.getAttributeId().getValue(), NULL_STRING, new QualifiedName(0, NULL_STRING))); } @@ -233,9 +236,9 @@ public CompletableFuture read(PlcReadRequest readRequest) { ReadRequest opcuaReadRequest = new ReadRequest( requestHeader, 0.0d, - TimestampsToReturn.timestampsToReturnNeither, - readValueArray.size(), - readValueArray); + TimestampsToReturn.timestampsToReturnBoth, + readValueArray + ); CompletableFuture future = new CompletableFuture<>(); RequestTransaction transaction = tm.startRequest(); @@ -243,11 +246,11 @@ public CompletableFuture read(PlcReadRequest readRequest) { conversation.submit(opcuaReadRequest, ReadResponse.class).whenComplete((response, error) -> bridge(transaction, future, response, error)); }); return future.thenApply(response -> { - Metadata responseMetadata = new DefaultMetadata.Builder() + Metadata responseMetadata = new Builder() .put(PlcMetadataKeys.RECEIVE_TIMESTAMP, System.currentTimeMillis()) .build(); - Map metadata = new LinkedHashMap<>(); - return new DefaultPlcReadResponse(request, readResponse(tagMap, response.getResults(), metadata, responseMetadata), metadata); + Entry, Map>> mappedResponse = readResponse(tagMap, response.getResults(), responseMetadata); + return new DefaultPlcReadResponse(request, mappedResponse.getValue(), mappedResponse.getKey()); }); } @@ -260,11 +263,11 @@ static NodeId generateNodeId(OpcuaTag tag) { } else if (tag.getIdentifierType() == OpcuaIdentifierType.GUID_IDENTIFIER) { UUID guid = UUID.fromString(tag.getIdentifier()); ByteBuffer bb = ByteBuffer.allocate(16) - .order(java.nio.ByteOrder.LITTLE_ENDIAN) + .order(ByteOrder.LITTLE_ENDIAN) .putInt((int)(guid.getMostSignificantBits() >> (4*8))) .putShort((short)(guid.getMostSignificantBits() >> (2*8))) .putShort((short)guid.getMostSignificantBits()) - .order(java.nio.ByteOrder.BIG_ENDIAN) + .order(ByteOrder.BIG_ENDIAN) .putLong(guid.getLeastSignificantBits()); nodeId = new NodeId(new NodeIdGuid((short) tag.getNamespace(), bb.array())); } else if (tag.getIdentifierType() == OpcuaIdentifierType.STRING_IDENTIFIER) { @@ -273,184 +276,186 @@ static NodeId generateNodeId(OpcuaTag tag) { return nodeId; } - public Map> readResponse(Map tagMap, List results, Map metadata, Metadata responseMetadata) { - PlcResponseCode responseCode = null; // initialize variable + Entry, Map>> readResponse(Map tagMap, List results, Metadata responseMetadata) { Map> response = new HashMap<>(); + Map metadata = new HashMap<>(); int index = 0; for (String tagName : tagMap.keySet()) { PlcTag tag = tagMap.get(tagName); PlcValue value = null; DataValue dataValue = results.get(index++); + PlcResponseCode responseCode = PlcResponseCode.OK; if (dataValue.getValueSpecified()) { - Variant variant = dataValue.getValue(); - LOGGER.trace("Response of type {}", variant.getClass().toString()); - if (variant instanceof VariantBoolean) { - byte[] array = ((VariantBoolean) variant).getValue(); - int length = array.length; - Boolean[] tmpValue = new Boolean[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = array[i] != 0; - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantSByte) { - byte[] array = ((VariantSByte) variant).getValue(); - value = LegacyPlcValueHandler.of(tag, array); - } else if (variant instanceof VariantByte) { - List array = ((VariantByte) variant).getValue(); - Short[] tmpValue = array.toArray(new Short[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantInt16) { - List array = ((VariantInt16) variant).getValue(); - Short[] tmpValue = array.toArray(new Short[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantUInt16) { - List array = ((VariantUInt16) variant).getValue(); - Integer[] tmpValue = array.toArray(new Integer[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantInt32) { - List array = ((VariantInt32) variant).getValue(); - Integer[] tmpValue = array.toArray(new Integer[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantUInt32) { - List array = ((VariantUInt32) variant).getValue(); - Long[] tmpValue = array.toArray(new Long[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantInt64) { - List array = ((VariantInt64) variant).getValue(); - Long[] tmpValue = array.toArray(new Long[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantUInt64) { - value = LegacyPlcValueHandler.of(((VariantUInt64) variant).getValue()); - } else if (variant instanceof VariantFloat) { - List array = ((VariantFloat) variant).getValue(); - Float[] tmpValue = array.toArray(new Float[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantDouble) { - List array = ((VariantDouble) variant).getValue(); - Double[] tmpValue = array.toArray(new Double[0]); - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantString) { - int length = ((VariantString) variant).getValue().size(); - List stringArray = ((VariantString) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = stringArray.get(i).getStringValue(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantDateTime) { - List array = ((VariantDateTime) variant).getValue(); - int length = array.size(); - LocalDateTime[] tmpValue = new LocalDateTime[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = LocalDateTime.ofInstant(Instant.ofEpochMilli(getDateTime(array.get(i))), ZoneOffset.UTC); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantGuid) { - List array = ((VariantGuid) variant).getValue(); - int length = array.size(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - //These two data section aren't little endian like the rest. - byte[] data4Bytes = array.get(i).getData4(); - int data4 = 0; - for (byte data4Byte : data4Bytes) { - data4 = (data4 << 8) + (data4Byte & 0xff); - } - byte[] data5Bytes = array.get(i).getData5(); - long data5 = 0; - for (byte data5Byte : data5Bytes) { - data5 = (data5 << 8) + (data5Byte & 0xff); - } - tmpValue[i] = Long.toHexString(array.get(i).getData1()) + "-" + Integer.toHexString(array.get(i).getData2()) + "-" + Integer.toHexString(array.get(i).getData3()) + "-" + Integer.toHexString(data4) + "-" + Long.toHexString(data5); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantXmlElement) { - int length = ((VariantXmlElement) variant).getValue().size(); - List strings = ((VariantXmlElement) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = strings.get(i).getStringValue(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantLocalizedText) { - int length = ((VariantLocalizedText) variant).getValue().size(); - List strings = ((VariantLocalizedText) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = ""; - tmpValue[i] += strings.get(i).getLocaleSpecified() ? strings.get(i).getLocale().getStringValue() + "|" : ""; - tmpValue[i] += strings.get(i).getTextSpecified() ? strings.get(i).getText().getStringValue() : ""; - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantQualifiedName) { - int length = ((VariantQualifiedName) variant).getValue().size(); - List strings = ((VariantQualifiedName) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = "ns=" + strings.get(i).getNamespaceIndex() + ";s=" + strings.get(i).getName().getStringValue(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantExtensionObject) { - int length = ((VariantExtensionObject) variant).getValue().size(); - List strings = ((VariantExtensionObject) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = strings.get(i).toString(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantNodeId) { - int length = ((VariantNodeId) variant).getValue().size(); - List strings = ((VariantNodeId) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = strings.get(i).toString(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantStatusCode) { - int length = ((VariantStatusCode) variant).getValue().size(); - List strings = ((VariantStatusCode) variant).getValue(); - String[] tmpValue = new String[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = strings.get(i).toString(); - } - value = LegacyPlcValueHandler.of(tmpValue); - } else if (variant instanceof VariantByteString) { - PlcList plcList = new PlcList(); - List array = ((VariantByteString) variant).getValue(); - for (ByteStringArray byteStringArray : array) { - int length = byteStringArray.getValue().size(); - Short[] tmpValue = new Short[length]; - for (int i = 0; i < length; i++) { - tmpValue[i] = byteStringArray.getValue().get(i); - } - plcList.add(LegacyPlcValueHandler.of(tmpValue)); - } - value = plcList; - } else { + value = variantToPlcValue(tag, dataValue.getValue()); + if (value == null) { + LOGGER.error("Variant type {} is not supported.", dataValue.getValue().getClass()); responseCode = PlcResponseCode.UNSUPPORTED; - LOGGER.error("Data type - " + variant.getClass() + " is not supported "); - } - // response code might be null in first iteration - if (PlcResponseCode.UNSUPPORTED != responseCode) { - responseCode = PlcResponseCode.OK; } } else { StatusCode statusCode = dataValue.getStatusCode(); responseCode = mapOpcStatusCode(statusCode.getStatusCode(), PlcResponseCode.UNSUPPORTED); - LOGGER.error("Error while reading value from OPC UA server error code:- " + dataValue.getStatusCode().toString()); + LOGGER.error("Error while reading value from OPC UA server error code: {}", statusCode.toString()); } - Metadata tagMetadata = new DefaultMetadata.Builder(responseMetadata) + Metadata tagMetadata = new Builder(responseMetadata) .put(OpcMetadataKeys.QUALITY, new OpcuaQualityStatus(dataValue.getStatusCode())) .put(OpcMetadataKeys.SERVER_TIMESTAMP, dataValue.getServerTimestamp()) .put(OpcMetadataKeys.SOURCE_TIMESTAMP, dataValue.getSourceTimestamp()) - .put(PlcMetadataKeys.TIMESTAMP, dataValue.getServerTimestamp()) + .put(PlcMetadataKeys.TIMESTAMP, dataValue.getSourceTimestamp()) .put(PlcMetadataKeys.TIMESTAMP_SOURCE, TimeSource.SOFTWARE) .build(); response.put(tagName, new DefaultPlcResponseItem<>(responseCode, value)); metadata.put(tagName, tagMetadata); } - return response; + return Map.entry(metadata, response); + } + + static PlcValue variantToPlcValue(PlcTag tag, Variant variant) { + PlcValue value = null; + if (variant instanceof VariantBoolean) { + byte[] array = ((VariantBoolean) variant).getValue(); + int length = array.length; + Boolean[] tmpValue = new Boolean[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = array[i] != 0; + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantSByte) { + byte[] array = ((VariantSByte) variant).getValue(); + value = LegacyPlcValueHandler.of(tag, array); + } else if (variant instanceof VariantByte) { + List array = ((VariantByte) variant).getValue(); + Short[] tmpValue = array.toArray(new Short[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantInt16) { + List array = ((VariantInt16) variant).getValue(); + Short[] tmpValue = array.toArray(new Short[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantUInt16) { + List array = ((VariantUInt16) variant).getValue(); + Integer[] tmpValue = array.toArray(new Integer[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantInt32) { + List array = ((VariantInt32) variant).getValue(); + Integer[] tmpValue = array.toArray(new Integer[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantUInt32) { + List array = ((VariantUInt32) variant).getValue(); + Long[] tmpValue = array.toArray(new Long[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantInt64) { + List array = ((VariantInt64) variant).getValue(); + Long[] tmpValue = array.toArray(new Long[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantUInt64) { + value = LegacyPlcValueHandler.of(((VariantUInt64) variant).getValue()); + } else if (variant instanceof VariantFloat) { + List array = ((VariantFloat) variant).getValue(); + Float[] tmpValue = array.toArray(new Float[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantDouble) { + List array = ((VariantDouble) variant).getValue(); + Double[] tmpValue = array.toArray(new Double[0]); + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantString) { + int length = ((VariantString) variant).getValue().size(); + List stringArray = ((VariantString) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = stringArray.get(i).getStringValue(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantDateTime) { + List array = ((VariantDateTime) variant).getValue(); + int length = array.size(); + LocalDateTime[] tmpValue = new LocalDateTime[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = LocalDateTime.ofInstant(Instant.ofEpochMilli(getDateTime(array.get(i))), ZoneOffset.UTC); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantGuid) { + List array = ((VariantGuid) variant).getValue(); + int length = array.size(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + //These two data section aren't little endian like the rest. + byte[] data4Bytes = array.get(i).getData4(); + int data4 = 0; + for (byte data4Byte : data4Bytes) { + data4 = (data4 << 8) + (data4Byte & 0xff); + } + byte[] data5Bytes = array.get(i).getData5(); + long data5 = 0; + for (byte data5Byte : data5Bytes) { + data5 = (data5 << 8) + (data5Byte & 0xff); + } + tmpValue[i] = Long.toHexString(array.get(i).getData1()) + "-" + Integer.toHexString(array.get(i).getData2()) + "-" + Integer.toHexString(array.get(i).getData3()) + "-" + Integer.toHexString(data4) + "-" + Long.toHexString(data5); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantXmlElement) { + int length = ((VariantXmlElement) variant).getValue().size(); + List strings = ((VariantXmlElement) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = strings.get(i).getStringValue(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantLocalizedText) { + int length = ((VariantLocalizedText) variant).getValue().size(); + List strings = ((VariantLocalizedText) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = ""; + tmpValue[i] += strings.get(i).getLocaleSpecified() ? strings.get(i).getLocale().getStringValue() + "|" : ""; + tmpValue[i] += strings.get(i).getTextSpecified() ? strings.get(i).getText().getStringValue() : ""; + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantQualifiedName) { + int length = ((VariantQualifiedName) variant).getValue().size(); + List strings = ((VariantQualifiedName) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = "ns=" + strings.get(i).getNamespaceIndex() + ";s=" + strings.get(i).getName().getStringValue(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantExtensionObject) { + int length = ((VariantExtensionObject) variant).getValue().size(); + List strings = ((VariantExtensionObject) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = strings.get(i).toString(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantNodeId) { + int length = ((VariantNodeId) variant).getValue().size(); + List strings = ((VariantNodeId) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = strings.get(i).toString(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantStatusCode) { + int length = ((VariantStatusCode) variant).getValue().size(); + List strings = ((VariantStatusCode) variant).getValue(); + String[] tmpValue = new String[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = strings.get(i).toString(); + } + value = LegacyPlcValueHandler.of(tmpValue); + } else if (variant instanceof VariantByteString) { + PlcList plcList = new PlcList(); + List array = ((VariantByteString) variant).getValue(); + for (ByteStringArray byteStringArray : array) { + int length = byteStringArray.getValue().size(); + Short[] tmpValue = new Short[length]; + for (int i = 0; i < length; i++) { + tmpValue[i] = byteStringArray.getValue().get(i); + } + plcList.add(LegacyPlcValueHandler.of(tmpValue)); + } + value = plcList; + } + return value; } private static PlcResponseCode mapOpcStatusCode(long opcStatusCode, PlcResponseCode fallback) { @@ -746,14 +751,14 @@ public CompletableFuture write(PlcWriteRequest writeRequest) { DefaultPlcWriteRequest request = (DefaultPlcWriteRequest) writeRequest; RequestHeader requestHeader = conversation.createRequestHeader(); - List writeValueList = new ArrayList<>(request.getTagNames().size()); + List writeValueList = new ArrayList<>(request.getTagNames().size()); for (String tagName : request.getTagNames()) { OpcuaTag tag = (OpcuaTag) request.getTag(tagName); NodeId nodeId = generateNodeId(tag); writeValueList.add(new WriteValue(nodeId, - 0xD, + tag.getAttributeId().getValue(), NULL_STRING, new DataValue( false, @@ -770,7 +775,7 @@ public CompletableFuture write(PlcWriteRequest writeRequest) { null))); } - WriteRequest opcuaWriteRequest = new WriteRequest(requestHeader, writeValueList.size(), writeValueList); + WriteRequest opcuaWriteRequest = new WriteRequest(requestHeader, writeValueList); CompletableFuture future = new CompletableFuture<>(); RequestTransaction transaction = tm.startRequest(); @@ -802,7 +807,6 @@ public CompletableFuture subscribe(PlcSubscriptionReque CompletableFuture future = new CompletableFuture<>(); RequestTransaction transaction = tm.startRequest(); transaction.submit(() -> { - // bridge(transaction, future, response, error) onSubscribeCreateSubscription(cycleTime).thenApply(response -> { long subscriptionId = response.getSubscriptionId(); OpcuaSubscriptionHandle handle = new OpcuaSubscriptionHandle(this, tm, @@ -829,10 +833,6 @@ public CompletableFuture subscribe(PlcSubscriptionReque return future; } - protected void requestSubscriptionPublish() { - - } - private CompletableFuture onSubscribeCreateSubscription(long cycleTime) { LOGGER.trace("Entering creating subscription request"); diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandle.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandle.java index 4889480f3cd..e2034da253b 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandle.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandle.java @@ -20,6 +20,7 @@ import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; +import java.util.Map.Entry; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -28,9 +29,12 @@ import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent; import org.apache.plc4x.java.api.messages.PlcSubscriptionRequest; import org.apache.plc4x.java.api.metadata.Metadata; +import org.apache.plc4x.java.api.types.PlcResponseCode; +import org.apache.plc4x.java.spi.messages.utils.DefaultPlcResponseItem; import org.apache.plc4x.java.spi.metadata.DefaultMetadata; import org.apache.plc4x.java.api.model.PlcConsumerRegistration; import org.apache.plc4x.java.api.model.PlcTag; +import org.apache.plc4x.java.api.types.PlcSubscriptionType; import org.apache.plc4x.java.api.value.PlcValue; import org.apache.plc4x.java.opcua.context.Conversation; import org.apache.plc4x.java.opcua.tag.OpcuaTag; @@ -42,6 +46,8 @@ import org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionHandle; import org.apache.plc4x.java.spi.transaction.RequestTransactionManager; import org.apache.plc4x.java.spi.transaction.RequestTransactionManager.RequestTransaction; +import org.apache.plc4x.java.spi.values.PlcNull; +import org.apache.plc4x.java.spi.values.PlcStruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,10 +60,9 @@ public class OpcuaSubscriptionHandle extends DefaultPlcSubscriptionHandle { - private static final Logger LOGGER = LoggerFactory.getLogger(OpcuaSubscriptionHandle.class); - private final static ScheduledExecutorService EXECUTOR = newSingleThreadScheduledExecutor(runnable -> new Thread(runnable, "plc4x-opcua-subscription-scheduler")); + private final Logger logger = LoggerFactory.getLogger(OpcuaSubscriptionHandle.class); private final Set> consumers; private final List tagNames; private final Conversation conversation; @@ -88,45 +93,64 @@ public OpcuaSubscriptionHandle(OpcuaProtocolLogic plcSubscriber, RequestTransact } public CompletableFuture onSubscribeCreateMonitoredItemsRequest() { - List requestList = new ArrayList<>(this.tagNames.size()); + List requestList = new ArrayList<>(this.tagNames.size()); for (String tagName : this.tagNames) { final DefaultPlcSubscriptionTag tagDefaultPlcSubscription = (DefaultPlcSubscriptionTag) subscriptionRequest.getTag(tagName); - NodeId idNode = OpcuaProtocolLogic.generateNodeId((OpcuaTag) tagDefaultPlcSubscription.getTag()); + OpcuaTag opcTag = (OpcuaTag) tagDefaultPlcSubscription.getTag(); + NodeId idNode = OpcuaProtocolLogic.generateNodeId(opcTag); ReadValueId readValueId = new ReadValueId( idNode, - 0xD, + opcTag.getAttributeId().getValue(), OpcuaProtocolLogic.NULL_STRING, new QualifiedName(0, OpcuaProtocolLogic.NULL_STRING)); - MonitoringMode monitoringMode; - switch (tagDefaultPlcSubscription.getPlcSubscriptionType()) { - case CYCLIC: - monitoringMode = MonitoringMode.monitoringModeSampling; - break; - case CHANGE_OF_STATE: - monitoringMode = MonitoringMode.monitoringModeReporting; - break; - case EVENT: - monitoringMode = MonitoringMode.monitoringModeReporting; - break; - default: - monitoringMode = MonitoringMode.monitoringModeReporting; + MonitoringMode monitoringMode = MonitoringMode.monitoringModeReporting; + if (PlcSubscriptionType.CYCLIC == tagDefaultPlcSubscription.getPlcSubscriptionType()) { + monitoringMode = MonitoringMode.monitoringModeSampling; } - long clientHandle = clientHandles.getAndIncrement(); + ExtensionObject eventFilter = OpcuaProtocolLogic.NULL_EXTENSION_OBJECT; + if (tagDefaultPlcSubscription.getPlcSubscriptionType() == PlcSubscriptionType.EVENT) { + NodeId nodeId = new NodeId(new NodeIdFourByte((short) 0, OpcuaNodeIdServicesObjectType.BaseEventType.getValue())); + List filterOperand = new ArrayList<>(); + Map config = opcTag.getConfig(); + for (Map.Entry entry : config.entrySet()) { + filterOperand.add(new SimpleAttributeOperand(nodeId, + List.of(new QualifiedName(0, new PascalString(entry.getKey()))), + AttributeId.Value.getValue(), + OpcuaProtocolLogic.NULL_STRING + )); + } + + EventFilter filterPayload = new EventFilter(filterOperand, new ContentFilter(null)); + ExpandedNodeId expandedNodeId = new ExpandedNodeId(false, false, + new NodeIdFourByte((short) 0, filterPayload.getExtensionId()), + null, null + ); + eventFilter = new BinaryExtensionObjectWithMask( + expandedNodeId, + new ExtensionObjectEncodingMask(false, false, true), + filterPayload + ); + readValueId = new ReadValueId( + idNode, + AttributeId.EventNotifier.getValue(), + OpcuaProtocolLogic.NULL_STRING, + new QualifiedName(0, OpcuaProtocolLogic.NULL_STRING)); + } + long clientHandle = clientHandles.getAndIncrement(); MonitoringParameters parameters = new MonitoringParameters( clientHandle, (double) cycleTime, // sampling interval - OpcuaProtocolLogic.NULL_EXTENSION_OBJECT, // filter, null means use default + eventFilter, // filter, null means use default 1L, // queue size true // discard oldest ); - MonitoredItemCreateRequest request = new MonitoredItemCreateRequest( - readValueId, monitoringMode, parameters); + MonitoredItemCreateRequest request = new MonitoredItemCreateRequest(readValueId, monitoringMode, parameters); requestList.add(request); } @@ -136,32 +160,28 @@ public CompletableFuture onSubscribeCreateMonitoredItem requestHeader, subscriptionId, TimestampsToReturn.timestampsToReturnBoth, - requestList.size(), requestList ); return conversation.submit(createMonitoredItemsRequest, CreateMonitoredItemsResponse.class) .whenComplete((response, error) -> { if (error instanceof TimeoutException) { - LOGGER.info("Timeout while sending the Create Monitored Item Subscription Message", error); + logger.info("Timeout while sending the Create Monitored Item Subscription Message", error); } else if (error != null) { - LOGGER.info("Error while sending the Create Monitored Item Subscription Message", error); + logger.info("Error while sending the Create Monitored Item Subscription Message", error); } }).thenApply(responseMessage -> { - MonitoredItemCreateResult[] array = responseMessage.getResults().stream() - .filter(extensionObjectDefinition -> extensionObjectDefinition instanceof MonitoredItemCreateResult) - .map(extensionObjectDefinition -> (MonitoredItemCreateResult) extensionObjectDefinition) - .toArray(MonitoredItemCreateResult[]::new); + MonitoredItemCreateResult[] array = responseMessage.getResults().stream().toArray(MonitoredItemCreateResult[]::new); for (int index = 0, arrayLength = array.length; index < arrayLength; index++) { MonitoredItemCreateResult result = array[index]; if (OpcuaStatusCode.enumForValue(result.getStatusCode().getStatusCode()) != OpcuaStatusCode.Good) { - LOGGER.error("Invalid Tag {}, subscription created without this tag", tagNames.get(index)); + logger.error("Invalid Tag {}, subscription created without this tag", tagNames.get(index)); } else { - LOGGER.debug("Tag {} was added to the subscription", tagNames.get(index)); + logger.debug("Tag {} was added to the subscription", tagNames.get(index)); } } - LOGGER.trace("Scheduling publish event for subscription {}", subscriptionId); + logger.trace("Scheduling publish event for subscription {}", subscriptionId); publishTask = EXECUTOR.scheduleAtFixedRate(this::sendPublishRequest, revisedCycleTime / 2, revisedCycleTime, TimeUnit.MILLISECONDS); return this; }); @@ -180,44 +200,49 @@ private void sendPublishRequest() { RequestHeader requestHeader = conversation.createRequestHeader(this.revisedCycleTime * 10); //Make a copy of the outstanding requests, so it isn't modified while we are putting the ack list together. - List acks = new ArrayList<>(outstandingAcknowledgements); + List acks = new ArrayList<>(outstandingAcknowledgements); // do not send -1 when requesting publish, the -1 value indicates NULL value // which might result in corruption of subscription for some servers int ackLength = acks.size(); outstandingAcknowledgements.removeAll(acks); - PublishRequest publishRequest = new PublishRequest(requestHeader, ackLength, acks); + PublishRequest publishRequest = new PublishRequest(requestHeader, acks); // we work in external thread - we need to coordinate access to conversation pipeline RequestTransaction transaction = tm.startRequest(); transaction.submit(() -> { - LOGGER.trace("Sent publish request with {} acks", ackLength); + logger.trace("Sent publish request with {} acks", ackLength); // Create Consumer for the response message, error and timeout to be sent to the Secure Channel conversation.submit(publishRequest, PublishResponse.class).thenAccept(responseMessage -> { - outstandingRequests.remove(((ResponseHeader) responseMessage.getResponseHeader()).getRequestHandle()); + outstandingRequests.remove(responseMessage.getResponseHeader().getRequestHandle()); for (long availableSequenceNumber : responseMessage.getAvailableSequenceNumbers()) { outstandingAcknowledgements.add(new SubscriptionAcknowledgement(this.subscriptionId, availableSequenceNumber)); } - for (ExtensionObject notificationMessage : ((NotificationMessage) responseMessage.getNotificationMessage()).getNotificationData()) { + for (ExtensionObject notificationMessage : responseMessage.getNotificationMessage().getNotificationData()) { ExtensionObjectDefinition notification = notificationMessage.getBody(); if (notification instanceof DataChangeNotification) { - LOGGER.trace("Found a Data Change notification"); - List items = ((DataChangeNotification) notification).getMonitoredItems(); - onSubscriptionValue(items.stream() - .filter(extensionObjectDefinition -> extensionObjectDefinition instanceof MonitoredItemNotification) - .map(extensionObjectDefinition -> (MonitoredItemNotification) extensionObjectDefinition) - .toArray(MonitoredItemNotification[]::new)); + logger.trace("Found a Data Change Notification"); + DataChangeNotification data = (DataChangeNotification) notification; + if (!data.getMonitoredItems().isEmpty()) { + onMonitoredValue(data.getMonitoredItems()); + } + } else if (notification instanceof EventNotificationList) { + logger.trace("Found a Event Notification"); + EventNotificationList data = (EventNotificationList) notification; + if (!data.getEvents().isEmpty()) { + onEventNotification(data.getEvents()); + } } else { - LOGGER.warn("Unsupported Notification type"); + logger.warn("Unsupported Notification type {}", notification.getClass().getName()); } } }).whenComplete((result, error) -> { if (error != null) { - LOGGER.warn("Publish request of subscription {} resulted in error reported by server", subscriptionId, error); + logger.warn("Publish request of subscription {} resulted in error reported by server", subscriptionId, error); transaction.failRequest(error); } else { - LOGGER.trace("Completed publish request for subscription {}", subscriptionId); + logger.trace("Completed publish request for subscription {}", subscriptionId); transaction.endRequest(); } }); @@ -233,10 +258,7 @@ private void sendPublishRequest() { public void stopSubscriber() { RequestHeader requestHeader = conversation.createRequestHeader(this.revisedCycleTime * 10); List subscriptions = Collections.singletonList(subscriptionId); - DeleteSubscriptionsRequest deleteSubscriptionRequest = new DeleteSubscriptionsRequest(requestHeader, - 1, - subscriptions - ); + DeleteSubscriptionsRequest deleteSubscriptionRequest = new DeleteSubscriptionsRequest(requestHeader, subscriptions); // subscription suspend can be invoked from multiple places, hence we manage transaction side of it RequestTransaction transaction = tm.startRequest(); @@ -246,7 +268,7 @@ public void stopSubscriber() { .thenAccept(responseMessage -> publishTask.cancel(true)) .whenComplete((result, error) -> { if (error != null) { - LOGGER.error("Deletion of subscription resulted in error", error); + logger.error("Deletion of subscription resulted in error", error); transaction.failRequest(error); } else { transaction.endRequest(); @@ -261,13 +283,13 @@ public void stopSubscriber() { * * @param values - array of data values to be sent to the client. */ - private void onSubscriptionValue(MonitoredItemNotification[] values) { + private void onMonitoredValue(List values) { long receiveTs = System.currentTimeMillis(); Metadata responseMetadata = new DefaultMetadata.Builder() .put(PlcMetadataKeys.RECEIVE_TIMESTAMP, receiveTs) .build(); - List dataValues = new ArrayList<>(values.length); + List dataValues = new ArrayList<>(values.size()); Map tagMap = new LinkedHashMap<>(); for (MonitoredItemNotification value : values) { String tagName = tagNames.get((int) value.getClientHandle() - 1); @@ -275,10 +297,40 @@ private void onSubscriptionValue(MonitoredItemNotification[] values) { dataValues.add(value.getValue()); } + Entry, Map>> mappedResponse = plcSubscriber.readResponse(tagMap, dataValues, responseMetadata); + PlcSubscriptionEvent event = new DefaultPlcSubscriptionEvent(Instant.ofEpochMilli(receiveTs), mappedResponse.getValue(), mappedResponse.getKey()); + consumers.forEach(plcSubscriptionEventConsumer -> plcSubscriptionEventConsumer.accept(event)); + } + + private void onEventNotification(List events) { + long receiveTs = System.currentTimeMillis(); + Metadata responseMetadata = new DefaultMetadata.Builder() + .put(PlcMetadataKeys.RECEIVE_TIMESTAMP, receiveTs) + .build(); + Map metadata = new HashMap<>(); - Map> tags = plcSubscriber.readResponse(tagMap, dataValues, metadata, responseMetadata); - final PlcSubscriptionEvent event = new DefaultPlcSubscriptionEvent(Instant.now(), tags, metadata); + Map> tagValues = new LinkedHashMap<>(); + for (EventFieldList event : events) { + String tagName = tagNames.get((int) event.getClientHandle() - 1); + OpcuaTag tag = (OpcuaTag) subscriptionRequest.getTag(tagName).getTag(); + + Iterator fieldNames = tag.getConfig().keySet().iterator(); + Map mapping = new LinkedHashMap<>(); + metadata.put(tagName, responseMetadata); + for (Variant variant : event.getEventFields()) { + if (fieldNames.hasNext()) { + String fieldName = fieldNames.next(); + PlcValue plcValue = OpcuaProtocolLogic.variantToPlcValue(tag, variant); + mapping.put(fieldName, plcValue); + tagValues.put(tagName, new DefaultPlcResponseItem<>(PlcResponseCode.OK, new PlcStruct(mapping))); + } else { + logger.error("Could not map event notification response, subscription received more data than expected"); + tagValues.put(tagName, new DefaultPlcResponseItem<>(PlcResponseCode.INTERNAL_ERROR, new PlcNull())); + } + } + } + PlcSubscriptionEvent event = new DefaultPlcSubscriptionEvent(Instant.ofEpochMilli(receiveTs), tagValues, metadata); consumers.forEach(plcSubscriptionEventConsumer -> plcSubscriptionEventConsumer.accept(event)); } @@ -290,7 +342,7 @@ private void onSubscriptionValue(MonitoredItemNotification[] values) { */ @Override public PlcConsumerRegistration register(Consumer consumer) { - LOGGER.info("Registering a new OPCUA subscription consumer"); + logger.info("Registering a new OPCUA subscription consumer"); consumers.add(consumer); return new DefaultPlcConsumerRegistration(plcSubscriber, consumer, this); } diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverter.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverter.java index 2ae7f375caa..f7e07f1ff81 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverter.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverter.java @@ -25,6 +25,7 @@ import org.apache.plc4x.java.opcua.readwrite.ExtensionObject; import org.apache.plc4x.java.opcua.readwrite.MessagePDU; import org.apache.plc4x.java.opcua.readwrite.Payload; +import org.apache.plc4x.java.opcua.readwrite.RootExtensionObject; import org.apache.plc4x.java.spi.generation.ByteOrder; import org.apache.plc4x.java.spi.generation.Message; import org.apache.plc4x.java.spi.generation.ParseException; @@ -56,7 +57,7 @@ public static ExtensiblePayload toExtensible(BinaryPayload binary) throws ParseE byte[] payload = binary.getPayload(); ReadBufferByteBased buffer = new ReadBufferByteBased(payload, ByteOrder.LITTLE_ENDIAN); - ExtensionObject extensionObject = ExtensionObject.staticParse(buffer, false); + RootExtensionObject extensionObject = (RootExtensionObject) RootExtensionObject.staticParse(buffer, false); return new ExtensiblePayload(binary.getSequenceHeader(), extensionObject); } @@ -76,18 +77,18 @@ private static byte[] serialize(Message message) throws SerializationException { return buffer.getBytes(); } - public static Payload fromStream(byte[] payload, boolean extensible) throws ParseException { + public static Payload fromStream(byte[] payload, boolean binary) throws ParseException { ReadBufferByteBased buffer = new ReadBufferByteBased(payload, ByteOrder.LITTLE_ENDIAN); - return Payload.staticParse(buffer, extensible, (long) (extensible ? -1 : payload.length - 8)); + return Payload.staticParse(buffer, binary, (long) (binary ? payload.length - 8 : -1)); } public static MessagePDU fromStream(ByteBuffer chunkBuffer, boolean response) throws ParseException { ReadBufferByteBased buffer = new ReadBufferByteBased(chunkBuffer.array(), ByteOrder.LITTLE_ENDIAN); - return MessagePDU.staticParse(buffer, response); + return MessagePDU.staticParse(buffer, response, true); } public static MessagePDU pduFromStream(byte[] message, boolean response) throws ParseException { ReadBufferByteBased buffer = new ReadBufferByteBased(message, ByteOrder.LITTLE_ENDIAN); - return MessagePDU.staticParse(buffer, response); + return MessagePDU.staticParse(buffer, response, true); } } diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/readwrite/utils/StaticHelper.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/readwrite/utils/StaticHelper.java index 5c0a2f5ce5c..7ae036ec39f 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/readwrite/utils/StaticHelper.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/readwrite/utils/StaticHelper.java @@ -19,6 +19,8 @@ package org.apache.plc4x.java.opcua.readwrite.utils; import java.nio.charset.StandardCharsets; +import org.apache.plc4x.java.api.exceptions.PlcRuntimeException; +import org.apache.plc4x.java.opcua.readwrite.ExpandedNodeId; public class StaticHelper { @@ -27,14 +29,18 @@ public static int utf8LengthToPascalLength(String stringValue) { if (stringValue == null) { return -1; } - int nBytes = stringValue.getBytes(StandardCharsets.UTF_8).length; - if (nBytes == 0) { - return -1; - } - return nBytes; + return stringValue.getBytes(StandardCharsets.UTF_8).length; } public static int pascalLengthToUtf8Length(int slength) { return Math.max(slength, 0); } + + public static int extensionId(ExpandedNodeId expandedNodeId) { + try { + return Integer.parseInt(expandedNodeId.getNodeId().getIdentifier()); + } catch (NumberFormatException e) { + throw new PlcRuntimeException("Invalid node id, expected number, found " + expandedNodeId.getNodeId().getClass().getName()); + } + } } diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/tag/OpcuaTag.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/tag/OpcuaTag.java index 8c0ce0e518f..8dbbf0621d0 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/tag/OpcuaTag.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/tag/OpcuaTag.java @@ -18,6 +18,9 @@ */ package org.apache.plc4x.java.opcua.tag; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Map.Entry; import org.apache.commons.lang3.EnumUtils; import org.apache.plc4x.java.api.exceptions.PlcInvalidTagException; import org.apache.plc4x.java.api.exceptions.PlcUnsupportedDataTypeException; @@ -26,6 +29,7 @@ import org.apache.plc4x.java.api.model.PlcTag; import org.apache.plc4x.java.api.types.PlcSubscriptionType; import org.apache.plc4x.java.api.types.PlcValueType; +import org.apache.plc4x.java.opcua.readwrite.AttributeId; import org.apache.plc4x.java.opcua.readwrite.OpcuaDataType; import org.apache.plc4x.java.opcua.readwrite.OpcuaIdentifierType; @@ -35,10 +39,16 @@ import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.plc4x.java.spi.codegen.WithOption; +import org.apache.plc4x.java.spi.generation.SerializationException; +import org.apache.plc4x.java.spi.generation.WriteBuffer; +import org.apache.plc4x.java.spi.tag.TagConfigParser; +import org.apache.plc4x.java.spi.utils.Serializable; -public class OpcuaTag implements PlcSubscriptionTag { +public class OpcuaTag implements PlcSubscriptionTag, Serializable { - public static final Pattern ADDRESS_PATTERN = Pattern.compile("^ns=(?\\d+);(?[isgb])=(?[^;]+)?(;(?[a-zA-Z_]+))?$"); + private static final String OPC_UTA_TAG_ADDRESS = "^ns=(?\\d+);(?[isgb])=(?[^;]+)?(;a=(?[^;]+))?(;(?[a-zA-Z_]+))?"; + public static final Pattern ADDRESS_PATTERN = Pattern.compile(OPC_UTA_TAG_ADDRESS + TagConfigParser.TAG_CONFIG_PATTERN + "$"); private final OpcuaIdentifierType identifierType; @@ -46,16 +56,22 @@ public class OpcuaTag implements PlcSubscriptionTag { private final String identifier; + private final AttributeId attributeId; + private final OpcuaDataType dataType; - private OpcuaTag(Integer namespace, String identifier, OpcuaIdentifierType identifierType, OpcuaDataType dataType) { + private final Map config; + + private OpcuaTag(Integer namespace, String identifier, OpcuaIdentifierType identifierType, AttributeId attributeId, OpcuaDataType dataType, Map config) { this.identifier = Objects.requireNonNull(identifier); this.identifierType = Objects.requireNonNull(identifierType); this.namespace = namespace != null ? namespace : 0; if (this.namespace < 0) { throw new IllegalArgumentException("namespace must be greater then zero. Was " + this.namespace); } + this.attributeId = attributeId; this.dataType = dataType; + this.config = config; } public static OpcuaTag of(String address) { @@ -77,12 +93,21 @@ public static OpcuaTag of(String address) { } OpcuaDataType dataType = OpcuaDataType.valueOf(dataTypeString); - return new OpcuaTag(namespace, identifier, identifierType, dataType); + String attributeElement = matcher.group("attributeId"); + AttributeId attributeId = AttributeId.Value; + if (attributeElement != null) { + if (attributeElement.matches("\\d+")) { + attributeId = AttributeId.enumForValue(Long.parseLong(attributeElement)); + } else { + attributeId = AttributeId.valueOf(attributeElement); + } + } + return new OpcuaTag(namespace, identifier, identifierType, attributeId, dataType, TagConfigParser.parse(address)); } @Override public PlcTag getTag() { - return new OpcuaTag(namespace, identifier, identifierType, dataType); + return new OpcuaTag(namespace, identifier, identifierType, attributeId, dataType, config); } public static boolean matches(String address) { @@ -105,9 +130,20 @@ public OpcuaDataType getDataType() { return dataType; } + public AttributeId getAttributeId() { + return attributeId; + } + + public Map getConfig() { + return config; + } + @Override public String getAddressString() { String address = String.format("ns=%d;%s=%s", namespace, identifierType.getValue(), identifier); + if (attributeId != AttributeId.Value) { + address += ";a=" + attributeId.name(); + } if (dataType != null) { address += ";" + dataType.name(); } @@ -133,20 +169,26 @@ public boolean equals(Object o) { return false; } OpcuaTag that = (OpcuaTag) o; - return namespace == that.namespace && identifier.equals(that.identifier) && identifierType == that.identifierType; + return namespace == that.namespace && + identifier.equals(that.identifier) && + identifierType == that.identifierType && + attributeId == that.attributeId && + config.equals(that.config); } @Override public int hashCode() { - return Objects.hash(namespace); + return Objects.hash(namespace, identifier, identifierType, attributeId, config); } @Override public String toString() { return "OpcuaTag{" + - "namespace=" + namespace + - "identifierType=" + identifierType.getValue() + - "identifier=" + identifier + + " namespace=" + namespace + + " identifierType=" + identifierType.getValue() + + " identifier=" + identifier + + " attributeId=" + attributeId.name() + + " config=" + config + '}'; } @@ -159,4 +201,29 @@ public PlcSubscriptionType getPlcSubscriptionType() { public Optional getDuration() { return Optional.empty(); } + + @Override + public void serialize(WriteBuffer writeBuffer) throws SerializationException { + writeBuffer.pushContext(getClass().getSimpleName()); + String nodeId = String.format("ns=%d;%s=%s", namespace, identifierType.getValue(), identifier); + writeBuffer.writeString("nodeId", nodeId.length() * 8, nodeId); + writeBuffer.writeString("attributeId", attributeId.name().length() * 8, attributeId.name()); + if (dataType != null) { + String dataType = getDataType().name(); + writeBuffer.writeString("dataType", dataType.length() * 8, dataType); + } + + if (!config.isEmpty()) { + writeBuffer.pushContext("config"); + for (Entry entry : config.entrySet()) { + writeBuffer.pushContext("entry"); + writeBuffer.writeString("key", entry.getKey().length() * 8, entry.getKey()); + writeBuffer.writeString("value", entry.getValue().length() * 8, entry.getValue()); + writeBuffer.popContext("entry"); + } + writeBuffer.popContext("config"); + } + writeBuffer.popContext(getClass().getSimpleName()); + } + } diff --git a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/OpcuaParserSerializerTest.java b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/OpcuaParserSerializerTest.java new file mode 100644 index 00000000000..8fefde7336a --- /dev/null +++ b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/OpcuaParserSerializerTest.java @@ -0,0 +1,29 @@ +/* + * 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 + * + * https://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 org.apache.plc4x.java.opcua; + +import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner; + +public class OpcuaParserSerializerTest extends ParserSerializerTestsuiteRunner { + + public OpcuaParserSerializerTest() { + super("/protocols/opcua/ParserSerializerTestsuite.xml"); + } + +} diff --git a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandleTest.java b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandleTest.java index 37dec0d08f7..1339394a725 100644 --- a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandleTest.java +++ b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/OpcuaSubscriptionHandleTest.java @@ -135,6 +135,29 @@ public void subscribeDoesNotExists() throws Exception { subscriptionHandle.stopSubscriber(); } + @Test + public void subscribeEvent() throws Exception { + // Create Subscription + PlcSubscriptionRequest.Builder builder = opcuaConnection.subscriptionRequestBuilder(); + builder.addEventTagAddress("ev1", "ns=0;i=2253"); + PlcSubscriptionRequest request = builder.build(); + + // Get result of creating subscription + PlcSubscriptionResponse response = request.execute().get(1000, TimeUnit.MILLISECONDS); + final OpcuaSubscriptionHandle subscriptionHandle = (OpcuaSubscriptionHandle) response.getSubscriptionHandle("ev1"); + + // Create handler for returned value + subscriptionHandle.register(plcSubscriptionEvent -> { + System.out.println("Subscription handle " + plcSubscriptionEvent); + assert plcSubscriptionEvent.getResponseCode("ev1").equals(PlcResponseCode.OK); + }); + + //Wait for value to be returned from server + Thread.sleep(1200); + + subscriptionHandle.stopSubscriber(); + } + // ! If this test fails, see comment at the top of the class before investigating. @Test public void subscribeMultiple() throws Exception { diff --git a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverterTest.java b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverterTest.java index b7a2595dd70..0d97f242e58 100644 --- a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverterTest.java +++ b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/PayloadConverterTest.java @@ -28,6 +28,7 @@ import org.apache.plc4x.java.opcua.readwrite.ExtensionObject; import org.apache.plc4x.java.opcua.readwrite.HistoryEvent; import org.apache.plc4x.java.opcua.readwrite.NodeIdFourByte; +import org.apache.plc4x.java.opcua.readwrite.RootExtensionObject; import org.apache.plc4x.java.opcua.readwrite.SequenceHeader; import org.apache.plc4x.java.spi.utils.hex.Hex; import org.junit.jupiter.api.Test; @@ -46,10 +47,9 @@ void convert() throws Exception { null ); - ExtensionObject extObject = new ExtensionObject( + RootExtensionObject extObject = new RootExtensionObject( expandedNodeId, - null, - new HistoryEvent(0, Collections.emptyList()) + new HistoryEvent(Collections.emptyList()) ); ExtensiblePayload payload = new ExtensiblePayload( diff --git a/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/EventNotifierTask.java b/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/EventNotifierTask.java new file mode 100644 index 00000000000..03b2d015de4 --- /dev/null +++ b/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/EventNotifierTask.java @@ -0,0 +1,99 @@ +/* + * 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 org.eclipse.milo.examples.server; + +import static org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned.ubyte; +import static org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned.ushort; + +import java.util.UUID; +import org.eclipse.milo.opcua.sdk.server.OpcUaServer; +import org.eclipse.milo.opcua.sdk.server.model.nodes.objects.BaseEventTypeNode; +import org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerTypeNode; +import org.eclipse.milo.opcua.sdk.server.nodes.UaNode; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; +import org.eclipse.milo.opcua.stack.core.types.builtin.DateTime; +import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; +import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; +import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EventNotifierTask implements Runnable { + + private final Logger logger = LoggerFactory.getLogger(EventNotifierTask.class); + private final OpcUaServer server; + private Thread eventThread; + + public EventNotifierTask(OpcUaServer server) { + this.server = server; + } + + @Override + public void run() { + UaNode serverNode = server + .getAddressSpaceManager() + .getManagedNode(Identifiers.Server) + .orElse(null); + + if (serverNode instanceof ServerTypeNode) { + ((ServerTypeNode) serverNode).setEventNotifier(ubyte(1)); + + // Post a bogus Event every couple seconds + eventThread = new Thread(() -> { + while (!eventThread.isInterrupted()) { + try { + BaseEventTypeNode eventNode = server.getEventFactory().createEvent( + new NodeId(ushort(1), UUID.randomUUID()), + Identifiers.BaseEventType + ); + + eventNode.setBrowseName(new QualifiedName(1, "foo")); + eventNode.setDisplayName(LocalizedText.english("foo")); + eventNode.setEventId(ByteString.of(new byte[]{0, 1, 2, 3})); + eventNode.setEventType(Identifiers.BaseEventType); + eventNode.setSourceNode(serverNode.getNodeId()); + eventNode.setSourceName(serverNode.getDisplayName().getText()); + eventNode.setTime(DateTime.now()); + eventNode.setReceiveTime(DateTime.NULL_VALUE); + eventNode.setMessage(LocalizedText.english("event message!")); + eventNode.setSeverity(ushort(2)); + + logger.info("Posting event {}", eventNode.getEventId()); + server.getEventBus().post(eventNode); + + eventNode.delete(); + } catch (Throwable e) { + logger.error("Error creating EventNode: {}", e.getMessage(), e); + } + + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + // ignored + } + } + }, "bogus-event-poster"); + + eventThread.setDaemon(true); + eventThread.start(); + } + } +} diff --git a/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/TestMiloServer.java b/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/TestMiloServer.java index d886afb11c4..e2f19386dfd 100644 --- a/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/TestMiloServer.java +++ b/plc4j/drivers/opcua/src/test/java/org/eclipse/milo/examples/server/TestMiloServer.java @@ -62,6 +62,7 @@ import org.eclipse.milo.opcua.stack.core.util.SelfSignedHttpsCertificateBuilder; import org.eclipse.milo.opcua.stack.server.EndpointConfiguration; import org.eclipse.milo.opcua.stack.server.security.DefaultServerCertificateValidator; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** @@ -72,6 +73,7 @@ public class TestMiloServer { private static final int TCP_BIND_PORT = 12686; private static final int HTTPS_BIND_PORT = 8443; + private final Logger logger = LoggerFactory.getLogger(TestMiloServer.class); private final OpcUaServer server; private final ExampleNamespace exampleNamespace; @@ -87,6 +89,7 @@ public class TestMiloServer { } } + public static void main(String[] args) throws Exception { TestMiloServer server = new TestMiloServer(); @@ -110,10 +113,8 @@ public TestMiloServer() throws Exception { File pkiDir = securityTempDir.resolve("pki").toFile(); - LoggerFactory.getLogger(getClass()) - .info("security dir: {}", securityTempDir.toAbsolutePath()); - LoggerFactory.getLogger(getClass()) - .info("security pki dir: {}", pkiDir.getAbsolutePath()); + logger.info("security dir: {}", securityTempDir.toAbsolutePath()); + logger.info("security pki dir: {}", pkiDir.getAbsolutePath()); KeyStoreLoader loader = new KeyStoreLoader().load(securityTempDir); @@ -187,7 +188,10 @@ public TestMiloServer() throws Exception { server = new OpcUaServer(serverConfig); - exampleNamespace = new ExampleNamespace(server); + exampleNamespace = new ExampleNamespace(server) {{ + // Set the EventNotifier bit on Server Node for Events. + getLifecycleManager().addStartupTask(new EventNotifierTask(getServer())); + }}; exampleNamespace.startup(); } diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderArray.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderArray.java index c1c2f76616b..12da2f9dee1 100644 --- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderArray.java +++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderArray.java @@ -41,6 +41,9 @@ public List readFieldCount(String logicalName, DataReader dataReader, long if (count > Integer.MAX_VALUE) { throw new ParseException("Array count of " + count + " exceeds the maximum allowed count of " + Integer.MAX_VALUE); } + if (count < 0) { + return null; + } // Ensure we have the render as list argument present readerArgs = ArrayUtils.add(readerArgs, WithReaderWriterArgs.WithRenderAsList(true)); dataReader.pullContext(logicalName, readerArgs); diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/tag/TagConfigParser.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/tag/TagConfigParser.java index d80e4762e0e..58e026ed98b 100644 --- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/tag/TagConfigParser.java +++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/tag/TagConfigParser.java @@ -20,6 +20,7 @@ package org.apache.plc4x.java.spi.tag; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -39,7 +40,7 @@ private TagConfigParser() { } public static Map parse(String tagAddress) { - Map params = new HashMap<>(); + Map params = new LinkedHashMap<>(); Matcher matcher = TAG_CONFIG_PATTERN.matcher(tagAddress); if (matcher.find() && matcher.group("config") != null) { Matcher kv = KEY_VALUE_PATTERN.matcher(matcher.group("config")); diff --git a/plc4j/spi/src/test/java/org/apache/plc4x/java/spi/tag/TagTagConfigParserTest.java b/plc4j/spi/src/test/java/org/apache/plc4x/java/spi/tag/TagTagConfigParserTest.java index 7279dffb85d..829dd4a7baf 100644 --- a/plc4j/spi/src/test/java/org/apache/plc4x/java/spi/tag/TagTagConfigParserTest.java +++ b/plc4j/spi/src/test/java/org/apache/plc4x/java/spi/tag/TagTagConfigParserTest.java @@ -38,17 +38,20 @@ public void testConfigOptions() { parse("aaa:123{unit-id: true}", "unit-id", "true"); parse("aaa:123{unit-id: false}", "unit-id", "false"); parse("aaa:123{val1: 1, val2: 2}", "val1", "1", "val2", "2"); + parse("aaa:123{x: '', y: '', z: ''}", "x", "", "y", "", "z", ""); } - private void parse(String address, String key, String value) { - Map config = TagConfigParser.parse(address); - verify(config, key, value); - } + private void parse(String address, String ... pairs) { + if ((pairs.length % 2) != 0) { + throw new IllegalArgumentException("Invalid number of pairs: " + pairs.length); + } - private void parse(String address, String key1, String value1, String key2, String value2) { Map config = TagConfigParser.parse(address); - verify(config, key1, value1); - verify(config, key2, value2); + for (int i = 0; i < pairs.length; i += 2) { + String key = pairs[i]; + String value = pairs[i + 1]; + verify(config, key, value); + } } private void verify(Map config, String key, String value) { diff --git a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/Testcase.java b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/Testcase.java index a09ca681101..463280c0f03 100644 --- a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/Testcase.java +++ b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/Testcase.java @@ -94,7 +94,7 @@ public void run() throws DriverTestsuiteException { } LOGGER.info("Finished setup steps"); } - LOGGER.info("Running test steps"); + LOGGER.info("Running test steps " + plcConnection.isConnected()); for (TestStep step : steps) { step.execute(plcConnection, embeddedChannel, byteOrder); } diff --git a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/handlers/ApiRequestHandler.java b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/handlers/ApiRequestHandler.java index 764fbb84542..1a37e3599a3 100644 --- a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/handlers/ApiRequestHandler.java +++ b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/driver/internal/handlers/ApiRequestHandler.java @@ -104,7 +104,7 @@ else if (valueElement.elements() != null) { throw new NotImplementedException(); } default: - throw new PlcRuntimeException("Unknown class name" + typeName); + throw new PlcRuntimeException("Unknown class name " + typeName); } } diff --git a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java index fd73fde28c9..7f0e025ac34 100644 --- a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java +++ b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java @@ -26,6 +26,8 @@ import org.apache.plc4x.java.spi.generation.*; import org.apache.plc4x.test.dom4j.LocationAwareElement; import org.apache.plc4x.test.driver.exceptions.DriverTestsuiteException; +import org.apache.plc4x.test.driver.xmlunit.SkipAttributeFilter; +import org.apache.plc4x.test.driver.xmlunit.SkipDifferenceEvaluator; import org.dom4j.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -97,6 +99,8 @@ public static boolean validateOutboundMessageAndMigrate(String testCaseName, Mes parsedOutput.serialize(writeBufferXmlBased); String xmlString = writeBufferXmlBased.getXmlString(); final Diff diff = DiffBuilder.compare(referenceXmlString) + .withAttributeFilter(new SkipAttributeFilter()) + .withDifferenceEvaluator(new SkipDifferenceEvaluator()) .withTest(xmlString).checkForSimilar().ignoreComments().ignoreWhitespace() .build(); if (diff.hasDifferences()) { diff --git a/protocols/opcua/pom.xml b/protocols/opcua/pom.xml index 10b7ef3284e..699f15d1861 100644 --- a/protocols/opcua/pom.xml +++ b/protocols/opcua/pom.xml @@ -132,6 +132,33 @@ + + ${project.build.directory}/downloads + Opc.Ua.Types.bsd + src/main/xslt/opc-attribute.xsl + ${project.basedir}/src/main/generated/protocols/opcua + + + opc-attribute.mspec + + + + + osType + ${os.suffix} + + + fileName + ${project.build.directory}/downloads/AttributeIds.csv + + + + + indent + no + + + ${project.build.directory}/downloads Opc.Ua.Types.bsd diff --git a/protocols/opcua/src/main/generated/protocols/opcua/opc-attribute.mspec b/protocols/opcua/src/main/generated/protocols/opcua/opc-attribute.mspec new file mode 100644 index 00000000000..028939f61c0 --- /dev/null +++ b/protocols/opcua/src/main/generated/protocols/opcua/opc-attribute.mspec @@ -0,0 +1,53 @@ + +/* + * 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 + * + * https://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. + */ + +// Code generated by code-generation. DO NOT EDIT. + +[enum uint 32 AttributeId + + ['1' NodeId] + ['2' NodeClass] + ['3' BrowseName] + ['4' DisplayName] + ['5' Description] + ['6' WriteMask] + ['7' UserWriteMask] + ['8' IsAbstract] + ['9' Symmetric] + ['10' InverseName] + ['11' ContainsNoLoops] + ['12' EventNotifier] + ['13' Value] + ['14' DataType] + ['15' ValueRank] + ['16' ArrayDimensions] + ['17' AccessLevel] + ['18' UserAccessLevel] + ['19' MinimumSamplingInterval] + ['20' Historizing] + ['21' Executable] + ['22' UserExecutable] + ['23' DataTypeDefinition] + ['24' RolePermissions] + ['25' UserRolePermissions] + ['26' AccessRestrictions] + ['27' AccessLevelEx] +] + \ No newline at end of file diff --git a/protocols/opcua/src/main/generated/protocols/opcua/opc-manual.mspec b/protocols/opcua/src/main/generated/protocols/opcua/opc-manual.mspec index 91b6d22c009..6f06d025bf4 100644 --- a/protocols/opcua/src/main/generated/protocols/opcua/opc-manual.mspec +++ b/protocols/opcua/src/main/generated/protocols/opcua/opc-manual.mspec @@ -26,8 +26,8 @@ [const uint 8 protocolVersion 0] ] -[type OpcuaAPU(bit response) byteOrder='LITTLE_ENDIAN' - [simple MessagePDU('response') message] +[type OpcuaAPU(bit response, bit binaryEncoding) byteOrder='LITTLE_ENDIAN' + [simple MessagePDU('response', 'binaryEncoding') message] ] [enum string 8 ChunkType @@ -45,7 +45,7 @@ ['"MSG"' MESSAGE ] ] -[discriminatedType MessagePDU(bit response) +[discriminatedType MessagePDU(bit response, bit binary) [discriminator string 24 messageType] [simple ChunkType chunk] [implicit uint 32 totalLength 'lengthInBytes'] @@ -62,23 +62,23 @@ ['"OPN"','false' OpcuaOpenRequest (uint 32 totalLength) [simple OpenChannelMessage('response') openRequest] - [simple Payload('false', 'totalLength - openRequest.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - openRequest.lengthInBytes - 16') message] ] ['"OPN"','true' OpcuaOpenResponse (uint 32 totalLength) [simple OpenChannelMessage('response') openResponse] - [simple Payload('false', 'totalLength - openResponse.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - openResponse.lengthInBytes - 16') message] ] ['"CLO"','false' OpcuaCloseRequest [simple SecurityHeader securityHeader ] - [simple Payload('false', '0') message ] + [simple Payload('binary', '0') message ] ] ['"MSG"','false' OpcuaMessageRequest (uint 32 totalLength) [simple SecurityHeader securityHeader ] - [simple Payload('false', 'totalLength - securityHeader.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - securityHeader.lengthInBytes - 16') message] ] ['"MSG"','true' OpcuaMessageResponse (uint 32 totalLength) [simple SecurityHeader securityHeader ] - [simple Payload('false', 'totalLength - securityHeader.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - securityHeader.lengthInBytes - 16') message] ] ['"ERR"','true' OpcuaMessageError [simple OpcuaStatusCode error ] @@ -116,13 +116,13 @@ [simple uint 32 secureTokenId] ] -[discriminatedType Payload (bit extensible, uint 32 byteCount) - [simple SequenceHeader sequenceHeader ] - [typeSwitch extensible - ['true' ExtensiblePayload - [simple ExtensionObject('false') payload ] +[discriminatedType Payload (bit binary, uint 32 byteCount) + [simple SequenceHeader sequenceHeader ] + [typeSwitch binary + ['false' ExtensiblePayload + [simple RootExtensionObject('false') payload ] ] - ['false' BinaryPayload + ['true' BinaryPayload [array byte payload count 'byteCount'] ] ] @@ -150,116 +150,115 @@ [simple bit namespaceURISpecified] [simple bit serverIndexSpecified] [simple NodeIdTypeDefinition nodeId] - [virtual vstring '-1' identifier 'nodeId.identifier'] [optional PascalString namespaceURI 'namespaceURISpecified'] [optional uint 32 serverIndex 'serverIndexSpecified'] ] -[type ExtensionHeader - [reserved int 5 '0x00'] - [simple bit xmlbody] - [simple bit binaryBody] -] + [type ExtensionObjectEncodingMask [reserved int 5 '0x00'] [simple bit typeIdSpecified] - [simple bit xmlbody] + [simple bit xmlBody] [simple bit binaryBody] ] -[type ExtensionObject(bit includeEncodingMask) - //A serialized object prefixed with its data type identifier. +[discriminatedType ExtensionObject(bit includeEncodingMask) + [abstract ExtensionObjectDefinition body] [simple ExpandedNodeId typeId] - [optional ExtensionObjectEncodingMask encodingMask 'includeEncodingMask'] - [virtual vstring '-1' identifier 'typeId.identifier'] - [simple ExtensionObjectDefinition('identifier') body] + [virtual int 32 extensionId 'typeId == null ? 0 : STATIC_CALL("extensionId", typeId)'] + [typeSwitch includeEncodingMask + ['false' RootExtensionObject (int 32 extensionId) + [simple ExtensionObjectDefinition('extensionId') body] + ] + ['true' ExtensionObjectWithMask (int 32 extensionId) + [simple ExtensionObjectEncodingMask encodingMask] + [typeSwitch encodingMask.xmlBody, encodingMask.binaryBody + ['false', 'true' BinaryExtensionObjectWithMask + [implicit int 32 bodyLength 'body == null ? 0 : body.lengthInBytes'] + [simple ExtensionObjectDefinition('extensionId') body] + ] + ['false', 'false' NullExtensionObjectWithMask + [virtual ExtensionObjectDefinition('0') body 'null'] + ] + ] + ] + ] ] -[discriminatedType ExtensionObjectDefinition(vstring '-1' identifier) - [typeSwitch identifier - ['"0"' NullExtension +[discriminatedType ExtensionObjectDefinition(int 32 extensionId) + [typeSwitch extensionId + ['0' NullExtension ] - ['"12758"' Union + ['12758' Union ] - ['"14535"' KeyValuePair + ['14535' KeyValuePair [simple QualifiedName key] [simple Variant value] - ] - ['"16315"' AdditionalParametersType - [simple int 32 noOfParameters] - - [array ExtensionObjectDefinition('"14535"') parameters count 'noOfParameters'] - + ['16315' AdditionalParametersType + [implicit int 32 noOfParameters 'parameters == null ? -1 : COUNT(parameters)'] + [array KeyValuePair('14535') parameters count 'noOfParameters'] ] - ['"17550"' EphemeralKeyType + ['17550' EphemeralKeyType [simple PascalByteString publicKey] [simple PascalByteString signature] - ] - ['"15530"' EndpointType + ['15530' EndpointType [simple PascalString endpointUrl] [simple MessageSecurityMode securityMode] [simple PascalString securityPolicyUri] [simple PascalString transportProfileUri] - ] - ['"32423"' BitFieldDefinition + ['32423' BitFieldDefinition [simple PascalString name] [simple LocalizedText description] [reserved uint 7 '0x00'] [reserved bit 'false'] [simple uint 32 startingBitPosition] [simple uint 32 endingBitPosition] - ] - ['"18808"' RationalNumber + ['18808' RationalNumber [simple int 32 numerator] [simple uint 32 denominator] - ] - ['"18809"' OpcuaVector + ['18809' OpcuaVector ] - ['"18811"' CartesianCoordinates + ['18811' CartesianCoordinates ] - ['"18813"' Orientation + ['18813' Orientation ] - ['"18815"' Frame + ['18815' Frame ] - ['"15636"' IdentityMappingRuleType + ['15636' IdentityMappingRuleType [simple IdentityCriteriaType criteriaType] [simple PascalString criteria] - ] - ['"23500"' CurrencyUnitType + ['23500' CurrencyUnitType [simple int 16 numericCode] [simple int 8 exponent] [simple PascalString alphabeticCode] [simple LocalizedText currency] - ] - ['"32436"' AnnotationDataType + ['32436' AnnotationDataType [simple PascalString annotation] [simple PascalString discipline] [simple PascalString uri] - ] - ['"32437"' LinearConversionDataType + ['32437' LinearConversionDataType [simple float 32 initialAddend] [simple float 32 multiplicand] [simple float 32 divisor] [simple float 32 finalAddend] - ] - ['"32440"' QuantityDimension + ['32440' QuantityDimension [simple int 8 massExponent] [simple int 8 lengthExponent] [simple int 8 timeExponent] @@ -268,77 +267,127 @@ [simple int 8 luminousIntensityExponent] [simple int 8 absoluteTemperatureExponent] [simple int 8 dimensionlessExponent] - ] - ['"12556"' TrustListDataType + ['12556' TrustListDataType [simple uint 32 specifiedLists] - [simple int 32 noOfTrustedCertificates] + [implicit int 32 noOfTrustedCertificates 'trustedCertificates == null ? -1 : COUNT(trustedCertificates)'] [array PascalByteString trustedCertificates count 'noOfTrustedCertificates'] - [simple int 32 noOfTrustedCrls] + [implicit int 32 noOfTrustedCrls 'trustedCrls == null ? -1 : COUNT(trustedCrls)'] [array PascalByteString trustedCrls count 'noOfTrustedCrls'] - [simple int 32 noOfIssuerCertificates] + [implicit int 32 noOfIssuerCertificates 'issuerCertificates == null ? -1 : COUNT(issuerCertificates)'] [array PascalByteString issuerCertificates count 'noOfIssuerCertificates'] - [simple int 32 noOfIssuerCrls] + [implicit int 32 noOfIssuerCrls 'issuerCrls == null ? -1 : COUNT(issuerCrls)'] [array PascalByteString issuerCrls count 'noOfIssuerCrls'] - ] - ['"32287"' TransactionErrorType + ['32287' TransactionErrorType [simple NodeId targetId] [simple StatusCode error] [simple LocalizedText message] - ] - ['"15536"' DataTypeSchemaHeader - [simple int 32 noOfNamespaces] + ['15536' DataTypeSchemaHeader + [implicit int 32 noOfNamespaces 'namespaces == null ? -1 : COUNT(namespaces)'] [array PascalString namespaces count 'noOfNamespaces'] - [simple int 32 noOfStructureDataTypes] - [array DataTypeDescription('"14525"') structureDataTypes count 'noOfStructureDataTypes'] - [simple int 32 noOfEnumDataTypes] - [array DataTypeDescription('"14525"') enumDataTypes count 'noOfEnumDataTypes'] - [simple int 32 noOfSimpleDataTypes] - [array DataTypeDescription('"14525"') simpleDataTypes count 'noOfSimpleDataTypes'] - - ] - ['"14527"' DataTypeDescription + [implicit int 32 noOfStructureDataTypes 'structureDataTypes == null ? -1 : COUNT(structureDataTypes)'] + [array StructureDescription('15489') structureDataTypes count 'noOfStructureDataTypes'] + [implicit int 32 noOfEnumDataTypes 'enumDataTypes == null ? -1 : COUNT(enumDataTypes)'] + [array EnumDescription('15490') enumDataTypes count 'noOfEnumDataTypes'] + [implicit int 32 noOfSimpleDataTypes 'simpleDataTypes == null ? -1 : COUNT(simpleDataTypes)'] + [array SimpleTypeDescription('15007') simpleDataTypes count 'noOfSimpleDataTypes'] + ] + ['14527' DataTypeDescription [simple NodeId dataTypeId] [simple QualifiedName name] - ] - ['"24107"' PortableQualifiedName + ['15489' StructureDescription + [simple NodeId dataTypeId] + [simple QualifiedName name] + [simple StructureDefinition('101') structureDefinition] + ] + ['15490' EnumDescription + [simple NodeId dataTypeId] + [simple QualifiedName name] + [simple EnumDefinition('102') enumDefinition] + [simple uint 8 builtInType] + ] + ['15007' SimpleTypeDescription + [simple NodeId dataTypeId] + [simple QualifiedName name] + [simple NodeId baseDataType] + [simple uint 8 builtInType] + ] + ['15008' UABinaryFileDataType + [implicit int 32 noOfNamespaces 'namespaces == null ? -1 : COUNT(namespaces)'] + [array PascalString namespaces count 'noOfNamespaces'] + [implicit int 32 noOfStructureDataTypes 'structureDataTypes == null ? -1 : COUNT(structureDataTypes)'] + [array StructureDescription('15489') structureDataTypes count 'noOfStructureDataTypes'] + [implicit int 32 noOfEnumDataTypes 'enumDataTypes == null ? -1 : COUNT(enumDataTypes)'] + [array EnumDescription('15490') enumDataTypes count 'noOfEnumDataTypes'] + [implicit int 32 noOfSimpleDataTypes 'simpleDataTypes == null ? -1 : COUNT(simpleDataTypes)'] + [array SimpleTypeDescription('15007') simpleDataTypes count 'noOfSimpleDataTypes'] + [simple PascalString schemaLocation] + [implicit int 32 noOfFileHeader 'fileHeader == null ? -1 : COUNT(fileHeader)'] + [array KeyValuePair('14535') fileHeader count 'noOfFileHeader'] + [simple Variant body] + ] + ['24107' PortableQualifiedName [simple PascalString namespaceUri] [simple PascalString name] - ] - ['"24109"' UnsignedRationalNumber + ['24108' PortableNodeId + [simple PascalString namespaceUri] + [simple NodeId identifier] + ] + ['24109' UnsignedRationalNumber [simple uint 32 numerator] [simple uint 32 denominator] - ] - ['"14526"' FieldMetaData + ['14525' DataSetMetaDataType + [implicit int 32 noOfNamespaces 'namespaces == null ? -1 : COUNT(namespaces)'] + [array PascalString namespaces count 'noOfNamespaces'] + [implicit int 32 noOfStructureDataTypes 'structureDataTypes == null ? -1 : COUNT(structureDataTypes)'] + [array StructureDescription('15489') structureDataTypes count 'noOfStructureDataTypes'] + [implicit int 32 noOfEnumDataTypes 'enumDataTypes == null ? -1 : COUNT(enumDataTypes)'] + [array EnumDescription('15490') enumDataTypes count 'noOfEnumDataTypes'] + [implicit int 32 noOfSimpleDataTypes 'simpleDataTypes == null ? -1 : COUNT(simpleDataTypes)'] + [array SimpleTypeDescription('15007') simpleDataTypes count 'noOfSimpleDataTypes'] + [simple PascalString name] + [simple LocalizedText description] + [implicit int 32 noOfFields 'fields == null ? -1 : COUNT(fields)'] + [array FieldMetaData('14526') fields count 'noOfFields'] + [simple GuidValue dataSetClassId] + [simple ConfigurationVersionDataType('14595') configurationVersion] + ] + ['14526' FieldMetaData [simple PascalString name] [simple LocalizedText description] [simple DataSetFieldFlags fieldFlags] [simple uint 8 builtInType] [simple NodeId dataType] [simple int 32 valueRank] - [simple int 32 noOfArrayDimensions] + [implicit int 32 noOfArrayDimensions 'arrayDimensions == null ? -1 : COUNT(arrayDimensions)'] [array uint 32 arrayDimensions count 'noOfArrayDimensions'] - [simple uint 32 maxStringLength] + [simple uint 32 maxStringLength] [simple GuidValue dataSetFieldId] - [simple int 32 noOfProperties] - - [array ExtensionObjectDefinition('"14535"') properties count 'noOfProperties'] - + [implicit int 32 noOfProperties 'properties == null ? -1 : COUNT(properties)'] + [array KeyValuePair('14535') properties count 'noOfProperties'] ] - ['"14595"' ConfigurationVersionDataType + ['14595' ConfigurationVersionDataType [simple uint 32 majorVersion] [simple uint 32 minorVersion] - ] - ['"15582"' PublishedDataSetSourceDataType + ['15580' PublishedDataSetDataType + [simple PascalString name] + [implicit int 32 noOfDataSetFolder 'dataSetFolder == null ? -1 : COUNT(dataSetFolder)'] + [array PascalString dataSetFolder count 'noOfDataSetFolder'] + [simple DataSetMetaDataType('14525') dataSetMetaData] + [implicit int 32 noOfExtensionFields 'extensionFields == null ? -1 : COUNT(extensionFields)'] + [array KeyValuePair('14535') extensionFields count 'noOfExtensionFields'] + [simple ExtensionObject('true') dataSetSource] + ] + ['15582' PublishedDataSetSourceDataType ] - ['"14275"' PublishedVariableDataType + ['14275' PublishedVariableDataType [simple NodeId publishedVariable] [simple uint 32 attributeId] [simple float 64 samplingIntervalHint] @@ -346,11 +395,25 @@ [simple float 64 deadbandValue] [simple PascalString indexRange] [simple Variant substituteValue] - [simple int 32 noOfMetaDataProperties] + [implicit int 32 noOfMetaDataProperties 'metaDataProperties == null ? -1 : COUNT(metaDataProperties)'] [array QualifiedName metaDataProperties count 'noOfMetaDataProperties'] - ] - ['"15599"' DataSetWriterDataType + ['15583' PublishedDataItemsDataType + [implicit int 32 noOfPublishedData 'publishedData == null ? -1 : COUNT(publishedData)'] + [array PublishedVariableDataType('14275') publishedData count 'noOfPublishedData'] + ] + ['15584' PublishedEventsDataType + [simple NodeId eventNotifier] + [implicit int 32 noOfSelectedFields 'selectedFields == null ? -1 : COUNT(selectedFields)'] + [array SimpleAttributeOperand('603') selectedFields count 'noOfSelectedFields'] + [simple ContentFilter('588') filter] + ] + ['25271' PublishedDataSetCustomSourceDataType + [reserved uint 7 '0x00'] + [simple bit cyclicDataSet] + + ] + ['15599' DataSetWriterDataType [simple PascalString name] [reserved uint 7 '0x00'] [simple bit enabled] @@ -358,80 +421,141 @@ [simple DataSetFieldContentMask dataSetFieldContentMask] [simple uint 32 keyFrameCount] [simple PascalString dataSetName] - [simple int 32 noOfDataSetWriterProperties] - - [array ExtensionObjectDefinition('"14535"') dataSetWriterProperties count 'noOfDataSetWriterProperties'] - [simple ExtensionObject('true') transportSettings] + [implicit int 32 noOfDataSetWriterProperties 'dataSetWriterProperties == null ? -1 : COUNT(dataSetWriterProperties)'] + [array KeyValuePair('14535') dataSetWriterProperties count 'noOfDataSetWriterProperties'] + [simple ExtensionObject('true') transportSettings] [simple ExtensionObject('true') messageSettings] - ] - ['"15600"' DataSetWriterTransportDataType + ['15600' DataSetWriterTransportDataType ] - ['"15607"' DataSetWriterMessageDataType + ['15607' DataSetWriterMessageDataType ] - ['"15611"' PubSubGroupDataType + ['15611' PubSubGroupDataType [simple PascalString name] [reserved uint 7 '0x00'] [simple bit enabled] [simple MessageSecurityMode securityMode] [simple PascalString securityGroupId] - [simple int 32 noOfSecurityKeyServices] - - [array ExtensionObjectDefinition('"314"') securityKeyServices count 'noOfSecurityKeyServices'] - [simple uint 32 maxNetworkMessageSize] - [simple int 32 noOfGroupProperties] - - [array ExtensionObjectDefinition('"14535"') groupProperties count 'noOfGroupProperties'] - + [implicit int 32 noOfSecurityKeyServices 'securityKeyServices == null ? -1 : COUNT(securityKeyServices)'] + [array EndpointDescription('314') securityKeyServices count 'noOfSecurityKeyServices'] + [simple uint 32 maxNetworkMessageSize] + [implicit int 32 noOfGroupProperties 'groupProperties == null ? -1 : COUNT(groupProperties)'] + [array KeyValuePair('14535') groupProperties count 'noOfGroupProperties'] + ] + ['15482' WriterGroupDataType + [simple PascalString name] + [reserved uint 7 '0x00'] + [simple bit enabled] + [simple MessageSecurityMode securityMode] + [simple PascalString securityGroupId] + [implicit int 32 noOfSecurityKeyServices 'securityKeyServices == null ? -1 : COUNT(securityKeyServices)'] + [array EndpointDescription('314') securityKeyServices count 'noOfSecurityKeyServices'] + [simple uint 32 maxNetworkMessageSize] + [implicit int 32 noOfGroupProperties 'groupProperties == null ? -1 : COUNT(groupProperties)'] + [array KeyValuePair('14535') groupProperties count 'noOfGroupProperties'] + [simple uint 16 writerGroupId] + [simple float 64 publishingInterval] + [simple float 64 keepAliveTime] + [simple uint 8 priority] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] + [array PascalString localeIds count 'noOfLocaleIds'] + [simple PascalString headerLayoutUri] + [simple ExtensionObject('true') transportSettings] + [simple ExtensionObject('true') messageSettings] + [implicit int 32 noOfDataSetWriters 'dataSetWriters == null ? -1 : COUNT(dataSetWriters)'] + [array DataSetWriterDataType('15599') dataSetWriters count 'noOfDataSetWriters'] ] - ['"15613"' WriterGroupTransportDataType + ['15613' WriterGroupTransportDataType ] - ['"15618"' WriterGroupMessageDataType + ['15618' WriterGroupMessageDataType ] - ['"15619"' PubSubConnectionDataType + ['15619' PubSubConnectionDataType [simple PascalString name] [reserved uint 7 '0x00'] [simple bit enabled] [simple Variant publisherId] [simple PascalString transportProfileUri] [simple ExtensionObject('true') address] - [simple int 32 noOfConnectionProperties] - - [array ExtensionObjectDefinition('"14535"') connectionProperties count 'noOfConnectionProperties'] - [simple ExtensionObject('true') transportSettings] - [simple int 32 noOfWriterGroups] - [array PubSubGroupDataType('"15609"') writerGroups count 'noOfWriterGroups'] - [simple int 32 noOfReaderGroups] - [array PubSubGroupDataType('"15609"') readerGroups count 'noOfReaderGroups'] - + [implicit int 32 noOfConnectionProperties 'connectionProperties == null ? -1 : COUNT(connectionProperties)'] + [array KeyValuePair('14535') connectionProperties count 'noOfConnectionProperties'] + [simple ExtensionObject('true') transportSettings] + [implicit int 32 noOfWriterGroups 'writerGroups == null ? -1 : COUNT(writerGroups)'] + [array WriterGroupDataType('15482') writerGroups count 'noOfWriterGroups'] + [implicit int 32 noOfReaderGroups 'readerGroups == null ? -1 : COUNT(readerGroups)'] + [array ReaderGroupDataType('15522') readerGroups count 'noOfReaderGroups'] ] - ['"15620"' ConnectionTransportDataType + ['15620' ConnectionTransportDataType ] - ['"15504"' NetworkAddressDataType + ['15504' NetworkAddressDataType [simple PascalString networkInterface] - ] - ['"15623"' ReaderGroupTransportDataType + ['15512' NetworkAddressUrlDataType + [simple PascalString networkInterface] + [simple PascalString url] + ] + ['15522' ReaderGroupDataType + [simple PascalString name] + [reserved uint 7 '0x00'] + [simple bit enabled] + [simple MessageSecurityMode securityMode] + [simple PascalString securityGroupId] + [implicit int 32 noOfSecurityKeyServices 'securityKeyServices == null ? -1 : COUNT(securityKeyServices)'] + [array EndpointDescription('314') securityKeyServices count 'noOfSecurityKeyServices'] + [simple uint 32 maxNetworkMessageSize] + [implicit int 32 noOfGroupProperties 'groupProperties == null ? -1 : COUNT(groupProperties)'] + [array KeyValuePair('14535') groupProperties count 'noOfGroupProperties'] + [simple ExtensionObject('true') transportSettings] + [simple ExtensionObject('true') messageSettings] + [implicit int 32 noOfDataSetReaders 'dataSetReaders == null ? -1 : COUNT(dataSetReaders)'] + [array DataSetReaderDataType('15625') dataSetReaders count 'noOfDataSetReaders'] + ] + ['15623' ReaderGroupTransportDataType ] - ['"15624"' ReaderGroupMessageDataType + ['15624' ReaderGroupMessageDataType ] - ['"15630"' DataSetReaderTransportDataType + ['15625' DataSetReaderDataType + [simple PascalString name] + [reserved uint 7 '0x00'] + [simple bit enabled] + [simple Variant publisherId] + [simple uint 16 writerGroupId] + [simple uint 16 dataSetWriterId] + [simple DataSetMetaDataType('14525') dataSetMetaData] + [simple DataSetFieldContentMask dataSetFieldContentMask] + [simple float 64 messageReceiveTimeout] + [simple uint 32 keyFrameCount] + [simple PascalString headerLayoutUri] + [simple MessageSecurityMode securityMode] + [simple PascalString securityGroupId] + [implicit int 32 noOfSecurityKeyServices 'securityKeyServices == null ? -1 : COUNT(securityKeyServices)'] + [array EndpointDescription('314') securityKeyServices count 'noOfSecurityKeyServices'] + [implicit int 32 noOfDataSetReaderProperties 'dataSetReaderProperties == null ? -1 : COUNT(dataSetReaderProperties)'] + [array KeyValuePair('14535') dataSetReaderProperties count 'noOfDataSetReaderProperties'] + [simple ExtensionObject('true') transportSettings] + [simple ExtensionObject('true') messageSettings] + [simple ExtensionObject('true') subscribedDataSet] + ] + ['15630' DataSetReaderTransportDataType ] - ['"15631"' DataSetReaderMessageDataType + ['15631' DataSetReaderMessageDataType ] - ['"15632"' SubscribedDataSetDataType + ['15632' SubscribedDataSetDataType ] - ['"14746"' FieldTargetDataType + ['15633' TargetVariablesDataType + [implicit int 32 noOfTargetVariables 'targetVariables == null ? -1 : COUNT(targetVariables)'] + [array FieldTargetDataType('14746') targetVariables count 'noOfTargetVariables'] + ] + ['14746' FieldTargetDataType [simple GuidValue dataSetFieldId] [simple PascalString receiverIndexRange] [simple NodeId targetNodeId] @@ -439,155 +563,297 @@ [simple PascalString writeIndexRange] [simple OverrideValueHandling overrideValueHandling] [simple Variant overrideValue] - ] - ['"15532"' PubSubConfigurationDataType - [simple int 32 noOfPublishedDataSets] - - [array ExtensionObjectDefinition('"15580"') publishedDataSets count 'noOfPublishedDataSets'] - [simple int 32 noOfConnections] - - [array ExtensionObjectDefinition('"15619"') connections count 'noOfConnections'] - [reserved uint 7 '0x00'] + ['15637' SubscribedDataSetMirrorDataType + [simple PascalString parentNodeName] + [implicit int 32 noOfRolePermissions 'rolePermissions == null ? -1 : COUNT(rolePermissions)'] + [array RolePermissionType('98') rolePermissions count 'noOfRolePermissions'] + ] + ['15532' PubSubConfigurationDataType + [implicit int 32 noOfPublishedDataSets 'publishedDataSets == null ? -1 : COUNT(publishedDataSets)'] + [array PublishedDataSetDataType('15580') publishedDataSets count 'noOfPublishedDataSets'] + [implicit int 32 noOfConnections 'connections == null ? -1 : COUNT(connections)'] + [array PubSubConnectionDataType('15619') connections count 'noOfConnections'] + [reserved uint 7 '0x00'] [simple bit enabled] ] - ['"23603"' SecurityGroupDataType + ['23601' StandaloneSubscribedDataSetRefDataType + [simple PascalString dataSetName] + ] + ['23602' StandaloneSubscribedDataSetDataType [simple PascalString name] - [simple int 32 noOfSecurityGroupFolder] + [implicit int 32 noOfDataSetFolder 'dataSetFolder == null ? -1 : COUNT(dataSetFolder)'] + [array PascalString dataSetFolder count 'noOfDataSetFolder'] + [simple DataSetMetaDataType('14525') dataSetMetaData] + [simple ExtensionObject('true') subscribedDataSet] + ] + ['23603' SecurityGroupDataType + [simple PascalString name] + [implicit int 32 noOfSecurityGroupFolder 'securityGroupFolder == null ? -1 : COUNT(securityGroupFolder)'] [array PascalString securityGroupFolder count 'noOfSecurityGroupFolder'] - [simple float 64 keyLifetime] + [simple float 64 keyLifetime] [simple PascalString securityPolicyUri] [simple uint 32 maxFutureKeyCount] [simple uint 32 maxPastKeyCount] [simple PascalString securityGroupId] - [simple int 32 noOfRolePermissions] - - [array ExtensionObjectDefinition('"98"') rolePermissions count 'noOfRolePermissions'] - [simple int 32 noOfGroupProperties] - - [array ExtensionObjectDefinition('"14535"') groupProperties count 'noOfGroupProperties'] - + [implicit int 32 noOfRolePermissions 'rolePermissions == null ? -1 : COUNT(rolePermissions)'] + [array RolePermissionType('98') rolePermissions count 'noOfRolePermissions'] + [implicit int 32 noOfGroupProperties 'groupProperties == null ? -1 : COUNT(groupProperties)'] + [array KeyValuePair('14535') groupProperties count 'noOfGroupProperties'] ] - ['"25272"' PubSubKeyPushTargetDataType + ['25272' PubSubKeyPushTargetDataType [simple PascalString applicationUri] - [simple int 32 noOfPushTargetFolder] + [implicit int 32 noOfPushTargetFolder 'pushTargetFolder == null ? -1 : COUNT(pushTargetFolder)'] [array PascalString pushTargetFolder count 'noOfPushTargetFolder'] - [simple PascalString endpointUrl] + [simple PascalString endpointUrl] [simple PascalString securityPolicyUri] - - [simple ExtensionObjectDefinition('"306"') userTokenType] + [simple UserTokenPolicy('306') userTokenType] [simple uint 16 requestedKeyCount] [simple float 64 retryInterval] - [simple int 32 noOfPushTargetProperties] - - [array ExtensionObjectDefinition('"14535"') pushTargetProperties count 'noOfPushTargetProperties'] - [simple int 32 noOfSecurityGroups] + [implicit int 32 noOfPushTargetProperties 'pushTargetProperties == null ? -1 : COUNT(pushTargetProperties)'] + [array KeyValuePair('14535') pushTargetProperties count 'noOfPushTargetProperties'] + [implicit int 32 noOfSecurityGroups 'securityGroups == null ? -1 : COUNT(securityGroups)'] [array PascalString securityGroups count 'noOfSecurityGroups'] - ] - ['"23605"' QosDataType + ['23604' PubSubConfiguration2DataType + [implicit int 32 noOfPublishedDataSets 'publishedDataSets == null ? -1 : COUNT(publishedDataSets)'] + [array PublishedDataSetDataType('15580') publishedDataSets count 'noOfPublishedDataSets'] + [implicit int 32 noOfConnections 'connections == null ? -1 : COUNT(connections)'] + [array PubSubConnectionDataType('15619') connections count 'noOfConnections'] + [reserved uint 7 '0x00'] + [simple bit enabled] + [implicit int 32 noOfSubscribedDataSets 'subscribedDataSets == null ? -1 : COUNT(subscribedDataSets)'] + [array StandaloneSubscribedDataSetDataType('23602') subscribedDataSets count 'noOfSubscribedDataSets'] + [implicit int 32 noOfDataSetClasses 'dataSetClasses == null ? -1 : COUNT(dataSetClasses)'] + [array DataSetMetaDataType('14525') dataSetClasses count 'noOfDataSetClasses'] + [implicit int 32 noOfDefaultSecurityKeyServices 'defaultSecurityKeyServices == null ? -1 : COUNT(defaultSecurityKeyServices)'] + [array EndpointDescription('314') defaultSecurityKeyServices count 'noOfDefaultSecurityKeyServices'] + [implicit int 32 noOfSecurityGroups 'securityGroups == null ? -1 : COUNT(securityGroups)'] + [array SecurityGroupDataType('23603') securityGroups count 'noOfSecurityGroups'] + [implicit int 32 noOfPubSubKeyPushTargets 'pubSubKeyPushTargets == null ? -1 : COUNT(pubSubKeyPushTargets)'] + [array PubSubKeyPushTargetDataType('25272') pubSubKeyPushTargets count 'noOfPubSubKeyPushTargets'] + [simple uint 32 configurationVersion] + [implicit int 32 noOfConfigurationProperties 'configurationProperties == null ? -1 : COUNT(configurationProperties)'] + [array KeyValuePair('14535') configurationProperties count 'noOfConfigurationProperties'] + ] + ['15647' UadpWriterGroupMessageDataType + [simple uint 32 groupVersion] + [simple DataSetOrderingType dataSetOrdering] + [simple UadpNetworkMessageContentMask networkMessageContentMask] + [simple float 64 samplingOffset] + [implicit int 32 noOfPublishingOffset 'publishingOffset == null ? -1 : COUNT(publishingOffset)'] + [array float 64 publishingOffset count 'noOfPublishingOffset'] + ] + ['15654' UadpDataSetWriterMessageDataType + [simple UadpDataSetMessageContentMask dataSetMessageContentMask] + [simple uint 16 configuredSize] + [simple uint 16 networkMessageNumber] + [simple uint 16 dataSetOffset] + ] + ['15655' UadpDataSetReaderMessageDataType + [simple uint 32 groupVersion] + [simple uint 16 networkMessageNumber] + [simple uint 16 dataSetOffset] + [simple GuidValue dataSetClassId] + [simple UadpNetworkMessageContentMask networkMessageContentMask] + [simple UadpDataSetMessageContentMask dataSetMessageContentMask] + [simple float 64 publishingInterval] + [simple float 64 receiveOffset] + [simple float 64 processingOffset] + ] + ['15659' JsonWriterGroupMessageDataType + [simple JsonNetworkMessageContentMask networkMessageContentMask] + ] + ['15666' JsonDataSetWriterMessageDataType + [simple JsonDataSetMessageContentMask dataSetMessageContentMask] + ] + ['15667' JsonDataSetReaderMessageDataType + [simple JsonNetworkMessageContentMask networkMessageContentMask] + [simple JsonDataSetMessageContentMask dataSetMessageContentMask] + ] + ['23605' QosDataType + + ] + ['23606' TransmitQosDataType + + ] + ['23607' TransmitQosPriorityDataType + [simple PascalString priorityLabel] + ] + ['23610' ReceiveQosDataType ] - ['"25521"' PubSubConfigurationRefDataType + ['23611' ReceiveQosPriorityDataType + [simple PascalString priorityLabel] + ] + ['17469' DatagramConnectionTransportDataType + [simple ExtensionObject('true') discoveryAddress] + ] + ['23614' DatagramConnectionTransport2DataType + [simple ExtensionObject('true') discoveryAddress] + [simple uint 32 discoveryAnnounceRate] + [simple uint 32 discoveryMaxMessageSize] + [simple PascalString qosCategory] + [implicit int 32 noOfDatagramQos 'datagramQos == null ? -1 : COUNT(datagramQos)'] + [array ExtensionObject('true') datagramQos count 'noOfDatagramQos'] + ] + ['15534' DatagramWriterGroupTransportDataType + [simple uint 8 messageRepeatCount] + [simple float 64 messageRepeatDelay] + ] + ['23615' DatagramWriterGroupTransport2DataType + [simple uint 8 messageRepeatCount] + [simple float 64 messageRepeatDelay] + [simple ExtensionObject('true') address] + [simple PascalString qosCategory] + [implicit int 32 noOfDatagramQos 'datagramQos == null ? -1 : COUNT(datagramQos)'] + [array ExtensionObject('true') datagramQos count 'noOfDatagramQos'] + [simple uint 32 discoveryAnnounceRate] + [simple PascalString topic] + ] + ['23616' DatagramDataSetReaderTransportDataType + [simple ExtensionObject('true') address] + [simple PascalString qosCategory] + [implicit int 32 noOfDatagramQos 'datagramQos == null ? -1 : COUNT(datagramQos)'] + [array ExtensionObject('true') datagramQos count 'noOfDatagramQos'] + [simple PascalString topic] + ] + ['15009' BrokerConnectionTransportDataType + [simple PascalString resourceUri] + [simple PascalString authenticationProfileUri] + ] + ['15669' BrokerWriterGroupTransportDataType + [simple PascalString queueName] + [simple PascalString resourceUri] + [simple PascalString authenticationProfileUri] + [simple BrokerTransportQualityOfService requestedDeliveryGuarantee] + ] + ['15671' BrokerDataSetWriterTransportDataType + [simple PascalString queueName] + [simple PascalString resourceUri] + [simple PascalString authenticationProfileUri] + [simple BrokerTransportQualityOfService requestedDeliveryGuarantee] + [simple PascalString metaDataQueueName] + [simple float 64 metaDataUpdateTime] + ] + ['15672' BrokerDataSetReaderTransportDataType + [simple PascalString queueName] + [simple PascalString resourceUri] + [simple PascalString authenticationProfileUri] + [simple BrokerTransportQualityOfService requestedDeliveryGuarantee] + [simple PascalString metaDataQueueName] + ] + ['25521' PubSubConfigurationRefDataType [simple PubSubConfigurationRefMask configurationMask] [simple uint 16 elementIndex] [simple uint 16 connectionIndex] [simple uint 16 groupIndex] - ] - ['"23470"' AliasNameDataType + ['25522' PubSubConfigurationValueDataType + [simple PubSubConfigurationRefDataType('25521') configurationElement] + [simple PascalString name] + [simple Variant identifier] + ] + ['23470' AliasNameDataType [simple QualifiedName aliasName] - [simple int 32 noOfReferencedNodes] + [implicit int 32 noOfReferencedNodes 'referencedNodes == null ? -1 : COUNT(referencedNodes)'] [array ExpandedNodeId referencedNodes count 'noOfReferencedNodes'] - ] - ['"24283"' UserManagementDataType + ['24283' UserManagementDataType [simple PascalString userName] [simple UserConfigurationMask userConfiguration] [simple PascalString description] - ] - ['"25222"' PriorityMappingEntryType + ['25222' PriorityMappingEntryType [simple PascalString mappingUri] [simple PascalString priorityLabel] [simple uint 8 priorityValue_PCP] [simple uint 32 priorityValue_DSCP] - ] - ['"32661"' ReferenceDescriptionDataType + ['32661' ReferenceDescriptionDataType [simple NodeId sourceNode] [simple NodeId referenceType] [reserved uint 7 '0x00'] [simple bit isForward] [simple ExpandedNodeId targetNode] - ] - ['"32662"' ReferenceListEntryDataType + ['32662' ReferenceListEntryDataType [simple NodeId referenceType] [reserved uint 7 '0x00'] [simple bit isForward] [simple ExpandedNodeId targetNode] - ] - ['"98"' RolePermissionType + ['98' RolePermissionType [simple NodeId roleId] [simple PermissionType permissions] - ] - ['"99"' DataTypeDefinition + ['99' DataTypeDefinition ] - ['"103"' StructureField + ['103' StructureField [simple PascalString name] [simple LocalizedText description] [simple NodeId dataType] [simple int 32 valueRank] - [simple int 32 noOfArrayDimensions] + [implicit int 32 noOfArrayDimensions 'arrayDimensions == null ? -1 : COUNT(arrayDimensions)'] [array uint 32 arrayDimensions count 'noOfArrayDimensions'] - [simple uint 32 maxStringLength] + [simple uint 32 maxStringLength] [reserved uint 7 '0x00'] [simple bit isOptional] ] - ['"298"' Argument + ['101' StructureDefinition + [simple NodeId defaultEncodingId] + [simple NodeId baseDataType] + [simple StructureType structureType] + [implicit int 32 noOfFields 'fields == null ? -1 : COUNT(fields)'] + [array StructureField('103') fields count 'noOfFields'] + ] + ['102' EnumDefinition + [implicit int 32 noOfFields 'fields == null ? -1 : COUNT(fields)'] + [array EnumField('104') fields count 'noOfFields'] + ] + ['298' Argument [simple PascalString name] [simple NodeId dataType] [simple int 32 valueRank] - [simple int 32 noOfArrayDimensions] + [implicit int 32 noOfArrayDimensions 'arrayDimensions == null ? -1 : COUNT(arrayDimensions)'] [array uint 32 arrayDimensions count 'noOfArrayDimensions'] - [simple LocalizedText description] - + [simple LocalizedText description] ] - ['"7596"' EnumValueType + ['7596' EnumValueType [simple int 64 value] [simple LocalizedText displayName] [simple LocalizedText description] - ] - ['"12757"' OptionSet + ['104' EnumField + [simple int 64 value] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple PascalString name] + ] + ['12757' OptionSet [simple PascalByteString value] [simple PascalByteString validBits] - ] - ['"8914"' TimeZoneDataType + ['8914' TimeZoneDataType [simple int 16 offset] [reserved uint 7 '0x00'] [simple bit daylightSavingInOffset] ] - ['"310"' ApplicationDescription + ['310' ApplicationDescription [simple PascalString applicationUri] [simple PascalString productUri] [simple LocalizedText applicationName] [simple ApplicationType applicationType] [simple PascalString gatewayServerUri] [simple PascalString discoveryProfileUri] - [simple int 32 noOfDiscoveryUrls] + [implicit int 32 noOfDiscoveryUrls 'discoveryUrls == null ? -1 : COUNT(discoveryUrls)'] [array PascalString discoveryUrls count 'noOfDiscoveryUrls'] - ] - ['"391"' RequestHeader + ['391' RequestHeader [simple NodeId authenticationToken] [simple int 64 timestamp] [simple uint 32 requestHandle] @@ -595,224 +861,179 @@ [simple PascalString auditEntryId] [simple uint 32 timeoutHint] [simple ExtensionObject('true') additionalHeader] - ] - ['"394"' ResponseHeader + ['394' ResponseHeader [simple int 64 timestamp] [simple uint 32 requestHandle] [simple StatusCode serviceResult] [simple DiagnosticInfo serviceDiagnostics] - [simple int 32 noOfStringTable] + [implicit int 32 noOfStringTable 'stringTable == null ? -1 : COUNT(stringTable)'] [array PascalString stringTable count 'noOfStringTable'] - [simple ExtensionObject('true') additionalHeader] - + [simple ExtensionObject('true') additionalHeader] ] - ['"397"' ServiceFault - - [simple ExtensionObjectDefinition('"394"') responseHeader] - + ['397' ServiceFault + [simple ResponseHeader('394') responseHeader] ] - ['"15903"' SessionlessInvokeRequestType + ['15903' SessionlessInvokeRequestType [simple uint 32 urisVersion] - [simple int 32 noOfNamespaceUris] + [implicit int 32 noOfNamespaceUris 'namespaceUris == null ? -1 : COUNT(namespaceUris)'] [array PascalString namespaceUris count 'noOfNamespaceUris'] - [simple int 32 noOfServerUris] + [implicit int 32 noOfServerUris 'serverUris == null ? -1 : COUNT(serverUris)'] [array PascalString serverUris count 'noOfServerUris'] - [simple int 32 noOfLocaleIds] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] [array PascalString localeIds count 'noOfLocaleIds'] - [simple uint 32 serviceId] - + [simple uint 32 serviceId] ] - ['"21001"' SessionlessInvokeResponseType - [simple int 32 noOfNamespaceUris] + ['21001' SessionlessInvokeResponseType + [implicit int 32 noOfNamespaceUris 'namespaceUris == null ? -1 : COUNT(namespaceUris)'] [array PascalString namespaceUris count 'noOfNamespaceUris'] - [simple int 32 noOfServerUris] + [implicit int 32 noOfServerUris 'serverUris == null ? -1 : COUNT(serverUris)'] [array PascalString serverUris count 'noOfServerUris'] - [simple uint 32 serviceId] - + [simple uint 32 serviceId] ] - ['"422"' FindServersRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['422' FindServersRequest + [simple RequestHeader('391') requestHeader] [simple PascalString endpointUrl] - [simple int 32 noOfLocaleIds] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] [array PascalString localeIds count 'noOfLocaleIds'] - [simple int 32 noOfServerUris] + [implicit int 32 noOfServerUris 'serverUris == null ? -1 : COUNT(serverUris)'] [array PascalString serverUris count 'noOfServerUris'] - ] - ['"425"' FindServersResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfServers] - - [array ExtensionObjectDefinition('"310"') servers count 'noOfServers'] - + ['425' FindServersResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfServers 'servers == null ? -1 : COUNT(servers)'] + [array ApplicationDescription('310') servers count 'noOfServers'] ] - ['"12191"' ServerOnNetwork + ['12191' ServerOnNetwork [simple uint 32 recordId] [simple PascalString serverName] [simple PascalString discoveryUrl] - [simple int 32 noOfServerCapabilities] + [implicit int 32 noOfServerCapabilities 'serverCapabilities == null ? -1 : COUNT(serverCapabilities)'] [array PascalString serverCapabilities count 'noOfServerCapabilities'] - ] - ['"12192"' FindServersOnNetworkRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['12192' FindServersOnNetworkRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 startingRecordId] [simple uint 32 maxRecordsToReturn] - [simple int 32 noOfServerCapabilityFilter] + [implicit int 32 noOfServerCapabilityFilter 'serverCapabilityFilter == null ? -1 : COUNT(serverCapabilityFilter)'] [array PascalString serverCapabilityFilter count 'noOfServerCapabilityFilter'] - ] - ['"12193"' FindServersOnNetworkResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['12193' FindServersOnNetworkResponse + [simple ResponseHeader('394') responseHeader] [simple int 64 lastCounterResetTime] - [simple int 32 noOfServers] - - [array ExtensionObjectDefinition('"12191"') servers count 'noOfServers'] - + [implicit int 32 noOfServers 'servers == null ? -1 : COUNT(servers)'] + [array ServerOnNetwork('12191') servers count 'noOfServers'] ] - ['"306"' UserTokenPolicy + ['306' UserTokenPolicy [simple PascalString policyId] [simple UserTokenType tokenType] [simple PascalString issuedTokenType] [simple PascalString issuerEndpointUrl] [simple PascalString securityPolicyUri] - ] - ['"314"' EndpointDescription + ['314' EndpointDescription [simple PascalString endpointUrl] - - [simple ExtensionObjectDefinition('"310"') server] + [simple ApplicationDescription('310') server] [simple PascalByteString serverCertificate] [simple MessageSecurityMode securityMode] [simple PascalString securityPolicyUri] - [simple int 32 noOfUserIdentityTokens] - - [array ExtensionObjectDefinition('"306"') userIdentityTokens count 'noOfUserIdentityTokens'] - [simple PascalString transportProfileUri] + [implicit int 32 noOfUserIdentityTokens 'userIdentityTokens == null ? -1 : COUNT(userIdentityTokens)'] + [array UserTokenPolicy('306') userIdentityTokens count 'noOfUserIdentityTokens'] + [simple PascalString transportProfileUri] [simple uint 8 securityLevel] - ] - ['"428"' GetEndpointsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['428' GetEndpointsRequest + [simple RequestHeader('391') requestHeader] [simple PascalString endpointUrl] - [simple int 32 noOfLocaleIds] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] [array PascalString localeIds count 'noOfLocaleIds'] - [simple int 32 noOfProfileUris] + [implicit int 32 noOfProfileUris 'profileUris == null ? -1 : COUNT(profileUris)'] [array PascalString profileUris count 'noOfProfileUris'] - ] - ['"431"' GetEndpointsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfEndpoints] - - [array ExtensionObjectDefinition('"314"') endpoints count 'noOfEndpoints'] - + ['431' GetEndpointsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfEndpoints 'endpoints == null ? -1 : COUNT(endpoints)'] + [array EndpointDescription('314') endpoints count 'noOfEndpoints'] ] - ['"434"' RegisteredServer + ['434' RegisteredServer [simple PascalString serverUri] [simple PascalString productUri] - [simple int 32 noOfServerNames] + [implicit int 32 noOfServerNames 'serverNames == null ? -1 : COUNT(serverNames)'] [array LocalizedText serverNames count 'noOfServerNames'] - [simple ApplicationType serverType] + [simple ApplicationType serverType] [simple PascalString gatewayServerUri] - [simple int 32 noOfDiscoveryUrls] + [implicit int 32 noOfDiscoveryUrls 'discoveryUrls == null ? -1 : COUNT(discoveryUrls)'] [array PascalString discoveryUrls count 'noOfDiscoveryUrls'] - [simple PascalString semaphoreFilePath] + [simple PascalString semaphoreFilePath] [reserved uint 7 '0x00'] [simple bit isOnline] ] - ['"437"' RegisterServerRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"434"') server] - + ['437' RegisterServerRequest + [simple RequestHeader('391') requestHeader] + [simple RegisteredServer('434') server] ] - ['"440"' RegisterServerResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - + ['440' RegisterServerResponse + [simple ResponseHeader('394') responseHeader] ] - ['"12892"' DiscoveryConfiguration + ['12892' DiscoveryConfiguration ] - ['"12195"' RegisterServer2Request - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"434"') server] - [simple int 32 noOfDiscoveryConfiguration] + ['12893' MdnsDiscoveryConfiguration + [simple PascalString mdnsServerName] + [implicit int 32 noOfServerCapabilities 'serverCapabilities == null ? -1 : COUNT(serverCapabilities)'] + [array PascalString serverCapabilities count 'noOfServerCapabilities'] + ] + ['12195' RegisterServer2Request + [simple RequestHeader('391') requestHeader] + [simple RegisteredServer('434') server] + [implicit int 32 noOfDiscoveryConfiguration 'discoveryConfiguration == null ? -1 : COUNT(discoveryConfiguration)'] [array ExtensionObject('true') discoveryConfiguration count 'noOfDiscoveryConfiguration'] - ] - ['"12196"' RegisterServer2Response - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfConfigurationResults] + ['12196' RegisterServer2Response + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfConfigurationResults 'configurationResults == null ? -1 : COUNT(configurationResults)'] [array StatusCode configurationResults count 'noOfConfigurationResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"443"' ChannelSecurityToken + ['443' ChannelSecurityToken [simple uint 32 channelId] [simple uint 32 tokenId] [simple int 64 createdAt] [simple uint 32 revisedLifetime] - ] - ['"446"' OpenSecureChannelRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['446' OpenSecureChannelRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 clientProtocolVersion] [simple SecurityTokenRequestType requestType] [simple MessageSecurityMode securityMode] [simple PascalByteString clientNonce] [simple uint 32 requestedLifetime] - ] - ['"449"' OpenSecureChannelResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['449' OpenSecureChannelResponse + [simple ResponseHeader('394') responseHeader] [simple uint 32 serverProtocolVersion] - - [simple ExtensionObjectDefinition('"443"') securityToken] + [simple ChannelSecurityToken('443') securityToken] [simple PascalByteString serverNonce] - ] - ['"452"' CloseSecureChannelRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - + ['452' CloseSecureChannelRequest + [simple RequestHeader('391') requestHeader] ] - ['"455"' CloseSecureChannelResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - + ['455' CloseSecureChannelResponse + [simple ResponseHeader('394') responseHeader] ] - ['"346"' SignedSoftwareCertificate + ['346' SignedSoftwareCertificate [simple PascalByteString certificateData] [simple PascalByteString signature] - ] - ['"458"' SignatureData + ['458' SignatureData [simple PascalString algorithm] [simple PascalByteString signature] - ] - ['"461"' CreateSessionRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"310"') clientDescription] + ['461' CreateSessionRequest + [simple RequestHeader('391') requestHeader] + [simple ApplicationDescription('310') clientDescription] [simple PascalString serverUri] [simple PascalString endpointUrl] [simple PascalString sessionName] @@ -820,90 +1041,191 @@ [simple PascalByteString clientCertificate] [simple float 64 requestedSessionTimeout] [simple uint 32 maxResponseMessageSize] - ] - ['"464"' CreateSessionResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['464' CreateSessionResponse + [simple ResponseHeader('394') responseHeader] [simple NodeId sessionId] [simple NodeId authenticationToken] [simple float 64 revisedSessionTimeout] [simple PascalByteString serverNonce] [simple PascalByteString serverCertificate] - [simple int 32 noOfServerEndpoints] - - [array ExtensionObjectDefinition('"314"') serverEndpoints count 'noOfServerEndpoints'] - [simple int 32 noOfServerSoftwareCertificates] - - [array ExtensionObjectDefinition('"346"') serverSoftwareCertificates count 'noOfServerSoftwareCertificates'] - - [simple ExtensionObjectDefinition('"458"') serverSignature] + [implicit int 32 noOfServerEndpoints 'serverEndpoints == null ? -1 : COUNT(serverEndpoints)'] + [array EndpointDescription('314') serverEndpoints count 'noOfServerEndpoints'] + [implicit int 32 noOfServerSoftwareCertificates 'serverSoftwareCertificates == null ? -1 : COUNT(serverSoftwareCertificates)'] + [array SignedSoftwareCertificate('346') serverSoftwareCertificates count 'noOfServerSoftwareCertificates'] + [simple SignatureData('458') serverSignature] [simple uint 32 maxRequestMessageSize] - ] - ['"467"' ActivateSessionRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"458"') clientSignature] - [simple int 32 noOfClientSoftwareCertificates] - - [array ExtensionObjectDefinition('"346"') clientSoftwareCertificates count 'noOfClientSoftwareCertificates'] - [simple int 32 noOfLocaleIds] + ['318' UserIdentityToken + [simple PascalString policyId] + ] + ['321' AnonymousIdentityToken + [simple PascalString policyId] + ] + ['324' UserNameIdentityToken + [simple PascalString policyId] + [simple PascalString userName] + [simple PascalByteString password] + [simple PascalString encryptionAlgorithm] + ] + ['327' X509IdentityToken + [simple PascalString policyId] + [simple PascalByteString certificateData] + ] + ['940' IssuedIdentityToken + [simple PascalString policyId] + [simple PascalByteString tokenData] + [simple PascalString encryptionAlgorithm] + ] + ['467' ActivateSessionRequest + [simple RequestHeader('391') requestHeader] + [simple SignatureData('458') clientSignature] + [implicit int 32 noOfClientSoftwareCertificates 'clientSoftwareCertificates == null ? -1 : COUNT(clientSoftwareCertificates)'] + [array SignedSoftwareCertificate('346') clientSoftwareCertificates count 'noOfClientSoftwareCertificates'] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] [array PascalString localeIds count 'noOfLocaleIds'] - [simple ExtensionObject('true') userIdentityToken] - - [simple ExtensionObjectDefinition('"458"') userTokenSignature] - + [simple ExtensionObject('true') userIdentityToken] + [simple SignatureData('458') userTokenSignature] ] - ['"470"' ActivateSessionResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['470' ActivateSessionResponse + [simple ResponseHeader('394') responseHeader] [simple PascalByteString serverNonce] - [simple int 32 noOfResults] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"473"' CloseSessionRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['473' CloseSessionRequest + [simple RequestHeader('391') requestHeader] [reserved uint 7 '0x00'] [simple bit deleteSubscriptions] ] - ['"476"' CloseSessionResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - + ['476' CloseSessionResponse + [simple ResponseHeader('394') responseHeader] ] - ['"479"' CancelRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['479' CancelRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 requestHandle] + ] + ['482' CancelResponse + [simple ResponseHeader('394') responseHeader] + [simple uint 32 cancelCount] + ] + ['351' NodeAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + ] + ['354' ObjectAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [simple uint 8 eventNotifier] + ] + ['357' VariableAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [simple Variant value] + [simple NodeId dataType] + [simple int 32 valueRank] + [implicit int 32 noOfArrayDimensions 'arrayDimensions == null ? -1 : COUNT(arrayDimensions)'] + [array uint 32 arrayDimensions count 'noOfArrayDimensions'] + [simple uint 8 accessLevel] + [simple uint 8 userAccessLevel] + [simple float 64 minimumSamplingInterval] + [reserved uint 7 '0x00'] + [simple bit historizing] ] - ['"482"' CancelResponse + ['360' MethodAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [reserved uint 6 '0x00'] + [simple bit userExecutable] + [simple bit executable] - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple uint 32 cancelCount] + ] + ['363' ObjectTypeAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [reserved uint 7 '0x00'] + [simple bit isAbstract] ] - ['"351"' NodeAttributes + ['366' VariableTypeAttributes [simple uint 32 specifiedAttributes] [simple LocalizedText displayName] [simple LocalizedText description] [simple uint 32 writeMask] [simple uint 32 userWriteMask] + [simple Variant value] + [simple NodeId dataType] + [simple int 32 valueRank] + [implicit int 32 noOfArrayDimensions 'arrayDimensions == null ? -1 : COUNT(arrayDimensions)'] + [array uint 32 arrayDimensions count 'noOfArrayDimensions'] + [reserved uint 7 '0x00'] + [simple bit isAbstract] ] - ['"17608"' GenericAttributeValue + ['369' ReferenceTypeAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [reserved uint 6 '0x00'] + [simple bit symmetric] + [simple bit isAbstract] + [simple LocalizedText inverseName] + ] + ['372' DataTypeAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [reserved uint 7 '0x00'] + [simple bit isAbstract] + + ] + ['375' ViewAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [reserved uint 7 '0x00'] + [simple bit containsNoLoops] + [simple uint 8 eventNotifier] + ] + ['17608' GenericAttributeValue [simple uint 32 attributeId] [simple Variant value] - ] - ['"378"' AddNodesItem + ['17609' GenericAttributes + [simple uint 32 specifiedAttributes] + [simple LocalizedText displayName] + [simple LocalizedText description] + [simple uint 32 writeMask] + [simple uint 32 userWriteMask] + [implicit int 32 noOfAttributeValues 'attributeValues == null ? -1 : COUNT(attributeValues)'] + [array GenericAttributeValue('17608') attributeValues count 'noOfAttributeValues'] + ] + ['378' AddNodesItem [simple ExpandedNodeId parentNodeId] [simple NodeId referenceTypeId] [simple ExpandedNodeId requestedNewNodeId] @@ -911,32 +1233,24 @@ [simple NodeClass nodeClass] [simple ExtensionObject('true') nodeAttributes] [simple ExpandedNodeId typeDefinition] - ] - ['"485"' AddNodesResult + ['485' AddNodesResult [simple StatusCode statusCode] [simple NodeId addedNodeId] - ] - ['"488"' AddNodesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfNodesToAdd] - - [array ExtensionObjectDefinition('"378"') nodesToAdd count 'noOfNodesToAdd'] - + ['488' AddNodesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfNodesToAdd 'nodesToAdd == null ? -1 : COUNT(nodesToAdd)'] + [array AddNodesItem('378') nodesToAdd count 'noOfNodesToAdd'] ] - ['"491"' AddNodesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"485"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + ['491' AddNodesResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array AddNodesResult('485') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"381"' AddReferencesItem + ['381' AddReferencesItem [simple NodeId sourceNodeId] [simple NodeId referenceTypeId] [reserved uint 7 '0x00'] @@ -944,49 +1258,38 @@ [simple PascalString targetServerUri] [simple ExpandedNodeId targetNodeId] [simple NodeClass targetNodeClass] - ] - ['"494"' AddReferencesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfReferencesToAdd] - - [array ExtensionObjectDefinition('"381"') referencesToAdd count 'noOfReferencesToAdd'] - + ['494' AddReferencesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfReferencesToAdd 'referencesToAdd == null ? -1 : COUNT(referencesToAdd)'] + [array AddReferencesItem('381') referencesToAdd count 'noOfReferencesToAdd'] ] - ['"497"' AddReferencesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['497' AddReferencesResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"384"' DeleteNodesItem + ['384' DeleteNodesItem [simple NodeId nodeId] [reserved uint 7 '0x00'] [simple bit deleteTargetReferences] ] - ['"500"' DeleteNodesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfNodesToDelete] - - [array ExtensionObjectDefinition('"384"') nodesToDelete count 'noOfNodesToDelete'] - + ['500' DeleteNodesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfNodesToDelete 'nodesToDelete == null ? -1 : COUNT(nodesToDelete)'] + [array DeleteNodesItem('384') nodesToDelete count 'noOfNodesToDelete'] ] - ['"503"' DeleteNodesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['503' DeleteNodesResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"387"' DeleteReferencesItem + ['387' DeleteReferencesItem [simple NodeId sourceNodeId] [simple NodeId referenceTypeId] [reserved uint 7 '0x00'] @@ -996,30 +1299,24 @@ [simple bit deleteBidirectional] ] - ['"506"' DeleteReferencesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfReferencesToDelete] - - [array ExtensionObjectDefinition('"387"') referencesToDelete count 'noOfReferencesToDelete'] - + ['506' DeleteReferencesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfReferencesToDelete 'referencesToDelete == null ? -1 : COUNT(referencesToDelete)'] + [array DeleteReferencesItem('387') referencesToDelete count 'noOfReferencesToDelete'] ] - ['"509"' DeleteReferencesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['509' DeleteReferencesResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"513"' ViewDescription + ['513' ViewDescription [simple NodeId viewId] [simple int 64 timestamp] [simple uint 32 viewVersion] - ] - ['"516"' BrowseDescription + ['516' BrowseDescription [simple NodeId nodeId] [simple BrowseDirection browseDirection] [simple NodeId referenceTypeId] @@ -1027,9 +1324,8 @@ [simple bit includeSubtypes] [simple uint 32 nodeClassMask] [simple uint 32 resultMask] - ] - ['"520"' ReferenceDescription + ['520' ReferenceDescription [simple NodeId referenceTypeId] [reserved uint 7 '0x00'] [simple bit isForward] @@ -1038,133 +1334,96 @@ [simple LocalizedText displayName] [simple NodeClass nodeClass] [simple ExpandedNodeId typeDefinition] - ] - ['"524"' BrowseResult + ['524' BrowseResult [simple StatusCode statusCode] [simple PascalByteString continuationPoint] - [simple int 32 noOfReferences] - - [array ExtensionObjectDefinition('"520"') references count 'noOfReferences'] - + [implicit int 32 noOfReferences 'references == null ? -1 : COUNT(references)'] + [array ReferenceDescription('520') references count 'noOfReferences'] ] - ['"527"' BrowseRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"513"') view] + ['527' BrowseRequest + [simple RequestHeader('391') requestHeader] + [simple ViewDescription('513') view] [simple uint 32 requestedMaxReferencesPerNode] - [simple int 32 noOfNodesToBrowse] - - [array ExtensionObjectDefinition('"516"') nodesToBrowse count 'noOfNodesToBrowse'] - - ] - ['"530"' BrowseResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"524"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfNodesToBrowse 'nodesToBrowse == null ? -1 : COUNT(nodesToBrowse)'] + [array BrowseDescription('516') nodesToBrowse count 'noOfNodesToBrowse'] + ] + ['530' BrowseResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array BrowseResult('524') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"533"' BrowseNextRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['533' BrowseNextRequest + [simple RequestHeader('391') requestHeader] [reserved uint 7 '0x00'] [simple bit releaseContinuationPoints] - [simple int 32 noOfContinuationPoints] + [implicit int 32 noOfContinuationPoints 'continuationPoints == null ? -1 : COUNT(continuationPoints)'] [array PascalByteString continuationPoints count 'noOfContinuationPoints'] - ] - ['"536"' BrowseNextResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"524"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + ['536' BrowseNextResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array BrowseResult('524') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"539"' RelativePathElement + ['539' RelativePathElement [simple NodeId referenceTypeId] [reserved uint 6 '0x00'] [simple bit includeSubtypes] [simple bit isInverse] [simple QualifiedName targetName] - ] - ['"542"' RelativePath - [simple int 32 noOfElements] - - [array ExtensionObjectDefinition('"539"') elements count 'noOfElements'] - + ['542' RelativePath + [implicit int 32 noOfElements 'elements == null ? -1 : COUNT(elements)'] + [array RelativePathElement('539') elements count 'noOfElements'] ] - ['"545"' BrowsePath + ['545' BrowsePath [simple NodeId startingNode] - - [simple ExtensionObjectDefinition('"542"') relativePath] - + [simple RelativePath('542') relativePath] ] - ['"548"' BrowsePathTarget + ['548' BrowsePathTarget [simple ExpandedNodeId targetId] [simple uint 32 remainingPathIndex] - ] - ['"551"' BrowsePathResult + ['551' BrowsePathResult [simple StatusCode statusCode] - [simple int 32 noOfTargets] - - [array ExtensionObjectDefinition('"548"') targets count 'noOfTargets'] - - ] - ['"554"' TranslateBrowsePathsToNodeIdsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfBrowsePaths] - - [array ExtensionObjectDefinition('"545"') browsePaths count 'noOfBrowsePaths'] - - ] - ['"557"' TranslateBrowsePathsToNodeIdsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"551"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfTargets 'targets == null ? -1 : COUNT(targets)'] + [array BrowsePathTarget('548') targets count 'noOfTargets'] + ] + ['554' TranslateBrowsePathsToNodeIdsRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfBrowsePaths 'browsePaths == null ? -1 : COUNT(browsePaths)'] + [array BrowsePath('545') browsePaths count 'noOfBrowsePaths'] + ] + ['557' TranslateBrowsePathsToNodeIdsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array BrowsePathResult('551') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"560"' RegisterNodesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfNodesToRegister] + ['560' RegisterNodesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfNodesToRegister 'nodesToRegister == null ? -1 : COUNT(nodesToRegister)'] [array NodeId nodesToRegister count 'noOfNodesToRegister'] - ] - ['"563"' RegisterNodesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfRegisteredNodeIds] + ['563' RegisterNodesResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfRegisteredNodeIds 'registeredNodeIds == null ? -1 : COUNT(registeredNodeIds)'] [array NodeId registeredNodeIds count 'noOfRegisteredNodeIds'] - ] - ['"566"' UnregisterNodesRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfNodesToUnregister] + ['566' UnregisterNodesRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfNodesToUnregister 'nodesToUnregister == null ? -1 : COUNT(nodesToUnregister)'] [array NodeId nodesToUnregister count 'noOfNodesToUnregister'] - ] - ['"569"' UnregisterNodesResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - + ['569' UnregisterNodesResponse + [simple ResponseHeader('394') responseHeader] ] - ['"333"' EndpointConfiguration + ['333' EndpointConfiguration [simple int 32 operationTimeout] [reserved uint 7 '0x00'] [simple bit useBinaryEncoding] @@ -1175,298 +1434,353 @@ [simple int 32 maxBufferSize] [simple int 32 channelLifetime] [simple int 32 securityTokenLifetime] - ] - ['"572"' QueryDataDescription - - [simple ExtensionObjectDefinition('"542"') relativePath] + ['572' QueryDataDescription + [simple RelativePath('542') relativePath] [simple uint 32 attributeId] [simple PascalString indexRange] - ] - ['"575"' NodeTypeDescription + ['575' NodeTypeDescription [simple ExpandedNodeId typeDefinitionNode] [reserved uint 7 '0x00'] [simple bit includeSubTypes] - [simple int 32 noOfDataToReturn] - - [array ExtensionObjectDefinition('"572"') dataToReturn count 'noOfDataToReturn'] - + [implicit int 32 noOfDataToReturn 'dataToReturn == null ? -1 : COUNT(dataToReturn)'] + [array QueryDataDescription('572') dataToReturn count 'noOfDataToReturn'] ] - ['"579"' QueryDataSet + ['579' QueryDataSet [simple ExpandedNodeId nodeId] [simple ExpandedNodeId typeDefinitionNode] - [simple int 32 noOfValues] + [implicit int 32 noOfValues 'values == null ? -1 : COUNT(values)'] [array Variant values count 'noOfValues'] - ] - ['"582"' NodeReference + ['582' NodeReference [simple NodeId nodeId] [simple NodeId referenceTypeId] [reserved uint 7 '0x00'] [simple bit isForward] - [simple int 32 noOfReferencedNodeIds] + [implicit int 32 noOfReferencedNodeIds 'referencedNodeIds == null ? -1 : COUNT(referencedNodeIds)'] [array NodeId referencedNodeIds count 'noOfReferencedNodeIds'] - ] - ['"585"' ContentFilterElement + ['585' ContentFilterElement [simple FilterOperator filterOperator] - [simple int 32 noOfFilterOperands] + [implicit int 32 noOfFilterOperands 'filterOperands == null ? -1 : COUNT(filterOperands)'] [array ExtensionObject('true') filterOperands count 'noOfFilterOperands'] - ] - ['"588"' ContentFilter - [simple int 32 noOfElements] - - [array ExtensionObjectDefinition('"585"') elements count 'noOfElements'] - + ['588' ContentFilter + [implicit int 32 noOfElements 'elements == null ? -1 : COUNT(elements)'] + [array ContentFilterElement('585') elements count 'noOfElements'] ] - ['"591"' FilterOperand + ['591' FilterOperand ] - ['"606"' ContentFilterElementResult + ['594' ElementOperand + [simple uint 32 index] + ] + ['597' LiteralOperand + [simple Variant value] + ] + ['600' AttributeOperand + [simple NodeId nodeId] + [simple PascalString alias] + [simple RelativePath('542') browsePath] + [simple uint 32 attributeId] + [simple PascalString indexRange] + ] + ['603' SimpleAttributeOperand + [simple NodeId typeDefinitionId] + [implicit int 32 noOfBrowsePath 'browsePath == null ? -1 : COUNT(browsePath)'] + [array QualifiedName browsePath count 'noOfBrowsePath'] + [simple uint 32 attributeId] + [simple PascalString indexRange] + ] + ['606' ContentFilterElementResult [simple StatusCode statusCode] - [simple int 32 noOfOperandStatusCodes] + [implicit int 32 noOfOperandStatusCodes 'operandStatusCodes == null ? -1 : COUNT(operandStatusCodes)'] [array StatusCode operandStatusCodes count 'noOfOperandStatusCodes'] - [simple int 32 noOfOperandDiagnosticInfos] + [implicit int 32 noOfOperandDiagnosticInfos 'operandDiagnosticInfos == null ? -1 : COUNT(operandDiagnosticInfos)'] [array DiagnosticInfo operandDiagnosticInfos count 'noOfOperandDiagnosticInfos'] - ] - ['"609"' ContentFilterResult - [simple int 32 noOfElementResults] - - [array ExtensionObjectDefinition('"606"') elementResults count 'noOfElementResults'] - [simple int 32 noOfElementDiagnosticInfos] + ['609' ContentFilterResult + [implicit int 32 noOfElementResults 'elementResults == null ? -1 : COUNT(elementResults)'] + [array ContentFilterElementResult('606') elementResults count 'noOfElementResults'] + [implicit int 32 noOfElementDiagnosticInfos 'elementDiagnosticInfos == null ? -1 : COUNT(elementDiagnosticInfos)'] [array DiagnosticInfo elementDiagnosticInfos count 'noOfElementDiagnosticInfos'] - ] - ['"612"' ParsingResult + ['612' ParsingResult [simple StatusCode statusCode] - [simple int 32 noOfDataStatusCodes] + [implicit int 32 noOfDataStatusCodes 'dataStatusCodes == null ? -1 : COUNT(dataStatusCodes)'] [array StatusCode dataStatusCodes count 'noOfDataStatusCodes'] - [simple int 32 noOfDataDiagnosticInfos] + [implicit int 32 noOfDataDiagnosticInfos 'dataDiagnosticInfos == null ? -1 : COUNT(dataDiagnosticInfos)'] [array DiagnosticInfo dataDiagnosticInfos count 'noOfDataDiagnosticInfos'] - ] - ['"615"' QueryFirstRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - - [simple ExtensionObjectDefinition('"513"') view] - [simple int 32 noOfNodeTypes] - - [array ExtensionObjectDefinition('"575"') nodeTypes count 'noOfNodeTypes'] - - [simple ExtensionObjectDefinition('"588"') filter] + ['615' QueryFirstRequest + [simple RequestHeader('391') requestHeader] + [simple ViewDescription('513') view] + [implicit int 32 noOfNodeTypes 'nodeTypes == null ? -1 : COUNT(nodeTypes)'] + [array NodeTypeDescription('575') nodeTypes count 'noOfNodeTypes'] + [simple ContentFilter('588') filter] [simple uint 32 maxDataSetsToReturn] [simple uint 32 maxReferencesToReturn] - ] - ['"618"' QueryFirstResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfQueryDataSets] - - [array ExtensionObjectDefinition('"579"') queryDataSets count 'noOfQueryDataSets'] - [simple PascalByteString continuationPoint] - [simple int 32 noOfParsingResults] - - [array ExtensionObjectDefinition('"612"') parsingResults count 'noOfParsingResults'] - [simple int 32 noOfDiagnosticInfos] + ['618' QueryFirstResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfQueryDataSets 'queryDataSets == null ? -1 : COUNT(queryDataSets)'] + [array QueryDataSet('579') queryDataSets count 'noOfQueryDataSets'] + [simple PascalByteString continuationPoint] + [implicit int 32 noOfParsingResults 'parsingResults == null ? -1 : COUNT(parsingResults)'] + [array ParsingResult('612') parsingResults count 'noOfParsingResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - - [simple ExtensionObjectDefinition('"609"') filterResult] - + [simple ContentFilterResult('609') filterResult] ] - ['"621"' QueryNextRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['621' QueryNextRequest + [simple RequestHeader('391') requestHeader] [reserved uint 7 '0x00'] [simple bit releaseContinuationPoint] [simple PascalByteString continuationPoint] - ] - ['"624"' QueryNextResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfQueryDataSets] - - [array ExtensionObjectDefinition('"579"') queryDataSets count 'noOfQueryDataSets'] - [simple PascalByteString revisedContinuationPoint] - + ['624' QueryNextResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfQueryDataSets 'queryDataSets == null ? -1 : COUNT(queryDataSets)'] + [array QueryDataSet('579') queryDataSets count 'noOfQueryDataSets'] + [simple PascalByteString revisedContinuationPoint] ] - ['"628"' ReadValueId + ['628' ReadValueId [simple NodeId nodeId] [simple uint 32 attributeId] [simple PascalString indexRange] [simple QualifiedName dataEncoding] - ] - ['"631"' ReadRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['631' ReadRequest + [simple RequestHeader('391') requestHeader] [simple float 64 maxAge] [simple TimestampsToReturn timestampsToReturn] - [simple int 32 noOfNodesToRead] - - [array ExtensionObjectDefinition('"628"') nodesToRead count 'noOfNodesToRead'] - + [implicit int 32 noOfNodesToRead 'nodesToRead == null ? -1 : COUNT(nodesToRead)'] + [array ReadValueId('628') nodesToRead count 'noOfNodesToRead'] ] - ['"634"' ReadResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['634' ReadResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array DataValue results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"637"' HistoryReadValueId + ['637' HistoryReadValueId [simple NodeId nodeId] [simple PascalString indexRange] [simple QualifiedName dataEncoding] [simple PascalByteString continuationPoint] - ] - ['"640"' HistoryReadResult + ['640' HistoryReadResult [simple StatusCode statusCode] [simple PascalByteString continuationPoint] [simple ExtensionObject('true') historyData] + ] + ['643' HistoryReadDetails + + ] + ['646' ReadEventDetails + [simple uint 32 numValuesPerNode] + [simple int 64 startTime] + [simple int 64 endTime] + [simple EventFilter('727') filter] + ] + ['32801' ReadEventDetails2 + [simple uint 32 numValuesPerNode] + [simple int 64 startTime] + [simple int 64 endTime] + [simple EventFilter('727') filter] + [reserved uint 7 '0x00'] + [simple bit readModified] + + ] + ['649' ReadRawModifiedDetails + [reserved uint 7 '0x00'] + [simple bit isReadModified] + [simple int 64 startTime] + [simple int 64 endTime] + [simple uint 32 numValuesPerNode] + [reserved uint 7 '0x00'] + [simple bit returnBounds] ] - ['"643"' HistoryReadDetails + ['652' ReadProcessedDetails + [simple int 64 startTime] + [simple int 64 endTime] + [simple float 64 processingInterval] + [implicit int 32 noOfAggregateType 'aggregateType == null ? -1 : COUNT(aggregateType)'] + [array NodeId aggregateType count 'noOfAggregateType'] + [simple AggregateConfiguration('950') aggregateConfiguration] + ] + ['655' ReadAtTimeDetails + [implicit int 32 noOfReqTimes 'reqTimes == null ? -1 : COUNT(reqTimes)'] + [array int 64 reqTimes count 'noOfReqTimes'] + [reserved uint 7 '0x00'] + [simple bit useSimpleBounds] ] - ['"658"' HistoryData - [simple int 32 noOfDataValues] + ['23499' ReadAnnotationDataDetails + [implicit int 32 noOfReqTimes 'reqTimes == null ? -1 : COUNT(reqTimes)'] + [array int 64 reqTimes count 'noOfReqTimes'] + ] + ['658' HistoryData + [implicit int 32 noOfDataValues 'dataValues == null ? -1 : COUNT(dataValues)'] [array DataValue dataValues count 'noOfDataValues'] - ] - ['"11218"' ModificationInfo + ['11218' ModificationInfo [simple int 64 modificationTime] [simple HistoryUpdateType updateType] [simple PascalString userName] - ] - ['"661"' HistoryEvent - [simple int 32 noOfEvents] - - [array ExtensionObjectDefinition('"922"') events count 'noOfEvents'] - + ['11219' HistoryModifiedData + [implicit int 32 noOfDataValues 'dataValues == null ? -1 : COUNT(dataValues)'] + [array DataValue dataValues count 'noOfDataValues'] + [implicit int 32 noOfModificationInfos 'modificationInfos == null ? -1 : COUNT(modificationInfos)'] + [array ModificationInfo('11218') modificationInfos count 'noOfModificationInfos'] ] - ['"664"' HistoryReadRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['661' HistoryEvent + [implicit int 32 noOfEvents 'events == null ? -1 : COUNT(events)'] + [array HistoryEventFieldList('922') events count 'noOfEvents'] + ] + ['32826' HistoryModifiedEvent + [implicit int 32 noOfEvents 'events == null ? -1 : COUNT(events)'] + [array HistoryEventFieldList('922') events count 'noOfEvents'] + [implicit int 32 noOfModificationInfos 'modificationInfos == null ? -1 : COUNT(modificationInfos)'] + [array ModificationInfo('11218') modificationInfos count 'noOfModificationInfos'] + ] + ['664' HistoryReadRequest + [simple RequestHeader('391') requestHeader] [simple ExtensionObject('true') historyReadDetails] [simple TimestampsToReturn timestampsToReturn] [reserved uint 7 '0x00'] [simple bit releaseContinuationPoints] - [simple int 32 noOfNodesToRead] - - [array ExtensionObjectDefinition('"637"') nodesToRead count 'noOfNodesToRead'] - - ] - ['"667"' HistoryReadResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"640"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfNodesToRead 'nodesToRead == null ? -1 : COUNT(nodesToRead)'] + [array HistoryReadValueId('637') nodesToRead count 'noOfNodesToRead'] + ] + ['667' HistoryReadResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array HistoryReadResult('640') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"670"' WriteValue + ['670' WriteValue [simple NodeId nodeId] [simple uint 32 attributeId] [simple PascalString indexRange] [simple DataValue value] - ] - ['"673"' WriteRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfNodesToWrite] - - [array ExtensionObjectDefinition('"670"') nodesToWrite count 'noOfNodesToWrite'] - + ['673' WriteRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfNodesToWrite 'nodesToWrite == null ? -1 : COUNT(nodesToWrite)'] + [array WriteValue('670') nodesToWrite count 'noOfNodesToWrite'] ] - ['"676"' WriteResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['676' WriteResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"679"' HistoryUpdateDetails + ['679' HistoryUpdateDetails ] - ['"697"' HistoryUpdateResult + ['682' UpdateDataDetails + [simple NodeId nodeId] + [simple PerformUpdateType performInsertReplace] + [implicit int 32 noOfUpdateValues 'updateValues == null ? -1 : COUNT(updateValues)'] + [array DataValue updateValues count 'noOfUpdateValues'] + ] + ['11297' UpdateStructureDataDetails + [simple NodeId nodeId] + [simple PerformUpdateType performInsertReplace] + [implicit int 32 noOfUpdateValues 'updateValues == null ? -1 : COUNT(updateValues)'] + [array DataValue updateValues count 'noOfUpdateValues'] + ] + ['685' UpdateEventDetails + [simple NodeId nodeId] + [simple PerformUpdateType performInsertReplace] + [simple EventFilter('727') filter] + [implicit int 32 noOfEventData 'eventData == null ? -1 : COUNT(eventData)'] + [array HistoryEventFieldList('922') eventData count 'noOfEventData'] + ] + ['688' DeleteRawModifiedDetails + [simple NodeId nodeId] + [reserved uint 7 '0x00'] + [simple bit isDeleteModified] + [simple int 64 startTime] + [simple int 64 endTime] + ] + ['691' DeleteAtTimeDetails + [simple NodeId nodeId] + [implicit int 32 noOfReqTimes 'reqTimes == null ? -1 : COUNT(reqTimes)'] + [array int 64 reqTimes count 'noOfReqTimes'] + ] + ['694' DeleteEventDetails + [simple NodeId nodeId] + [implicit int 32 noOfEventIds 'eventIds == null ? -1 : COUNT(eventIds)'] + [array PascalByteString eventIds count 'noOfEventIds'] + ] + ['697' HistoryUpdateResult [simple StatusCode statusCode] - [simple int 32 noOfOperationResults] + [implicit int 32 noOfOperationResults 'operationResults == null ? -1 : COUNT(operationResults)'] [array StatusCode operationResults count 'noOfOperationResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"700"' HistoryUpdateRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfHistoryUpdateDetails] + ['700' HistoryUpdateRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfHistoryUpdateDetails 'historyUpdateDetails == null ? -1 : COUNT(historyUpdateDetails)'] [array ExtensionObject('true') historyUpdateDetails count 'noOfHistoryUpdateDetails'] - ] - ['"703"' HistoryUpdateResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"697"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + ['703' HistoryUpdateResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array HistoryUpdateResult('697') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"706"' CallMethodRequest + ['706' CallMethodRequest [simple NodeId objectId] [simple NodeId methodId] - [simple int 32 noOfInputArguments] + [implicit int 32 noOfInputArguments 'inputArguments == null ? -1 : COUNT(inputArguments)'] [array Variant inputArguments count 'noOfInputArguments'] - ] - ['"709"' CallMethodResult + ['709' CallMethodResult [simple StatusCode statusCode] - [simple int 32 noOfInputArgumentResults] + [implicit int 32 noOfInputArgumentResults 'inputArgumentResults == null ? -1 : COUNT(inputArgumentResults)'] [array StatusCode inputArgumentResults count 'noOfInputArgumentResults'] - [simple int 32 noOfInputArgumentDiagnosticInfos] + [implicit int 32 noOfInputArgumentDiagnosticInfos 'inputArgumentDiagnosticInfos == null ? -1 : COUNT(inputArgumentDiagnosticInfos)'] [array DiagnosticInfo inputArgumentDiagnosticInfos count 'noOfInputArgumentDiagnosticInfos'] - [simple int 32 noOfOutputArguments] + [implicit int 32 noOfOutputArguments 'outputArguments == null ? -1 : COUNT(outputArguments)'] [array Variant outputArguments count 'noOfOutputArguments'] - ] - ['"712"' CallRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfMethodsToCall] - - [array ExtensionObjectDefinition('"706"') methodsToCall count 'noOfMethodsToCall'] - + ['712' CallRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfMethodsToCall 'methodsToCall == null ? -1 : COUNT(methodsToCall)'] + [array CallMethodRequest('706') methodsToCall count 'noOfMethodsToCall'] ] - ['"715"' CallResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"709"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + ['715' CallResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array CallMethodResult('709') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"721"' MonitoringFilter + ['721' MonitoringFilter ] - ['"950"' AggregateConfiguration + ['724' DataChangeFilter + [simple DataChangeTrigger trigger] + [simple uint 32 deadbandType] + [simple float 64 deadbandValue] + ] + ['727' EventFilter + [implicit int 32 noOfSelectClauses 'selectClauses == null ? -1 : COUNT(selectClauses)'] + [array SimpleAttributeOperand('603') selectClauses count 'noOfSelectClauses'] + [simple ContentFilter('588') whereClause] + ] + ['950' AggregateConfiguration [reserved uint 6 '0x00'] [simple bit treatUncertainAsBad] [simple bit useServerCapabilitiesDefaults] @@ -1476,10 +1790,28 @@ [simple bit useSlopedExtrapolation] ] - ['"733"' MonitoringFilterResult + ['730' AggregateFilter + [simple int 64 startTime] + [simple NodeId aggregateType] + [simple float 64 processingInterval] + [simple AggregateConfiguration('950') aggregateConfiguration] + ] + ['733' MonitoringFilterResult ] - ['"742"' MonitoringParameters + ['736' EventFilterResult + [implicit int 32 noOfSelectClauseResults 'selectClauseResults == null ? -1 : COUNT(selectClauseResults)'] + [array StatusCode selectClauseResults count 'noOfSelectClauseResults'] + [implicit int 32 noOfSelectClauseDiagnosticInfos 'selectClauseDiagnosticInfos == null ? -1 : COUNT(selectClauseDiagnosticInfos)'] + [array DiagnosticInfo selectClauseDiagnosticInfos count 'noOfSelectClauseDiagnosticInfos'] + [simple ContentFilterResult('609') whereClauseResult] + ] + ['739' AggregateFilterResult + [simple int 64 revisedStartTime] + [simple float 64 revisedProcessingInterval] + [simple AggregateConfiguration('950') revisedAggregateConfiguration] + ] + ['742' MonitoringParameters [simple uint 32 clientHandle] [simple float 64 samplingInterval] [simple ExtensionObject('true') filter] @@ -1488,137 +1820,105 @@ [simple bit discardOldest] ] - ['"745"' MonitoredItemCreateRequest - - [simple ExtensionObjectDefinition('"628"') itemToMonitor] + ['745' MonitoredItemCreateRequest + [simple ReadValueId('628') itemToMonitor] [simple MonitoringMode monitoringMode] - - [simple ExtensionObjectDefinition('"742"') requestedParameters] - + [simple MonitoringParameters('742') requestedParameters] ] - ['"748"' MonitoredItemCreateResult + ['748' MonitoredItemCreateResult [simple StatusCode statusCode] [simple uint 32 monitoredItemId] [simple float 64 revisedSamplingInterval] [simple uint 32 revisedQueueSize] [simple ExtensionObject('true') filterResult] - ] - ['"751"' CreateMonitoredItemsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['751' CreateMonitoredItemsRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple TimestampsToReturn timestampsToReturn] - [simple int 32 noOfItemsToCreate] - - [array ExtensionObjectDefinition('"745"') itemsToCreate count 'noOfItemsToCreate'] - - ] - ['"754"' CreateMonitoredItemsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"748"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfItemsToCreate 'itemsToCreate == null ? -1 : COUNT(itemsToCreate)'] + [array MonitoredItemCreateRequest('745') itemsToCreate count 'noOfItemsToCreate'] + ] + ['754' CreateMonitoredItemsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array MonitoredItemCreateResult('748') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"757"' MonitoredItemModifyRequest + ['757' MonitoredItemModifyRequest [simple uint 32 monitoredItemId] - - [simple ExtensionObjectDefinition('"742"') requestedParameters] - + [simple MonitoringParameters('742') requestedParameters] ] - ['"760"' MonitoredItemModifyResult + ['760' MonitoredItemModifyResult [simple StatusCode statusCode] [simple float 64 revisedSamplingInterval] [simple uint 32 revisedQueueSize] [simple ExtensionObject('true') filterResult] - ] - ['"763"' ModifyMonitoredItemsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['763' ModifyMonitoredItemsRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple TimestampsToReturn timestampsToReturn] - [simple int 32 noOfItemsToModify] - - [array ExtensionObjectDefinition('"757"') itemsToModify count 'noOfItemsToModify'] - - ] - ['"766"' ModifyMonitoredItemsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"760"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfItemsToModify 'itemsToModify == null ? -1 : COUNT(itemsToModify)'] + [array MonitoredItemModifyRequest('757') itemsToModify count 'noOfItemsToModify'] + ] + ['766' ModifyMonitoredItemsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array MonitoredItemModifyResult('760') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"769"' SetMonitoringModeRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['769' SetMonitoringModeRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple MonitoringMode monitoringMode] - [simple int 32 noOfMonitoredItemIds] + [implicit int 32 noOfMonitoredItemIds 'monitoredItemIds == null ? -1 : COUNT(monitoredItemIds)'] [array uint 32 monitoredItemIds count 'noOfMonitoredItemIds'] - ] - ['"772"' SetMonitoringModeResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['772' SetMonitoringModeResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"775"' SetTriggeringRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['775' SetTriggeringRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple uint 32 triggeringItemId] - [simple int 32 noOfLinksToAdd] + [implicit int 32 noOfLinksToAdd 'linksToAdd == null ? -1 : COUNT(linksToAdd)'] [array uint 32 linksToAdd count 'noOfLinksToAdd'] - [simple int 32 noOfLinksToRemove] + [implicit int 32 noOfLinksToRemove 'linksToRemove == null ? -1 : COUNT(linksToRemove)'] [array uint 32 linksToRemove count 'noOfLinksToRemove'] - ] - ['"778"' SetTriggeringResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfAddResults] + ['778' SetTriggeringResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfAddResults 'addResults == null ? -1 : COUNT(addResults)'] [array StatusCode addResults count 'noOfAddResults'] - [simple int 32 noOfAddDiagnosticInfos] + [implicit int 32 noOfAddDiagnosticInfos 'addDiagnosticInfos == null ? -1 : COUNT(addDiagnosticInfos)'] [array DiagnosticInfo addDiagnosticInfos count 'noOfAddDiagnosticInfos'] - [simple int 32 noOfRemoveResults] + [implicit int 32 noOfRemoveResults 'removeResults == null ? -1 : COUNT(removeResults)'] [array StatusCode removeResults count 'noOfRemoveResults'] - [simple int 32 noOfRemoveDiagnosticInfos] + [implicit int 32 noOfRemoveDiagnosticInfos 'removeDiagnosticInfos == null ? -1 : COUNT(removeDiagnosticInfos)'] [array DiagnosticInfo removeDiagnosticInfos count 'noOfRemoveDiagnosticInfos'] - ] - ['"781"' DeleteMonitoredItemsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['781' DeleteMonitoredItemsRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] - [simple int 32 noOfMonitoredItemIds] + [implicit int 32 noOfMonitoredItemIds 'monitoredItemIds == null ? -1 : COUNT(monitoredItemIds)'] [array uint 32 monitoredItemIds count 'noOfMonitoredItemIds'] - ] - ['"784"' DeleteMonitoredItemsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['784' DeleteMonitoredItemsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"787"' CreateSubscriptionRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['787' CreateSubscriptionRequest + [simple RequestHeader('391') requestHeader] [simple float 64 requestedPublishingInterval] [simple uint 32 requestedLifetimeCount] [simple uint 32 requestedMaxKeepAliveCount] @@ -1626,199 +1926,171 @@ [reserved uint 7 '0x00'] [simple bit publishingEnabled] [simple uint 8 priority] - ] - ['"790"' CreateSubscriptionResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['790' CreateSubscriptionResponse + [simple ResponseHeader('394') responseHeader] [simple uint 32 subscriptionId] [simple float 64 revisedPublishingInterval] [simple uint 32 revisedLifetimeCount] [simple uint 32 revisedMaxKeepAliveCount] - ] - ['"793"' ModifySubscriptionRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['793' ModifySubscriptionRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple float 64 requestedPublishingInterval] [simple uint 32 requestedLifetimeCount] [simple uint 32 requestedMaxKeepAliveCount] [simple uint 32 maxNotificationsPerPublish] [simple uint 8 priority] - ] - ['"796"' ModifySubscriptionResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['796' ModifySubscriptionResponse + [simple ResponseHeader('394') responseHeader] [simple float 64 revisedPublishingInterval] [simple uint 32 revisedLifetimeCount] [simple uint 32 revisedMaxKeepAliveCount] - ] - ['"799"' SetPublishingModeRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['799' SetPublishingModeRequest + [simple RequestHeader('391') requestHeader] [reserved uint 7 '0x00'] [simple bit publishingEnabled] - [simple int 32 noOfSubscriptionIds] + [implicit int 32 noOfSubscriptionIds 'subscriptionIds == null ? -1 : COUNT(subscriptionIds)'] [array uint 32 subscriptionIds count 'noOfSubscriptionIds'] - ] - ['"802"' SetPublishingModeResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['802' SetPublishingModeResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"805"' NotificationMessage + ['805' NotificationMessage [simple uint 32 sequenceNumber] [simple int 64 publishTime] - [simple int 32 noOfNotificationData] + [implicit int 32 noOfNotificationData 'notificationData == null ? -1 : COUNT(notificationData)'] [array ExtensionObject('true') notificationData count 'noOfNotificationData'] - ] - ['"947"' NotificationData + ['947' NotificationData ] - ['"808"' MonitoredItemNotification + ['811' DataChangeNotification + [implicit int 32 noOfMonitoredItems 'monitoredItems == null ? -1 : COUNT(monitoredItems)'] + [array MonitoredItemNotification('808') monitoredItems count 'noOfMonitoredItems'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] + [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] + ] + ['808' MonitoredItemNotification [simple uint 32 clientHandle] [simple DataValue value] - ] - ['"919"' EventFieldList + ['916' EventNotificationList + [implicit int 32 noOfEvents 'events == null ? -1 : COUNT(events)'] + [array EventFieldList('919') events count 'noOfEvents'] + ] + ['919' EventFieldList [simple uint 32 clientHandle] - [simple int 32 noOfEventFields] + [implicit int 32 noOfEventFields 'eventFields == null ? -1 : COUNT(eventFields)'] [array Variant eventFields count 'noOfEventFields'] - ] - ['"922"' HistoryEventFieldList - [simple int 32 noOfEventFields] + ['922' HistoryEventFieldList + [implicit int 32 noOfEventFields 'eventFields == null ? -1 : COUNT(eventFields)'] [array Variant eventFields count 'noOfEventFields'] - ] - ['"823"' SubscriptionAcknowledgement + ['820' StatusChangeNotification + [simple StatusCode status] + [simple DiagnosticInfo diagnosticInfo] + ] + ['823' SubscriptionAcknowledgement [simple uint 32 subscriptionId] [simple uint 32 sequenceNumber] - ] - ['"826"' PublishRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfSubscriptionAcknowledgements] - - [array ExtensionObjectDefinition('"823"') subscriptionAcknowledgements count 'noOfSubscriptionAcknowledgements'] - + ['826' PublishRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfSubscriptionAcknowledgements 'subscriptionAcknowledgements == null ? -1 : COUNT(subscriptionAcknowledgements)'] + [array SubscriptionAcknowledgement('823') subscriptionAcknowledgements count 'noOfSubscriptionAcknowledgements'] ] - ['"829"' PublishResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] + ['829' PublishResponse + [simple ResponseHeader('394') responseHeader] [simple uint 32 subscriptionId] - [simple int 32 noOfAvailableSequenceNumbers] + [implicit int 32 noOfAvailableSequenceNumbers 'availableSequenceNumbers == null ? -1 : COUNT(availableSequenceNumbers)'] [array uint 32 availableSequenceNumbers count 'noOfAvailableSequenceNumbers'] - [reserved uint 7 '0x00'] + [reserved uint 7 '0x00'] [simple bit moreNotifications] - - [simple ExtensionObjectDefinition('"805"') notificationMessage] - [simple int 32 noOfResults] + [simple NotificationMessage('805') notificationMessage] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"832"' RepublishRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] + ['832' RepublishRequest + [simple RequestHeader('391') requestHeader] [simple uint 32 subscriptionId] [simple uint 32 retransmitSequenceNumber] - ] - ['"835"' RepublishResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - - [simple ExtensionObjectDefinition('"805"') notificationMessage] - + ['835' RepublishResponse + [simple ResponseHeader('394') responseHeader] + [simple NotificationMessage('805') notificationMessage] ] - ['"838"' TransferResult + ['838' TransferResult [simple StatusCode statusCode] - [simple int 32 noOfAvailableSequenceNumbers] + [implicit int 32 noOfAvailableSequenceNumbers 'availableSequenceNumbers == null ? -1 : COUNT(availableSequenceNumbers)'] [array uint 32 availableSequenceNumbers count 'noOfAvailableSequenceNumbers'] - ] - ['"841"' TransferSubscriptionsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfSubscriptionIds] + ['841' TransferSubscriptionsRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfSubscriptionIds 'subscriptionIds == null ? -1 : COUNT(subscriptionIds)'] [array uint 32 subscriptionIds count 'noOfSubscriptionIds'] - [reserved uint 7 '0x00'] + [reserved uint 7 '0x00'] [simple bit sendInitialValues] ] - ['"844"' TransferSubscriptionsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] - - [array ExtensionObjectDefinition('"838"') results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + ['844' TransferSubscriptionsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] + [array TransferResult('838') results count 'noOfResults'] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"847"' DeleteSubscriptionsRequest - - [simple ExtensionObjectDefinition('"391"') requestHeader] - [simple int 32 noOfSubscriptionIds] + ['847' DeleteSubscriptionsRequest + [simple RequestHeader('391') requestHeader] + [implicit int 32 noOfSubscriptionIds 'subscriptionIds == null ? -1 : COUNT(subscriptionIds)'] [array uint 32 subscriptionIds count 'noOfSubscriptionIds'] - ] - ['"850"' DeleteSubscriptionsResponse - - [simple ExtensionObjectDefinition('"394"') responseHeader] - [simple int 32 noOfResults] + ['850' DeleteSubscriptionsResponse + [simple ResponseHeader('394') responseHeader] + [implicit int 32 noOfResults 'results == null ? -1 : COUNT(results)'] [array StatusCode results count 'noOfResults'] - [simple int 32 noOfDiagnosticInfos] + [implicit int 32 noOfDiagnosticInfos 'diagnosticInfos == null ? -1 : COUNT(diagnosticInfos)'] [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"340"' BuildInfo + ['340' BuildInfo [simple PascalString productUri] [simple PascalString manufacturerName] [simple PascalString productName] [simple PascalString softwareVersion] [simple PascalString buildNumber] [simple int 64 buildDate] - ] - ['"855"' RedundantServerDataType + ['855' RedundantServerDataType [simple PascalString serverId] [simple uint 8 serviceLevel] [simple ServerState serverState] - ] - ['"11945"' EndpointUrlListDataType - [simple int 32 noOfEndpointUrlList] + ['11945' EndpointUrlListDataType + [implicit int 32 noOfEndpointUrlList 'endpointUrlList == null ? -1 : COUNT(endpointUrlList)'] [array PascalString endpointUrlList count 'noOfEndpointUrlList'] - ] - ['"11946"' NetworkGroupDataType + ['11946' NetworkGroupDataType [simple PascalString serverUri] - [simple int 32 noOfNetworkPaths] - - [array ExtensionObjectDefinition('"11945"') networkPaths count 'noOfNetworkPaths'] - + [implicit int 32 noOfNetworkPaths 'networkPaths == null ? -1 : COUNT(networkPaths)'] + [array EndpointUrlListDataType('11945') networkPaths count 'noOfNetworkPaths'] ] - ['"858"' SamplingIntervalDiagnosticsDataType + ['858' SamplingIntervalDiagnosticsDataType [simple float 64 samplingInterval] [simple uint 32 monitoredItemCount] [simple uint 32 maxMonitoredItemCount] [simple uint 32 disabledMonitoredItemCount] - ] - ['"861"' ServerDiagnosticsSummaryDataType + ['861' ServerDiagnosticsSummaryDataType [simple uint 32 serverViewCount] [simple uint 32 currentSessionCount] [simple uint 32 cumulatedSessionCount] @@ -1831,119 +2103,82 @@ [simple uint 32 publishingIntervalCount] [simple uint 32 securityRejectedRequestsCount] [simple uint 32 rejectedRequestsCount] - ] - ['"864"' ServerStatusDataType + ['864' ServerStatusDataType [simple int 64 startTime] [simple int 64 currentTime] [simple ServerState state] - - [simple ExtensionObjectDefinition('"340"') buildInfo] + [simple BuildInfo('340') buildInfo] [simple uint 32 secondsTillShutdown] [simple LocalizedText shutdownReason] - ] - ['"867"' SessionDiagnosticsDataType + ['867' SessionDiagnosticsDataType [simple NodeId sessionId] [simple PascalString sessionName] - - [simple ExtensionObjectDefinition('"310"') clientDescription] + [simple ApplicationDescription('310') clientDescription] [simple PascalString serverUri] [simple PascalString endpointUrl] - [simple int 32 noOfLocaleIds] + [implicit int 32 noOfLocaleIds 'localeIds == null ? -1 : COUNT(localeIds)'] [array PascalString localeIds count 'noOfLocaleIds'] - [simple float 64 actualSessionTimeout] + [simple float 64 actualSessionTimeout] [simple uint 32 maxResponseMessageSize] [simple int 64 clientConnectionTime] [simple int 64 clientLastContactTime] [simple uint 32 currentSubscriptionsCount] [simple uint 32 currentMonitoredItemsCount] [simple uint 32 currentPublishRequestsInQueue] - - [simple ExtensionObjectDefinition('"873"') totalRequestCount] + [simple ServiceCounterDataType('873') totalRequestCount] [simple uint 32 unauthorizedRequestCount] - - [simple ExtensionObjectDefinition('"873"') readCount] - - [simple ExtensionObjectDefinition('"873"') historyReadCount] - - [simple ExtensionObjectDefinition('"873"') writeCount] - - [simple ExtensionObjectDefinition('"873"') historyUpdateCount] - - [simple ExtensionObjectDefinition('"873"') callCount] - - [simple ExtensionObjectDefinition('"873"') createMonitoredItemsCount] - - [simple ExtensionObjectDefinition('"873"') modifyMonitoredItemsCount] - - [simple ExtensionObjectDefinition('"873"') setMonitoringModeCount] - - [simple ExtensionObjectDefinition('"873"') setTriggeringCount] - - [simple ExtensionObjectDefinition('"873"') deleteMonitoredItemsCount] - - [simple ExtensionObjectDefinition('"873"') createSubscriptionCount] - - [simple ExtensionObjectDefinition('"873"') modifySubscriptionCount] - - [simple ExtensionObjectDefinition('"873"') setPublishingModeCount] - - [simple ExtensionObjectDefinition('"873"') publishCount] - - [simple ExtensionObjectDefinition('"873"') republishCount] - - [simple ExtensionObjectDefinition('"873"') transferSubscriptionsCount] - - [simple ExtensionObjectDefinition('"873"') deleteSubscriptionsCount] - - [simple ExtensionObjectDefinition('"873"') addNodesCount] - - [simple ExtensionObjectDefinition('"873"') addReferencesCount] - - [simple ExtensionObjectDefinition('"873"') deleteNodesCount] - - [simple ExtensionObjectDefinition('"873"') deleteReferencesCount] - - [simple ExtensionObjectDefinition('"873"') browseCount] - - [simple ExtensionObjectDefinition('"873"') browseNextCount] - - [simple ExtensionObjectDefinition('"873"') translateBrowsePathsToNodeIdsCount] - - [simple ExtensionObjectDefinition('"873"') queryFirstCount] - - [simple ExtensionObjectDefinition('"873"') queryNextCount] - - [simple ExtensionObjectDefinition('"873"') registerNodesCount] - - [simple ExtensionObjectDefinition('"873"') unregisterNodesCount] - - ] - ['"870"' SessionSecurityDiagnosticsDataType + [simple ServiceCounterDataType('873') readCount] + [simple ServiceCounterDataType('873') historyReadCount] + [simple ServiceCounterDataType('873') writeCount] + [simple ServiceCounterDataType('873') historyUpdateCount] + [simple ServiceCounterDataType('873') callCount] + [simple ServiceCounterDataType('873') createMonitoredItemsCount] + [simple ServiceCounterDataType('873') modifyMonitoredItemsCount] + [simple ServiceCounterDataType('873') setMonitoringModeCount] + [simple ServiceCounterDataType('873') setTriggeringCount] + [simple ServiceCounterDataType('873') deleteMonitoredItemsCount] + [simple ServiceCounterDataType('873') createSubscriptionCount] + [simple ServiceCounterDataType('873') modifySubscriptionCount] + [simple ServiceCounterDataType('873') setPublishingModeCount] + [simple ServiceCounterDataType('873') publishCount] + [simple ServiceCounterDataType('873') republishCount] + [simple ServiceCounterDataType('873') transferSubscriptionsCount] + [simple ServiceCounterDataType('873') deleteSubscriptionsCount] + [simple ServiceCounterDataType('873') addNodesCount] + [simple ServiceCounterDataType('873') addReferencesCount] + [simple ServiceCounterDataType('873') deleteNodesCount] + [simple ServiceCounterDataType('873') deleteReferencesCount] + [simple ServiceCounterDataType('873') browseCount] + [simple ServiceCounterDataType('873') browseNextCount] + [simple ServiceCounterDataType('873') translateBrowsePathsToNodeIdsCount] + [simple ServiceCounterDataType('873') queryFirstCount] + [simple ServiceCounterDataType('873') queryNextCount] + [simple ServiceCounterDataType('873') registerNodesCount] + [simple ServiceCounterDataType('873') unregisterNodesCount] + ] + ['870' SessionSecurityDiagnosticsDataType [simple NodeId sessionId] [simple PascalString clientUserIdOfSession] - [simple int 32 noOfClientUserIdHistory] + [implicit int 32 noOfClientUserIdHistory 'clientUserIdHistory == null ? -1 : COUNT(clientUserIdHistory)'] [array PascalString clientUserIdHistory count 'noOfClientUserIdHistory'] - [simple PascalString authenticationMechanism] + [simple PascalString authenticationMechanism] [simple PascalString encoding] [simple PascalString transportProtocol] [simple MessageSecurityMode securityMode] [simple PascalString securityPolicyUri] [simple PascalByteString clientCertificate] - ] - ['"873"' ServiceCounterDataType + ['873' ServiceCounterDataType [simple uint 32 totalCount] [simple uint 32 errorCount] - ] - ['"301"' StatusResult + ['301' StatusResult [simple StatusCode statusCode] [simple DiagnosticInfo diagnosticInfo] - ] - ['"876"' SubscriptionDiagnosticsDataType + ['876' SubscriptionDiagnosticsDataType [simple NodeId sessionId] [simple uint 32 subscriptionId] [simple uint 8 priority] @@ -1976,149 +2211,86 @@ [simple uint 32 monitoringQueueOverflowCount] [simple uint 32 nextSequenceNumber] [simple uint 32 eventQueueOverFlowCount] - ] - ['"879"' ModelChangeStructureDataType + ['879' ModelChangeStructureDataType [simple NodeId affected] [simple NodeId affectedType] [simple uint 8 verb] - ] - ['"899"' SemanticChangeStructureDataType + ['899' SemanticChangeStructureDataType [simple NodeId affected] [simple NodeId affectedType] - ] - ['"886"' Range + ['886' Range [simple float 64 low] [simple float 64 high] - ] - ['"889"' EUInformation + ['889' EUInformation [simple PascalString namespaceUri] [simple int 32 unitId] [simple LocalizedText displayName] [simple LocalizedText description] - ] - ['"12173"' ComplexNumberType + ['12173' ComplexNumberType [simple float 32 real] [simple float 32 imaginary] - ] - ['"12174"' DoubleComplexNumberType + ['12174' DoubleComplexNumberType [simple float 64 real] [simple float 64 imaginary] - ] - ['"12081"' AxisInformation - - [simple ExtensionObjectDefinition('"889"') engineeringUnits] - - [simple ExtensionObjectDefinition('"886"') eURange] + ['12081' AxisInformation + [simple EUInformation('889') engineeringUnits] + [simple Range('886') eURange] [simple LocalizedText title] [simple AxisScaleEnumeration axisScaleType] - [simple int 32 noOfAxisSteps] + [implicit int 32 noOfAxisSteps 'axisSteps == null ? -1 : COUNT(axisSteps)'] [array float 64 axisSteps count 'noOfAxisSteps'] - ] - ['"12082"' XVType + ['12082' XVType [simple float 64 x] [simple float 32 value] - ] - ['"896"' ProgramDiagnosticDataType + ['896' ProgramDiagnosticDataType [simple NodeId createSessionId] [simple PascalString createClientName] [simple int 64 invocationCreationTime] [simple int 64 lastTransitionTime] [simple PascalString lastMethodCall] [simple NodeId lastMethodSessionId] - [simple int 32 noOfLastMethodInputArguments] - - [array ExtensionObjectDefinition('"298"') lastMethodInputArguments count 'noOfLastMethodInputArguments'] - [simple int 32 noOfLastMethodOutputArguments] - - [array ExtensionObjectDefinition('"298"') lastMethodOutputArguments count 'noOfLastMethodOutputArguments'] - [simple int 64 lastMethodCallTime] - - [simple ExtensionObjectDefinition('"301"') lastMethodReturnStatus] - - ] - ['"24035"' ProgramDiagnostic2DataType + [implicit int 32 noOfLastMethodInputArguments 'lastMethodInputArguments == null ? -1 : COUNT(lastMethodInputArguments)'] + [array Argument('298') lastMethodInputArguments count 'noOfLastMethodInputArguments'] + [implicit int 32 noOfLastMethodOutputArguments 'lastMethodOutputArguments == null ? -1 : COUNT(lastMethodOutputArguments)'] + [array Argument('298') lastMethodOutputArguments count 'noOfLastMethodOutputArguments'] + [simple int 64 lastMethodCallTime] + [simple StatusResult('301') lastMethodReturnStatus] + ] + ['24035' ProgramDiagnostic2DataType [simple NodeId createSessionId] [simple PascalString createClientName] [simple int 64 invocationCreationTime] [simple int 64 lastTransitionTime] [simple PascalString lastMethodCall] [simple NodeId lastMethodSessionId] - [simple int 32 noOfLastMethodInputArguments] - - [array ExtensionObjectDefinition('"298"') lastMethodInputArguments count 'noOfLastMethodInputArguments'] - [simple int 32 noOfLastMethodOutputArguments] - - [array ExtensionObjectDefinition('"298"') lastMethodOutputArguments count 'noOfLastMethodOutputArguments'] - [simple int 32 noOfLastMethodInputValues] + [implicit int 32 noOfLastMethodInputArguments 'lastMethodInputArguments == null ? -1 : COUNT(lastMethodInputArguments)'] + [array Argument('298') lastMethodInputArguments count 'noOfLastMethodInputArguments'] + [implicit int 32 noOfLastMethodOutputArguments 'lastMethodOutputArguments == null ? -1 : COUNT(lastMethodOutputArguments)'] + [array Argument('298') lastMethodOutputArguments count 'noOfLastMethodOutputArguments'] + [implicit int 32 noOfLastMethodInputValues 'lastMethodInputValues == null ? -1 : COUNT(lastMethodInputValues)'] [array Variant lastMethodInputValues count 'noOfLastMethodInputValues'] - [simple int 32 noOfLastMethodOutputValues] + [implicit int 32 noOfLastMethodOutputValues 'lastMethodOutputValues == null ? -1 : COUNT(lastMethodOutputValues)'] [array Variant lastMethodOutputValues count 'noOfLastMethodOutputValues'] - [simple int 64 lastMethodCallTime] + [simple int 64 lastMethodCallTime] [simple StatusCode lastMethodReturnStatus] - ] - ['"893"' Annotation + ['893' Annotation [simple PascalString message] [simple PascalString userName] [simple int 64 annotationTime] - - ] - - ['"811"' DataChangeNotification - [implicit int 32 notificationLength 'lengthInBytes'] - [simple int 32 noOfMonitoredItems] - [array ExtensionObjectDefinition('"808"') monitoredItems count 'noOfMonitoredItems'] - [simple int 32 noOfDiagnosticInfos] - [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"916"' EventNotificationList - [implicit int 32 notificationLength 'lengthInBytes'] - [simple int 32 noOfEvents] - [array ExtensionObjectDefinition('"919"') events count 'noOfEvents'] - ] - ['"820"' StatusChangeNotification - [implicit int 32 notificationLength 'lengthInBytes'] - [simple StatusCode status] - [simple DiagnosticInfo diagnosticInfo] - ] - - ['"316"' UserIdentityToken - [implicit int 32 policyLength 'policyId.lengthInBytes + userIdentityTokenDefinition.lengthInBytes'] - [simple PascalString policyId] - [simple UserIdentityTokenDefinition('policyId.stringValue') userIdentityTokenDefinition] - ] - ] -] - -[discriminatedType UserIdentityTokenDefinition(vstring '-1' identifier) - [typeSwitch identifier - ['"anonymous"' AnonymousIdentityToken - ] - ['"username"' UserNameIdentityToken - [simple PascalString userName] - [simple PascalByteString password] - [simple PascalString encryptionAlgorithm] - ] - ['"certificate"' X509IdentityToken - [simple PascalByteString certificateData] - ] - ['"identity"' IssuedIdentityToken - [simple PascalByteString tokenData] - [simple PascalString encryptionAlgorithm] ] ] ] - [discriminatedType Variant [simple bit arrayLengthSpecified] [simple bit arrayDimensionsSpecified] @@ -2231,38 +2403,55 @@ [array bit arrayDimensions count 'noOfArrayDimensions == null ? 0 : noOfArrayDimensions'] ] +// node type, with two leading reserved bytes +[enum uint 6 NodeIdType + ['0' TwoByte ] + ['1' FourByte ] + ['2' Numeric ] + ['3' String ] + ['4' Guid ] + ['5' ByteString ] +] + [discriminatedType NodeIdTypeDefinition [abstract vstring '-1' identifier] + [abstract int 16 namespace] [discriminator NodeIdType nodeType] [typeSwitch nodeType ['nodeIdTypeTwoByte' NodeIdTwoByte [simple uint 8 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace '-1'] // cause an error ] ['nodeIdTypeFourByte' NodeIdFourByte [simple uint 8 namespaceIndex] [simple uint 16 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeNumeric' NodeIdNumeric [simple uint 16 namespaceIndex] [simple uint 32 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeString' NodeIdString [simple uint 16 namespaceIndex] [simple PascalString id] [virtual vstring '-1' identifier 'id.stringValue'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeGuid' NodeIdGuid [simple uint 16 namespaceIndex] [array byte id count '16'] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeByteString' NodeIdByteString [simple uint 16 namespaceIndex] [simple PascalByteString id] [virtual vstring '-1' identifier 'id.stringValue'] + [virtual int 16 namespace 'namespaceIndex'] ] ] ] @@ -2270,13 +2459,12 @@ [type NodeId [reserved int 2 '0x00'] [simple NodeIdTypeDefinition nodeId] - [virtual vstring '-1' id 'nodeId.identifier'] ] [type PascalString [implicit int 32 sLength 'STATIC_CALL("utf8LengthToPascalLength", stringValue)' ] [virtual int 32 stringLength 'STATIC_CALL("pascalLengthToUtf8Length", sLength)' ] - [simple vstring 'stringLength*8' stringValue ] + [optional vstring 'stringLength*8' stringValue 'sLength != -1'] ] [type PascalByteString @@ -2297,43 +2485,36 @@ // An XML element encoded as a UTF-8 string. [simple int 32 length] [array string 8 value count 'length'] - -] + ] [type TwoByteNodeId [simple uint 8 identifier] - -] + ] [type FourByteNodeId [simple uint 8 namespaceIndex] [simple uint 16 identifier] - -] + ] [type NumericNodeId [simple uint 16 namespaceIndex] [simple uint 32 identifier] - -] + ] [type StringNodeId [simple uint 16 namespaceIndex] [simple PascalString identifier] - -] + ] [type GuidNodeId [simple uint 16 namespaceIndex] [simple GuidValue identifier] - -] + ] [type ByteStringNodeId [simple uint 16 namespaceIndex] [simple PascalByteString identifier] - -] + ] [type DiagnosticInfo // A recursive structure containing diagnostic information associated with a status code. [reserved bit 'false'] @@ -2351,14 +2532,12 @@ [optional PascalString additionalInfo 'additionalInfoSpecified'] [optional StatusCode innerStatusCode 'innerStatusCodeSpecified'] [optional DiagnosticInfo innerDiagnosticInfo 'innerDiagnosticInfoSpecified'] - -] + ] [type QualifiedName // A string qualified with a namespace index. [simple uint 16 namespaceIndex] [simple PascalString name] - -] + ] [type LocalizedText // A string qualified with a namespace index. [reserved uint 6 '0x00'] @@ -2366,8 +2545,7 @@ [simple bit localeSpecified] [optional PascalString locale 'localeSpecified'] [optional PascalString text 'textSpecified'] - -] + ] [type DataValue // A value with an associated timestamp, and quality. [reserved uint 2 '0x00'] @@ -2383,8 +2561,7 @@ [optional uint 16 sourcePicoseconds 'sourcePicosecondsSpecified'] [optional int 64 serverTimestamp 'serverTimestampSpecified'] [optional uint 16 serverPicoseconds 'serverPicosecondsSpecified'] - -] + ] // EnumeratedTypes diff --git a/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java b/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java index 067c97ff137..e429df66cc5 100644 --- a/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java +++ b/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java @@ -46,6 +46,9 @@ public TypeContext getTypeContext() throws GenerationException { LOGGER.info("Parsing: opc-services.mspec"); typeContext = new MessageFormatParser().parse(getMspecStream("opc-services"), typeContext); + LOGGER.info("Parsing: opc-attribute.mspec"); + typeContext = new MessageFormatParser().parse(getMspecStream("opc-attribute"), typeContext); + LOGGER.info("Parsing: opc-status.mspec"); typeContext = new MessageFormatParser().parse(getMspecStream("opc-status"), typeContext); diff --git a/protocols/opcua/src/main/script/downloadAndEditOpcuaNodeSet.groovy b/protocols/opcua/src/main/script/downloadAndEditOpcuaNodeSet.groovy index c80bdc4105e..80aae9b8870 100644 --- a/protocols/opcua/src/main/script/downloadAndEditOpcuaNodeSet.groovy +++ b/protocols/opcua/src/main/script/downloadAndEditOpcuaNodeSet.groovy @@ -96,6 +96,7 @@ download("https://github.com/OPCFoundation/UA-Nodeset/raw/latest/Schema/Opc.Ua.T download("https://github.com/OPCFoundation/UA-Nodeset/raw/latest/Schema/StatusCode.csv", "StatusCode.csv") download("https://github.com/OPCFoundation/UA-Nodeset/raw/latest/Schema/Opc.Ua.NodeSet2.Services.xml", "Opc.Ua.NodeSet2.Services.xml") download("https://github.com/OPCFoundation/UA-Nodeset/raw/latest/Schema/NodeIds.csv", "Opc.Ua.NodeIds.Services.csv") +download("https://github.com/OPCFoundation/UA-Nodeset/raw/latest/Schema/AttributeIds.csv", "AttributeIds.csv") def servicesFile = new File(project.getBasedir(), "target/downloads/Opc.Ua.NodeIds.Services.csv") diff --git a/protocols/opcua/src/main/xslt/opc-attribute.xsl b/protocols/opcua/src/main/xslt/opc-attribute.xsl new file mode 100644 index 00000000000..a4b227dd34d --- /dev/null +++ b/protocols/opcua/src/main/xslt/opc-attribute.xsl @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + file:/// + + + + + + + +/* + * 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 + * + * https://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. + */ + +// Code generated by code-generation. DO NOT EDIT. + + + + + +[enum uint 32 AttributeId + + + + + +] + + \ No newline at end of file diff --git a/protocols/opcua/src/main/xslt/opc-common.xsl b/protocols/opcua/src/main/xslt/opc-common.xsl index b4898480dd6..905513f24e7 100644 --- a/protocols/opcua/src/main/xslt/opc-common.xsl +++ b/protocols/opcua/src/main/xslt/opc-common.xsl @@ -63,9 +63,15 @@ + + + + + + - - ['""' + + @@ -141,8 +147,8 @@ ] - - [INFO] Parsing Structured Datatype - + + [INFO] Parsing Top Level Structured Datatype - @@ -161,29 +167,11 @@ ] - - [INFO] Parsing Structured Datatype - - - - - - [type - - - - - - - 1 - 0 - 0 - -] - - [INFO] Parsing Field - + + [INFO] Parsing Field - of @@ -199,18 +187,22 @@ + + + + + + - - + - @@ -226,50 +218,61 @@ - - [array ('""') count ''] - - [array ('true') count ''] - - [array - - - count ''] - + + + + + + + + + - [ uint '0x00'] - - - [ 'false'] - - + + - [ ''] - + - - [ ('""') ] - - [ ('true') ] - - [ ] + + + + + + + // minus type information + + + + + + + + + + + - + + + + - + - + [INFO] Parsing mspec name - - - + implicit + implicit reserved - optional + optional simple @@ -312,7 +315,6 @@ - bit bit @@ -332,19 +334,23 @@ PascalByteString int 64 PascalString - - + @@ -408,6 +414,7 @@ + @@ -504,9 +511,26 @@ - + - ('""') + + + + + + + ('') + + + + + + + The +2 comes from offset between type definition and binary encoding id. + + + + \ No newline at end of file diff --git a/protocols/opcua/src/main/xslt/opc-manual.xsl b/protocols/opcua/src/main/xslt/opc-manual.xsl index b7ccfb080c5..e5d4d4764b7 100644 --- a/protocols/opcua/src/main/xslt/opc-manual.xsl +++ b/protocols/opcua/src/main/xslt/opc-manual.xsl @@ -75,8 +75,8 @@ [const uint 8 protocolVersion 0] ] -[type OpcuaAPU(bit response) byteOrder='LITTLE_ENDIAN' - [simple MessagePDU('response') message] +[type OpcuaAPU(bit response, bit binaryEncoding) byteOrder='LITTLE_ENDIAN' + [simple MessagePDU('response', 'binaryEncoding') message] ] [enum string 8 ChunkType @@ -94,7 +94,7 @@ ['"MSG"' MESSAGE ] ] -[discriminatedType MessagePDU(bit response) +[discriminatedType MessagePDU(bit response, bit binary) [discriminator string 24 messageType] [simple ChunkType chunk] [implicit uint 32 totalLength 'lengthInBytes'] @@ -111,23 +111,23 @@ ['"OPN"','false' OpcuaOpenRequest (uint 32 totalLength) [simple OpenChannelMessage('response') openRequest] - [simple Payload('false', 'totalLength - openRequest.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - openRequest.lengthInBytes - 16') message] ] ['"OPN"','true' OpcuaOpenResponse (uint 32 totalLength) [simple OpenChannelMessage('response') openResponse] - [simple Payload('false', 'totalLength - openResponse.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - openResponse.lengthInBytes - 16') message] ] ['"CLO"','false' OpcuaCloseRequest [simple SecurityHeader securityHeader ] - [simple Payload('false', '0') message ] + [simple Payload('binary', '0') message ] ] ['"MSG"','false' OpcuaMessageRequest (uint 32 totalLength) [simple SecurityHeader securityHeader ] - [simple Payload('false', 'totalLength - securityHeader.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - securityHeader.lengthInBytes - 16') message] ] ['"MSG"','true' OpcuaMessageResponse (uint 32 totalLength) [simple SecurityHeader securityHeader ] - [simple Payload('false', 'totalLength - securityHeader.lengthInBytes - 16') message] + [simple Payload('binary', 'totalLength - securityHeader.lengthInBytes - 16') message] ] ['"ERR"','true' OpcuaMessageError [simple OpcuaStatusCode error ] @@ -165,13 +165,13 @@ [simple uint 32 secureTokenId] ] -[discriminatedType Payload (bit extensible, uint 32 byteCount) - [simple SequenceHeader sequenceHeader ] - [typeSwitch extensible - ['true' ExtensiblePayload - [simple ExtensionObject('false') payload ] +[discriminatedType Payload (bit binary, uint 32 byteCount) + [simple SequenceHeader sequenceHeader ] + [typeSwitch binary + ['false' ExtensiblePayload + [simple RootExtensionObject('false') payload ] ] - ['false' BinaryPayload + ['true' BinaryPayload [array byte payload count 'byteCount'] ] ] @@ -199,88 +199,54 @@ [simple bit namespaceURISpecified] [simple bit serverIndexSpecified] [simple NodeIdTypeDefinition nodeId] - [virtual vstring '-1' identifier 'nodeId.identifier'] [optional PascalString namespaceURI 'namespaceURISpecified'] [optional uint 32 serverIndex 'serverIndexSpecified'] ] -[type ExtensionHeader - [reserved int 5 '0x00'] - [simple bit xmlbody] - [simple bit binaryBody] -] + [type ExtensionObjectEncodingMask [reserved int 5 '0x00'] [simple bit typeIdSpecified] - [simple bit xmlbody] + [simple bit xmlBody] [simple bit binaryBody] ] -[type ExtensionObject(bit includeEncodingMask) - //A serialized object prefixed with its data type identifier. +[discriminatedType ExtensionObject(bit includeEncodingMask) + [abstract ExtensionObjectDefinition body] [simple ExpandedNodeId typeId] - [optional ExtensionObjectEncodingMask encodingMask 'includeEncodingMask'] - [virtual vstring '-1' identifier 'typeId.identifier'] - [simple ExtensionObjectDefinition('identifier') body] + [virtual int 32 extensionId 'typeId == null ? 0 : STATIC_CALL("extensionId", typeId)'] + [typeSwitch includeEncodingMask + ['false' RootExtensionObject (int 32 extensionId) + [simple ExtensionObjectDefinition('extensionId') body] + ] + ['true' ExtensionObjectWithMask (int 32 extensionId) + [simple ExtensionObjectEncodingMask encodingMask] + [typeSwitch encodingMask.xmlBody, encodingMask.binaryBody + ['false', 'true' BinaryExtensionObjectWithMask + [implicit int 32 bodyLength 'body == null ? 0 : body.lengthInBytes'] + [simple ExtensionObjectDefinition('extensionId') body] + ] + ['false', 'false' NullExtensionObjectWithMask + [virtual ExtensionObjectDefinition('0') body 'null'] + ] + ] + ] + ] ] -[discriminatedType ExtensionObjectDefinition(vstring '-1' identifier) - [typeSwitch identifier - ['"0"' NullExtension +[discriminatedType ExtensionObjectDefinition(int 32 extensionId) + [typeSwitch extensionId + ['0' NullExtension ] - + - - ['"811"' DataChangeNotification - [implicit int 32 notificationLength 'lengthInBytes'] - [simple int 32 noOfMonitoredItems] - [array ExtensionObjectDefinition('"808"') monitoredItems count 'noOfMonitoredItems'] - [simple int 32 noOfDiagnosticInfos] - [array DiagnosticInfo diagnosticInfos count 'noOfDiagnosticInfos'] - ] - ['"916"' EventNotificationList - [implicit int 32 notificationLength 'lengthInBytes'] - [simple int 32 noOfEvents] - [array ExtensionObjectDefinition('"919"') events count 'noOfEvents'] - ] - ['"820"' StatusChangeNotification - [implicit int 32 notificationLength 'lengthInBytes'] - [simple StatusCode status] - [simple DiagnosticInfo diagnosticInfo] - ] - - ['"316"' UserIdentityToken - [implicit int 32 policyLength 'policyId.lengthInBytes + userIdentityTokenDefinition.lengthInBytes'] - [simple PascalString policyId] - [simple UserIdentityTokenDefinition('policyId.stringValue') userIdentityTokenDefinition] - ] ] ] -[discriminatedType UserIdentityTokenDefinition(vstring '-1' identifier) - [typeSwitch identifier - ['"anonymous"' AnonymousIdentityToken - ] - ['"username"' UserNameIdentityToken - [simple PascalString userName] - [simple PascalByteString password] - [simple PascalString encryptionAlgorithm] - ] - ['"certificate"' X509IdentityToken - [simple PascalByteString certificateData] - ] - ['"identity"' IssuedIdentityToken - [simple PascalByteString tokenData] - [simple PascalString encryptionAlgorithm] - ] - ] -] - - [discriminatedType Variant [simple bit arrayLengthSpecified] [simple bit arrayDimensionsSpecified] @@ -393,38 +359,55 @@ [array bit arrayDimensions count 'noOfArrayDimensions == null ? 0 : noOfArrayDimensions'] ] +// node type, with two leading reserved bytes +[enum uint 6 NodeIdType + ['0' TwoByte ] + ['1' FourByte ] + ['2' Numeric ] + ['3' String ] + ['4' Guid ] + ['5' ByteString ] +] + [discriminatedType NodeIdTypeDefinition [abstract vstring '-1' identifier] + [abstract int 16 namespace] [discriminator NodeIdType nodeType] [typeSwitch nodeType ['nodeIdTypeTwoByte' NodeIdTwoByte [simple uint 8 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace '-1'] // cause an error ] ['nodeIdTypeFourByte' NodeIdFourByte [simple uint 8 namespaceIndex] [simple uint 16 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeNumeric' NodeIdNumeric [simple uint 16 namespaceIndex] [simple uint 32 id] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeString' NodeIdString [simple uint 16 namespaceIndex] [simple PascalString id] [virtual vstring '-1' identifier 'id.stringValue'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeGuid' NodeIdGuid [simple uint 16 namespaceIndex] [array byte id count '16'] [virtual vstring '-1' identifier 'id'] + [virtual int 16 namespace 'namespaceIndex'] ] ['nodeIdTypeByteString' NodeIdByteString [simple uint 16 namespaceIndex] [simple PascalByteString id] [virtual vstring '-1' identifier 'id.stringValue'] + [virtual int 16 namespace 'namespaceIndex'] ] ] ] @@ -432,13 +415,12 @@ [type NodeId [reserved int 2 '0x00'] [simple NodeIdTypeDefinition nodeId] - [virtual vstring '-1' id 'nodeId.identifier'] ] [type PascalString [implicit int 32 sLength 'STATIC_CALL("utf8LengthToPascalLength", stringValue)' ] [virtual int 32 stringLength 'STATIC_CALL("pascalLengthToUtf8Length", sLength)' ] - [simple vstring 'stringLength*8' stringValue ] + [optional vstring 'stringLength*8' stringValue 'sLength != -1'] ] [type PascalByteString diff --git a/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml b/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml index 09dd484b99f..84fd77de48d 100644 --- a/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml +++ b/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml @@ -34,101 +34,2048 @@ + + + + false + false + + + HEL + + F + + 47 + + 0 + + + 65535 + 65535 + 2097152 + 64 + + + + + 15 + opc.test://hurz + + + + + + + + + true + false + + + ACK + + F + + 24 + + 0 + + + 65535 + 65535 + 2097152 + 64 + + + + + + + + + false + false + + + OPN + + F + + 132 + + + + + 0 + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + + + -1 + 0x + + + + + -1 + 0x + + + + + + + + + + 1 + 1 + + + + + + + + false + false + + + + 1 + + + 0 + 446 + + + + + + + + + + + + + + + 0 + + + + 0 + + + 0 + + + + + + 0 + 0 + 0 + + + 0 + + + + 60000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0 + + 0 + + + 1 + + + + -1 + 0x + + + 3600000 + + + + + + + + + + + + + + + + true + false + + + OPN + + F + + 135 + + + + + 1 + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + + + -1 + 0x + + + + + -1 + 0x + + + + + + + + + + 1 + 1 + + + + + + + + false + false + + + + 1 + + + 0 + 449 + + + + + + + + + + + + + 133747673145090000 + 0 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0 + + + + 1 + 1 + 133747673145040000 + 3600000 + + + + + + -1 + 0x + + + + + + + + + + + + + + + + + + false + false + + + MSG + + F + + 310 + + + + 1 + 1 + + + + + + + 2 + 2 + + + + + + + + false + false + + + + 1 + + + 0 + 461 + + + + + + + + + + + + + + + 0 + + + + 0 + + + 0 + + + + + + 0 + 1 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + + + + 23 + urn:apache:plc4x:client + + + + + 23 + urn:apache:plc4x:client + + + + + 0 + true + true + + + 2 + en + + + + + 47 + OPCUA client for the Apache PLC4X:PLC4J project + + + + + + 1 + + + + 0 + + + + + + 0 + + + + 0 + + + + + + + + 0 + + + + + + 15 + opc.test://hurz + + + + + 78 + UaSession:OPCUA client for the Apache PLC4X:PLC4J project:xyz + + + + + -1 + 0x + + + + + -1 + 0x + + + 120000.0 + 0 + + + + + + + + + + + + + + + + true + false + + + MSG + + F + + 6450 + + + + 2 + 2 + + + + + + + 2 + 2 + + + + + + + + false + false + + + + 1 + + + 0 + 464 + + + + + + + + + + + + + 133747673167260000 + 1 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + 0 + + + + 3 + + + 1 + + + 44 + Session:9f4a975a-9f74-43f8-8a01-a0b6cc325cc9 + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 120000.0 + + + 32 + 0x64fc10fa00582aa654f211eec59b9b45972d5663511af8917c8c715e1ed58555 + + + + + 1222 + 0x308204c2308203aaa00302010202060192daaf4928300d06092a864886f70d01010b050030763124302206035504030c1b45636c69707365204d696c6f204578616d706c652053657276657231153013060355040a0c0c6469676974616c7065747269310c300a060355040b0c03646576310f300d06035504070c06466f6c736f6d310b300906035504080c024341310b3009060355040613025553301e170d3234313032393233303030305a170d3237313032393232303030305a30763124302206035504030c1b45636c69707365204d696c6f204578616d706c652053657276657231153013060355040a0c0c6469676974616c7065747269310c300a060355040b0c03646576310f300d06035504070c06466f6c736f6d310b300906035504080c024341310b300906035504061302555330820122300d06092a864886f70d01010105000382010f003082010a0282010100bcf039c878db79487e3ce9571d54858e1b46f76476b7a00a8a7eba602a67c06dc924e52b3c6a78bdb6ba1c948490b21954b116128b61caa2c3b1083a81f8459cd42b34e2f672b7703a1016ab19a97c22056caa3bed70e730fa1c0eb00786b47f05012b5a1d4d3716e34c1da8173c91291194f1b38b7dbfc11581ce7e44d93501d81bed0b4daf0d3a6ebcf71d90443439fd95a3bb0574342d9e2e560cc66311c5c89107fd6c90041bf7f8ad4729c67088931268bb7433b70375fd8f301fecd9a27ef8c41c2657f70554398c91846536026baf8dc5a64a2a096a1c97ca5e534f65122d0e2feb78a3dfcd28770b49afbb9ee3ddd85a6c3bd06f81190ef5b82026730203010001a382015430820150301f0603551d230418301680149b1b32655e707e5045c1c755ff716ece6d28ed8930090603551d1304023000300b0603551d0f0404030202f4301d0603551d250416301406082b0601050507030206082b060105050703013081d60603551d110481ce3081cb864575726e3a65636c697073653a6d696c6f3a6578616d706c65733a7365727665723a37386335666137322d373232342d343338362d613263642d3131636630313036636535658204617263688704ac1600018704ac1900018704ac1b000187040a0b14018704ac1d00018704ac1800018704ac1200018704c0a820018704c0a830018704ac1400018704c0a810018704ac1f00018704ac15000187040a0a14018704ac1c00018704c0a8026a8704ac1a00018704ac1e00018704ac1700018704ac1100018704ac130001301d0603551d0e041604149b1b32655e707e5045c1c755ff716ece6d28ed89300d06092a864886f70d01010b050003820101006222edfffd42ca65cd19509f8f6eacbe1479043a3327ed46804fd70c3652845bb2df9961d3a6befb7e5cc46e7cee139607690558d32bde3eb1f60329ce261d44622c61c3078abc187b9e0597db3572c9ea9dc3ff0b2b9c12f6eedb24d417edf69b0b39af4f7c71c18d8d04b8dd3d92f60d20ae507859dc7a68589dee4fef5fb5e5dd1e1a9239a040ea2efbd67a34a6ff6d61460b3c13ae5dfe00c82bc3367909684e577cb41be709632285bce066bdd8802889eabea425845c4d0b500b9ef6de3f19c787eedb15922161bf05ddcd0fa39a32eea264c738f120099f4cdf8b9e74cf1fa354c9f1cfc21d5d9a87e5923425a8e47ada642327d435ce8e7cc6b99e85 + + + 1 + + + + + + 25 + opc.tcp://hurz + + + + + + + + 69 + urn:eclipse:milo:examples:server:78c5fa72-7224-4386-a2cd-11cf0106ce5e + + + + + -1 + + + + + 0 + false + false + + + + 0 + + + + -1 + + + + + -1 + + + -1 + + + + + + -1 + 0x + + + + 1 + + + + 47 + http://opcfoundation.org/UA/SecurityPolicy#None + + + 3 + + + + + + 9 + anonymous + + + + 0 + + + + -1 + + + + + -1 + + + + + -1 + + + + + + + + + 8 + username + + + + 1 + + + + -1 + + + + + -1 + + + + + 51 + http://opcfoundation.org/UA/SecurityPolicy#Basic256 + + + + + + + + + 11 + certificate + + + + 2 + + + + -1 + + + + + -1 + + + + + 51 + http://opcfoundation.org/UA/SecurityPolicy#Basic256 + + + + + + + + 65 + http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary + + + 32 + + + + 0 + + + + + + + + -1 + + + + + -1 + 0x + + + + + + 2097152 + + + + + + + + + + + + + + + + false + false + + + MSG + + F + + 140 + + + + 2 + 2 + + + + + + + 3 + 3 + + + + + + + + false + false + + + + 1 + + + 0 + 467 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 2 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + + + + 0 + + + + + + -1 + 0x + + + + + + -1 + -1 + + + + + false + false + + + + 1 + + + 0 + 321 + + + + + + + + + 0 + false + false + true + + + + 13 + + + + + + 9 + anonymous + + + + + + + + + + + + + + + 0 + + + + + + -1 + 0x + + + + + + + + + + + + + + + + + + + + + true + false + + + MSG + + F + + 96 + + + + 2 + 2 + + + + + + + 3 + 3 + + + + + + + + false + false + + + + 1 + + + 0 + 470 + + + + + + + + + + + + + 133747673167520000 + 2 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + 32 + 0x176c1d0bb34ca7db0a00f71b604d3c06e83930d46e66d8451a6dbe4ab431420b + + + 0 + + + 0 + + + + + + + + + + + + + + + + - Hello Request Response + Read tag - + + + + + + time +
ns=0;i=2258
+
+
+
+
+ + false + false - HEL + MSG F - 47 - - 0 - - - 65535 - 65535 - 2097152 - 64 - - - - - 15 - opc.test://hurz - - - + 131 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 631 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 3 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 0.0 + + 2 + + 1 + + + + + + 0 + + + + 2 + + + 0 + 2258 + + + + + + 13 + + + -1 + + + + + 0 + + + -1 + + + + + + + + + + + + + + + + + - + true + false - ACK + MSG F - 24 - - 0 - - - 65535 - 65535 - 2097152 - 64 - - - + 70 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 634 + + + + + + + + + + + + + 133748547148430000 + 3 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + 0 + false + false + false + false + false + true + + + false + false + 13 + + + 133748547148420000 + + + + + + + + + 0 + + + + + + + + + + + + - + + + + + test_int64 +
ns=2;s=HelloWorld/ScalarTypes/Int64;LINT
+ 1 +
+
+
+
+ + false + false - OPN - - F - 132 - 0 - - - 47 - http://opcfoundation.org/UA/SecurityPolicy#None - - - - - -1 - - - - - - - -1 - - - - - 1 - 1 - 0x0100be010000f068ddb096d5d7010000000000000000ffffffff10270000000000000000000000000001000000ffffffff00512502 - + MSG + + F + + 151 + + + + 2 + 2 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 673 + + + + + + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x6160517155af26284e1e1d4968484405e2d18a00ed6dab32a2ef44c996d86925 + + + + + + + + 0 + 3 + 0 + + + 0 + + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + + + + 0 + + + + 3 + + + 2 + + + 28 + HelloWorld/ScalarTypes/Int64 + + + + + + + + 13 + + + -1 + + + + + 0 + false + false + false + false + false + true + + + false + false + 8 + + + 1 + + + + + + + + + + + + + + + + + + + + + ---> + + + + true + false + + + MSG + + F + + 64 + + + + 10 + 10 + + + + + + + 4 + 4 + + + + + + + + false + false + + + + 1 + + + 0 + 676 + + + + + + + + + + + + + 0 + 3 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ns=2;s=HelloWorld/ScalarTypes/Int64 + Value + LINT + + + + 1 + + + + + + + + + + 1 + + + +
+
diff --git a/protocols/opcua/src/test/resources/protocols/opcua/ParserSerializerTestsuite.xml b/protocols/opcua/src/test/resources/protocols/opcua/ParserSerializerTestsuite.xml new file mode 100644 index 00000000000..049cefe7782 --- /dev/null +++ b/protocols/opcua/src/test/resources/protocols/opcua/ParserSerializerTestsuite.xml @@ -0,0 +1,2102 @@ + + + + + OPCUA + + opcua + read-write + + + OPC UA Node Id + 01004101 + ExpandedNodeId + + + false + false + + + + 1 + + + 0 + 321 + + + + + + + + + OPC UA Extension Object Encoding Mask + 01 + ExtensionObjectEncodingMask + + + 0 + false + false + true + + + + + + OPC UA Anonymous Identity Token + 09000000616e6f6e796d6f7573 + ExtensionObjectDefinition + + 321 + + + + + + + 9 + anonymous + + + + + + + + + + OPC UA Extension Object Anonymous Identity Token + 01004101010d00000009000000616e6f6e796d6f7573 + ExtensionObject + + true + + + + + + false + false + + + + 1 + + + 0 + 321 + + + + + + + + + 0 + false + false + true + + + + 13 + + + + + + 9 + anonymous + + + + + + + + + + + + + OPC UA Activate Session request + 0500002000000084428062123302a3e7470f91899aa477deeab6ba1d83368c8a8e1a5bfffefa6de065de8f04edda010200000000000000ffffffff30750000000000ffffffffffffffff000000000000000001004101010d00000009000000616e6f6e796d6f7573ffffffffffffffff + ExtensionObjectDefinition + + 467 + + + + + + + + + + 0 + + + + 5 + + + 0 + + + 32 + 0x84428062123302a3e7470f91899aa477deeab6ba1d83368c8a8e1a5bfffefa6d + + + + + + + + 133679742810220000 + 2 + 0 + + + -1 + + + 30000 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + + + + + + -1 + + + + + -1 + 0x + + + + + + 0 + + + 0 + + + + + + + false + false + + + + 1 + + + 0 + 321 + + + + + + + + + 0 + false + false + true + + + + 13 + + + + + + 9 + anonymous + + + + + + + + + + + + + + + -1 + + + + + -1 + 0x + + + + + + + + + + + + OPC UA Publish Response Payload (data change) + 20427b9004edda01350000000000000000ffffffff000000010000000100000001000000000100000020427b9004edda010100000001002b03012200000001000000010000000d0620000000f0cc098e04edda017089e98f04edda01000000000000000000000000 + ExtensionObjectDefinition + + 829 + + + + + + + + 133679742820500000 + 53 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 1 + 1 + + 1 + + 0 + false + + + + 1 + 133679742820500000 + 1 + + + + + false + false + + + + 1 + + + 0 + 811 + + + + + + + + + 0 + false + false + true + + + + 34 + + + + 1 + + + + 1 + + + 0 + false + false + true + true + false + true + + + false + false + 6 + + + 32 + + + + + + + 133679742779510000 + 133679742810950000 + + + + + + 0 + + + + + + + + + + + + + 0 + + + 0 + + + + + + + + + OPC UA Publish Response Payload (event notification) + a07f7459ddf3da016c0200000000000000ffffffff0000000300000001000000010000000001000000a07f7459ddf3da010100000001009403012301000003000000050000000b0000000000000f08000000000000000000001a0c06000000536572766572050100110100cd081503000000000d000000526566726573682053746172740d5040e158ddf3da01110100e30a110000050000000b00000001000100000f10000000000000000000001700000000000000120c070000004d794c6576656c05f40111030600070000004d794c6576656c1503000000000e0000004c6576656c2065786365656465640d20110558ddf3da011101000a25110306000d0000004d794c6576656c2e416c61726d050000000b0000000000000f08000000000000000000001b0c06000000536572766572050100110100cd081503000000000b0000005265667265736820456e640d6067e158ddf3da01110100e40a1100000100000000002880ffffffff + ExtensionObjectDefinition + + 829 + + + + + + + + 133687270974980000 + 620 + + + 0 + + + + + false + false + false + false + false + false + false + false + + + -1 + + + + + false + false + + + + 0 + + + 0 + + + + + + + + + 0 + false + false + false + + + + + + + + + + + 3 + 1 + + 1 + + 0 + false + + + + 1 + 133687270974980000 + 1 + + + + + false + false + + + + 1 + + + 0 + 916 + + + + + + + + + 0 + false + false + true + + + + 291 + + + + 3 + + + + 5 + 11 + + + false + false + 0 + + + + + + + false + false + 0 + + + + + + + false + false + 0 + + + + + + + false + false + 15 + + + + 8 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 26 + + + + + + + + + false + false + 12 + + + + 6 + Server + + + + + + + + false + false + 5 + + + 1 + + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 2253 + + + + + + + + + + + false + false + 21 + + + + 0 + true + true + + + 0 + + + + + + 13 + Refresh Start + + + + + + + + + + false + false + 13 + + + 133687270965330000 + + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 2787 + + + + + + + + + + + false + false + 17 + + + + 0 + + + + 0 + + + 0 + + + + + + + + + + + + + + + 5 + 11 + + + false + false + 1 + + 0x00 + + + + + + false + false + 1 + + 0x00 + + + + + + false + false + 0 + + + + + + + false + false + 15 + + + + 16 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 23 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 18 + + + + + + + + + false + false + 12 + + + + 7 + MyLevel + + + + + + + + false + false + 5 + + + 500 + + + + + + + false + false + 17 + + + + 0 + + + + 3 + + + 6 + + + 7 + MyLevel + + + + + + + + + + + + + false + false + 21 + + + + 0 + true + true + + + 0 + + + + + + 14 + Level exceeded + + + + + + + + + + false + false + 13 + + + 133687270950900000 + + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 9482 + + + + + + + + + + + false + false + 17 + + + + 0 + + + + 3 + + + 6 + + + 13 + MyLevel.Alarm + + + + + + + + + + + + + + + + + 5 + 11 + + + false + false + 0 + + + + + + + false + false + 0 + + + + + + + false + false + 0 + + + + + + + false + false + 15 + + + + 8 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 27 + + + + + + + + + false + false + 12 + + + + 6 + Server + + + + + + + + false + false + 5 + + + 1 + + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 2253 + + + + + + + + + + + false + false + 21 + + + + 0 + true + true + + + 0 + + + + + + 11 + Refresh End + + + + + + + + + + false + false + 13 + + + 133687270965340000 + + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 2788 + + + + + + + + + + + false + false + 17 + + + + 0 + + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 2150105088 + + + -1 + + + + + + + OPC UA Notification Message + 010000008084ff018fedda010100000001002b03012200000001000000010000000d062000000000222ffb8eedda0120d592008fedda0100000000 + ExtensionObjectDefinition + + 805 + + + + + 1 + 133680337430480000 + 1 + + + + + false + false + + + + 1 + + + 0 + 811 + + + + + + + + + 0 + false + false + true + + + + 34 + + + + 1 + + + + 1 + + + 0 + false + false + true + true + false + true + + + false + false + 6 + + + 32 + + + + + + + 133680337316160000 + 133680337406580000 + + + + + + 0 + + + + + + + + + + + + + + + + OPC UA Extension Object + 01002b03012200000001000000010000000d062000000000222ffb8eedda0120d592008fedda0100000000 + ExtensionObject + + true + + + + + + false + false + + + + 1 + + + 0 + 811 + + + + + + + + + 0 + false + false + true + + + + 34 + + + + 1 + + + + 1 + + + 0 + false + false + true + true + false + true + + + false + false + 6 + + + 32 + + + + + + + 133680337316160000 + 133680337406580000 + + + + + + 0 + + + + + + + + + + + + + OPC UA Monitored Item Notification + 010000000d062000000000222ffb8eedda0120d592008fedda01 + ExtensionObjectDefinition + + 808 + + + + + 1 + + + 0 + false + false + true + true + false + true + + + false + false + 6 + + + 32 + + + + + + + 133680337316160000 + 133680337406580000 + + + + + + + + + OPC UA Monitoring Parameters + 0500000000000000000000000100d70201910100000b0000000100f9070200000000000b000000416374697665537461746500000200000049640d000000ffffffff0100f9070200000000000a00000041636b6564537461746500000200000049640d000000ffffffff0100f9070200000000000e000000436f6e6669726d6564537461746500000200000049640d000000ffffffff0100f907010000000000070000004576656e7449640d000000ffffffff0100f9070100000000000a000000536f757263654e616d650d000000ffffffff0100f9070100000000000800000053657665726974790d000000ffffffff0100f9070100000000000a000000536f757263654e6f64650d000000ffffffff0100f907010000000000070000004d6573736167650d000000ffffffff0100f9070100000000000400000054696d650d000000ffffffff0100f907010000000000090000004576656e74547970650d000000ffffffff0100de0a0000000001000000ffffffff020000000700000001000000010052020104000000010000000e000000010000000100550201050000001101005508ffffffff00 + ExtensionObjectDefinition + + 742 + + + + + 5 + 0.0 + + + + + false + false + + + + 1 + + + 0 + 727 + + + + + + + + + 0 + false + false + true + + + + 401 + + + + 11 + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 2 + + + 0 + + + 11 + ActiveState + + + + + 0 + + + 2 + Id + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 2 + + + 0 + + + 10 + AckedState + + + + + 0 + + + 2 + Id + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 2 + + + 0 + + + 14 + ConfirmedState + + + + + 0 + + + 2 + Id + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 7 + EventId + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 10 + SourceName + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 8 + Severity + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 10 + SourceNode + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 7 + Message + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 4 + Time + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2041 + + + + + + 1 + + + 0 + + + 9 + EventType + + + + + 13 + + + -1 + + + + + + + + + 0 + + + + 1 + + + 0 + 2782 + + + + + + 0 + + + 1 + + + -1 + + + + + + + + + 2 + + + + + 7 + + 1 + + + + + false + false + + + + 1 + + + 0 + 594 + + + + + + + + + 0 + false + false + true + + + + 4 + + + + 1 + + + + + + + + + + + + + 14 + + 1 + + + + + false + false + + + + 1 + + + 0 + 597 + + + + + + + + + 0 + false + false + true + + + + 5 + + + + + + false + false + 17 + + + + 0 + + + + 1 + + + 0 + 2133 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4294967295 + 0 + false + + + + + + \ No newline at end of file