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

load_data_type_definitions: Accept OptionSet / Enumeration defined via StructureDefinition #1383

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

loehnertj
Copy link
Contributor

See #1381:

On one server, it was observed that OptionSets are defined using a StructureDefinition instead of EnumDefinition as suggested by the standard.

This PR enables load_enums to parse such definitions and create the enum class.

Point of discussion: Since StructureField has no means of specifying the member value, it is inferred from the index of the field within the fields array:

  • Enum: Count 1, 2, 3, ..
  • OptionSet: assign to bit 0, 1, 2, .. i.e. flag value 0x1, 0x2, 0x4, ...

Includes test.

Also tested against Tani Server 2.7.3 -> observed problem is fixed.

…StructureDefinition instance.

This kind of type definition is "unclean" but not strictly forbidden by the standard.
Requires guessing of actual enum values:
- Count starting at 1 for Enums
- 0x1, 0x2, 0x4, ... for OptionSet
@oroulet oroulet merged commit 11aac01 into FreeOpcUa:master Aug 4, 2023
5 checks passed
Dimfred pushed a commit to Dimfred/opcua-asyncio that referenced this pull request Sep 19, 2023
…a StructureDefinition (FreeOpcUa#1383)

* When reading Enumeration and OptionSet type definitions, also accept StructureDefinition instance.

This kind of type definition is "unclean" but not strictly forbidden by the standard.
Requires guessing of actual enum values:
- Count starting at 1 for Enums
- 0x1, 0x2, 0x4, ... for OptionSet

* add test for OptionSet defined via StructureDefinition
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

Successfully merging this pull request may close these issues.

2 participants