This works so far, but now I have nodes with it that contain umlauts. For these I get BadNoMatch as a result.
The code looks like this:
Code: Select all
UaBrowsePaths browsePaths;
UaRelativePathElements pathElements;
OpcUa_UInt32 browseCount = 0;
browsePaths.create(static_cast<OpcUa_UInt32>(_list.size()));
for (NodeList::iterator i = _list.begin(); i != _list.end(); i++) {
gwNode* node = (*i);
OpcUa_UInt32 pathCount = 0;
gwNode* ptr;
for (ptr = node; ptr != _srv; ptr = ptr->Getparent()) {
if (_stop && (ptr == _stop))
break;
if ((ptr->Getgwn() == GWN_OPCUANODE) || (ptr->Getgwn() == GWN_OPCUAFOLDER) || (ptr->Getgwn() == GWN_FOLDER))
pathCount++;
if (ptr->Getgwn() == GWN_OPCUAITM) {
if ((ptr == node) || _stop)
pathCount++;
else
break;
}
}
_nodeid.copyTo(&browsePaths[browseCount].StartingNode);
pathElements.create(pathCount);
for (ptr = node; ptr != _srv; ptr = ptr->Getparent()) {
if ((ptr->Getgwn() == GWN_OPCUAITM) || (ptr->Getgwn() == GWN_OPCUANODE) || (ptr->Getgwn() == GWN_OPCUAFOLDER) || (ptr->Getgwn() == GWN_FOLDER)) {
pathCount--;
pathElements[pathCount].IncludeSubtypes = OpcUa_True;
pathElements[pathCount].IsInverse = OpcUa_False;
pathElements[pathCount].ReferenceTypeId.Identifier.Numeric = OpcUaId_HierarchicalReferences;
[b]OpcUa_String_AttachReadOnly(&pathElements[pathCount].TargetName.Name, ptr->GetName());[/b]
pathElements[pathCount].TargetName.NamespaceIndex = _nodeid.namespaceIndex();
if (pathCount == 0)
break;
}
}
browsePaths[browseCount].RelativePath.NoOfElements = pathElements.length();
browsePaths[browseCount].RelativePath.Elements = pathElements.detach();
browseCount++;
}
UaDiagnosticInfos diagnosticInfos;
ServiceSettings serviceSettings;
UaBrowsePathResults browsePathResults;
UaStatus status = p_Session->translateBrowsePathsToNodeIds(serviceSettings, browsePaths, browsePathResults, diagnosticInfos);
OpcUa_String_AttachReadOnly(&pathElements[pathCount].TargetName.Name, ptr->GetName());
I have already tried conversion to utf8 or utf16, but then I also get errors.
Kind Regards,
Arthur