Commit 124fe686 authored by oroulet's avatar oroulet

support string NodeId from 1.04 spec. add debug

parent 16c4d7f4
......@@ -124,7 +124,6 @@ def make_structure_code(data_type, struct_name, sdef):
if sdef.StructureType not in (ua.StructureType.Structure, ua.StructureType.StructureWithOptionalFields):
# if sdef.StructureType != ua.StructureType.Structure:
raise NotImplementedError(f"Only StructureType implemented, not {ua.StructureType(sdef.StructureType).name} for node {struct_name} with DataTypdeDefinition {sdef}")
code = f"""
class {struct_name}:
......@@ -133,7 +132,7 @@ class {struct_name}:
{struct_name} structure autogenerated from StructureDefinition object
'''
data_type = ua.NodeId({data_type.Identifier}, {data_type.NamespaceIndex})
data_type = ua.NodeId.from_string("{data_type.to_string()}")
"""
counter = 0
......@@ -219,6 +218,8 @@ async def _generate_object(name, sdef, data_type=None, env=None, enum=False):
code = make_enum_code(name, sdef)
else:
code = make_structure_code(data_type, name, sdef)
print("SDEF", sdef)
print("CODE", code)
logger.debug("Executing code: %s", code)
exec(code, env)
return env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment