示例#1
0
 def _translate_browsepath_to_nodeid(self, path):
     self.logger.debug("looking at path: %s", path)
     res = ua.BrowsePathResult()
     if path.StartingNode not in self._aspace:
         res.StatusCode = ua.StatusCode(ua.StatusCodes.BadNodeIdInvalid)
         return res
     current = path.StartingNode
     for el in path.RelativePath.Elements:
         nodeid = self._find_element_in_node(el, current)
         if not nodeid:
             res.StatusCode = ua.StatusCode(ua.StatusCodes.BadNoMatch)
             return res
         current = nodeid
     target = ua.BrowsePathTarget()
     target.TargetId = current
     target.RemainingPathIndex = 4294967295
     res.Targets = [target]
     return res
示例#2
0
 def _translate_browsepath_to_nodeid(self, path):
     self.logger.debug("looking at path: %s", path)
     res = ua.BrowsePathResult()
     if not path.RelativePath.Elements[-1].TargetName:
         # OPC UA Part 4: Services, 5.8.4 TranslateBrowsePathsToNodeIds
         # it's unclear if this the check should also handle empty strings
         res.StatusCode = ua.StatusCode(ua.StatusCodes.BadBrowseNameInvalid)
         return res
     if path.StartingNode not in self._aspace:
         res.StatusCode = ua.StatusCode(ua.StatusCodes.BadNodeIdInvalid)
         return res
     current = path.StartingNode
     for el in path.RelativePath.Elements:
         nodeid = self._find_element_in_node(el, current)
         if not nodeid:
             res.StatusCode = ua.StatusCode(ua.StatusCodes.BadNoMatch)
             return res
         current = nodeid
     target = ua.BrowsePathTarget()
     target.TargetId = current
     target.RemainingPathIndex = 4294967295
     res.Targets = [target]
     return res