OpcUa types: BSD enumerated types have different sizes and are not binary Enumerations
Description
In the script scripts/gen-sopc-types.py
the BSD EnumeratedType are all considered as binary Enumerations (Int32 encoding) whereas it is not the case since a LengthInBits
attribute is provided for each type defined.
Part 4 (1.04) - E.2.4:
EnumeratedType An EnumeratedType describes a binary-encoded numeric value that has a fixed set of valid values. The encoded binary value described by an EnumeratedType is always an unsigned integer with a length specified by the LengthInBits attribute.
Note that this is even contradictory with part 6 because some of of the 32 bits enumerated types, encoded as UInt32 due to above definition, defined in BSD are actually subtypes of enumeration data type in NodeSet2 which are Int32 due to part 6 enumeration definition. This means that only works because those enumerations have the same representation on Uint32 and Int32 encoding (value included between 0 and max(Int32)).
Analysis
The script scripts/gen-sopc-types.py
shall manage the LengthInBits
field or should be reworked to use the non-deprecated way to defined datatype content using Definition tag in NodeSet2 without using the BSD format.
A temporary workaround might be to replace all non-enumeration encoded like EnumeratedType by the actual unsigned integer type in BSD file for the nodeset 0 data types and any other models used with the current script.