From 1cf169edbcdd05c32721aa63265d9027225e7297 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 30 Aug 2024 20:41:01 +0200 Subject: [PATCH] feat: support nested structures. --- asyncua/common/structures104.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asyncua/common/structures104.py b/asyncua/common/structures104.py index a67f8fe37..2d4daf940 100644 --- a/asyncua/common/structures104.py +++ b/asyncua/common/structures104.py @@ -213,6 +213,8 @@ class {struct_name}{base_class}: uatype = ua.basetype_by_datatype[sfield.DataType] elif sfield.DataType == data_type: uatype = struct_name + elif sfield.DataType != data_type and isinstance(sfield, ua.uaprotocol_auto.StructureField): + uatype = "uaprotocol_auto.StructureField" #field name is also a structure else: if log_error: _logger.error("Unknown datatype for field: %s in structure:%s, please report", sfield, struct_name) @@ -260,6 +262,7 @@ def {name}(self, value: {uatype}) -> None: else: for fname, uatype, default_value in fields: code += f" {fname}: {uatype} = {default_value}\n" + print(f"testprint: structure {fname} has Python class {code}") return code