Example #1
0
 def get_child(self, path):
     """
     get a child specified by its path from this node.
     A path might be:
     * a string representing a qualified name.
     * a qualified name
     * a list of string
     * a list of qualified names
     """
     if type(path) not in (list, tuple):
         path = [path]
     rpath = ua.RelativePath()
     for item in path:
         el = ua.RelativePathElement()
         el.ReferenceTypeId = ua.TwoByteNodeId(
             ua.ObjectIds.HierarchicalReferences)
         el.IsInverse = False
         el.IncludeSubtypes = True
         if isinstance(item, ua.QualifiedName):
             el.TargetName = item
         else:
             el.TargetName = ua.QualifiedName.from_string(item)
         rpath.Elements.append(el)
     bpath = ua.BrowsePath()
     bpath.StartingNode = self.nodeid
     bpath.RelativePath = rpath
     result = self.server.translate_browsepaths_to_nodeids([bpath])
     result = result[0]
     result.StatusCode.check()
     # FIXME: seems this method may return several nodes
     return Node(self.server, result.Targets[0].TargetId)
Example #2
0
    def get_children_descriptions(self,
                                  refs=ua.ObjectIds.HierarchicalReferences,
                                  nodeclassmask=ua.NodeClass.Unspecified,
                                  includesubtypes=True):
        desc = ua.BrowseDescription()
        desc.BrowseDirection = ua.BrowseDirection.Forward
        desc.ReferenceTypeId = ua.TwoByteNodeId(refs)
        desc.IncludeSubtypes = includesubtypes
        desc.NodeClassMask = nodeclassmask
        desc.ResultMask = ua.BrowseResultMask.All

        desc.NodeId = self.nodeid
        params = ua.BrowseParameters()
        params.NodesToBrowse.append(desc)
        results = self.server.browse(params)
        return results[0].References
Example #3
0
 def get_objects_node(self):
     return self.get_node(ua.TwoByteNodeId(ua.ObjectIds.ObjectsFolder))
Example #4
0
 def get_server_node(self):
     return self.get_node(ua.TwoByteNodeId(ua.ObjectIds.Server))
Example #5
0
 def get_root_node(self):
     return self.get_node(ua.TwoByteNodeId(ua.ObjectIds.RootFolder))