Commit 82b5bf20 authored by oroulet's avatar oroulet Committed by oroulet

fix default QualifiedName value

parent 398a45c1
...@@ -606,14 +606,14 @@ class QualifiedName: ...@@ -606,14 +606,14 @@ class QualifiedName:
NamespaceIndex: UInt16 = 0 NamespaceIndex: UInt16 = 0
Name: String = "" Name: String = ""
def __init__(self, Name="MISSING_NAME", NamespaceIndex=0): def __init__(self, Name=None, NamespaceIndex=0):
self.Name = Name self.Name = Name
self.NamespaceIndex = NamespaceIndex self.NamespaceIndex = NamespaceIndex
if isinstance(self.NamespaceIndex, str) and isinstance(self.Name, int): if isinstance(self.NamespaceIndex, str) and isinstance(self.Name, int):
# originally the order or argument was inversed, try to support it # originally the order or argument was inversed, try to support it
logger.warning("QualifiedName are str, int, while int, str is expected, swithcing") logger.warning("QualifiedName are str, int, while int, str is expected, swithcing")
if not isinstance(self.NamespaceIndex, int) or not isinstance(self.Name, str): if not isinstance(self.NamespaceIndex, int) or not isinstance(self.Name, (str, type(None))):
raise ValueError(f"QualifiedName constructore args have wrong types, {self}") raise ValueError(f"QualifiedName constructore args have wrong types, {self}")
def to_string(self): def to_string(self):
......
...@@ -19,6 +19,7 @@ async def main(): ...@@ -19,6 +19,7 @@ async def main():
url = "opc.tcp://localhost:53530/OPCUA/SimulationServer/" url = "opc.tcp://localhost:53530/OPCUA/SimulationServer/"
# url = "opc.tcp://olivier:olivierpass@localhost:53530/OPCUA/SimulationServer/" # url = "opc.tcp://olivier:olivierpass@localhost:53530/OPCUA/SimulationServer/"
async with Client(url=url) as client: async with Client(url=url) as client:
await client.load_data_type_definitions()
print("Root children are", await client.nodes.root.get_children()) print("Root children are", await client.nodes.root.get_children())
......
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