Commit 3b30f433 authored by oroulet's avatar oroulet Committed by oroulet

export xml in struct example (jsut for easier testing debug)

parent ca0d9f2f
......@@ -18,16 +18,16 @@ async def main():
uri = 'http://examples.freeopcua.github.io'
idx = await server.register_namespace(uri)
await new_struct(server, idx, "MyStruct", [
snode1, _ = await new_struct(server, idx, "MyStruct", [
new_struct_field("MyBool", ua.VariantType.Boolean),
new_struct_field("MyUInt32List", ua.VariantType.UInt32, array=True),
])
await new_struct(server, idx, "MyOptionalStruct", [
snode2, _ = await new_struct(server, idx, "MyOptionalStruct", [
new_struct_field("MyBool", ua.VariantType.Boolean),
new_struct_field("MyUInt32List", ua.VariantType.UInt32, array=True),
new_struct_field("MyInt64", ua.VariantType.Int64, optional=True),
])
await new_enum(server, idx, "MyEnum", [
enode = await new_enum(server, idx, "MyEnum", [
"titi",
"toto",
"tutu",
......@@ -35,13 +35,15 @@ async def main():
await server.load_data_type_definitions()
await server.nodes.objects.add_variable(idx, "my_enum", ua.MyEnum.toto)
valnode = await server.nodes.objects.add_variable(idx, "my_enum", ua.MyEnum.toto)
await server.nodes.objects.add_variable(idx, "my_struct", ua.Variant(ua.MyStruct(), ua.VariantType.ExtensionObject))
my_struct_optional = ua.MyOptionalStruct()
my_struct_optional.MyUInt32List = [45, 67]
my_struct_optional.MyInt64 = -67
await server.nodes.objects.add_variable(idx, "my_struct_optional", ua.Variant(my_struct_optional, ua.VariantType.ExtensionObject))
await server.export_xml([server.nodes.objects, server.nodes.root, snode1, snode2, enode, valnode], "structs_and_enum.xml")
async with server:
while True:
await asyncio.sleep(1)
......
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