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

Use NodeSet2.xml Definition fields instead of .bsd files for datatype generator #2587

Open
Pro opened this issue Mar 20, 2019 · 3 comments
Open
Assignees
Labels
Component: Nodeset Compiler Issues related to the nodeset compiler help wanted

Comments

@Pro
Copy link
Member

Pro commented Mar 20, 2019

Currently we require Types.bsd files for the datatype_generator.py to generate the corresponding custom datatypes.

In newer NodeSets, the DataType Definition is stored inside the NodeSet2.xml. (e.g. see #2582)

We should use this Definition instead of the .bsd files.
This can be achieved by changing the nodeset_compiler in a way, that it also creates the types files, since it already parses all the information. For this the current datatype_generator.py code should be merged into the nodeset compiler.


The .bsd file is used for creating the custom structs and datatypes for this specific nodeset.
If the nodeset does not define any custom data types, you can also skip the whole datatype generation.
This is done e.g. for the PLCopen nodeset here:
https://github.com/open62541/open62541/blob/master/examples/nodeset/CMakeLists.txt#L94

If your nodeset defines custom datatypes, currently a .bsd file is required. If it is not given with the .xml file, there are two ways to get it:

  • you can extract it's content from the huge base64 encoded byte string in the NodeSet2.xml (use some online converter)
  • you can use UaModeler: Open the NodeSet2.xml, confirm that it should be converted, and then just export it again. With this, UaModeler will also export a .bsd file
@jpfr
Copy link
Member

jpfr commented Mar 20, 2019

We could move generate_datatypes.py as a method into the nodeset compiler.
So that it takes the raw string as input and not a file.
Then, generate_datatypes.py can remain as a standalone wrapper for those with existing .bsd files.

Can we keep the .bsd files for the builtin types baked into the library?
I find it quite educational to show the xml.

@Pro
Copy link
Member Author

Pro commented Mar 20, 2019

We could move generate_datatypes.py as a method into the nodeset compiler.
So that it takes the raw string as input and not a file.

Maybe we can have the following solution:

Provide a command line switch datatypes-source which allows to select options how the datatypes should be generated:

  • bsd Use the .bsd file which is passed as another parameter
  • encoded Use the base64 encoded string inside the NodeSet2.xml
  • definition Use the definition tags of each DataType

Like this we support old Nodesets, and also newer ones which do not come with a .bsd file and also without a base64 encoded type definition.
Also we can keep our builtin types definition as .bsd.

@Lo-TW
Copy link

Lo-TW commented Sep 8, 2021

you can use UaModeler: Open the NodeSet2.xml, confirm that it should be converted, and then just export it again. With this, UaModeler will also export a .bsd file

Hi @Pro,
I download UaModeler Version 1.6.5 472, and I try this way.

  1. The UaModeler can't open xml file directly.
  2. If I open a project, UaModeler can export xml and export NodeIds(csv) only.

How to export the bsd file in the UaModeler?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Nodeset Compiler Issues related to the nodeset compiler help wanted
Projects
None yet
Development

No branches or pull requests

4 participants