Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for example: Decoding of custom structure dataType values with variable length components #769

Open
hbrackel opened this issue Feb 11, 2025 · 0 comments

Comments

@hbrackel
Copy link

I kindly request an example of (client side) encoding and decoding of an extension object, containing a custom structure datatype value with potentially variable length components.

Many thanks!

Simple Example (pseudo code):

type MyCustomStructure structure {
  NodeAID *ua.NodeId
  NodeBID *ua.NodeId
  Message string
  LowerBound time.Time
  UpperBound time.Time
}
// let's assume, there is a custom OPC UA structure DataType matching MyCustomStructure definition
// the nodeId of the dataType is 
dataTypeID := NewNumericNodeId(123, 4456)

structDef := *ua.StructureDefinition...  // the structure definition of the custom dataType has already been read

// encoding
value := MyCustomStructure{ ... }
variant := ua.MustVariant(????).  // Variant to contain the binary encoded ExtensionObject of a value

// decoding
extObjWithCustomValue := .... // this is the extensionObject to be decoded; the encoding and dataType have been checked

// ???? how do I get the field values from the extension object, when field values have upfront unknown length

@hbrackel hbrackel changed the title Request for example: Decoding of custom structure dataType values Request for example: Decoding of custom structure dataType values with variable length components Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant