Am 09.05.2019 um 15:19 schrieb Kevin
Herron:
Titus,
There's no currently any helper for this. If I understand,
next you will call TranslateBrowsePathToNodeId service to get
the NodeId for all the paths you're interested in?
yes
Most people simply store NodeIds as their client
application browses / subscribes and does not store any kind
of path string like you have.
The spec does define a text format for RelativePaths in
part 4 but it is a bit more cumbersome than your format
because it must include support namespace indices and
references. If the SDK were to offer any kind of helper
function in the future it would be for parsing this format.
Yes, ideally this text format is what I was looking for. Meanwhile I
will use my own code now.
Thanks for your help
I
want to get the NodeId for this path string
"MCP/testbed2/drehzahl".
"MCP and "testbed2" are ObjectNodes and "drehzahl" is a
VariableNode, (
Those strings are their browse name).
This is my current code:
private static RelativePath convertToRelativePath(
OpcUaClient
client, String relativeUrl )
throws InterruptedException, ExecutionException {
String urlParts[] = relativeUrl.split( "/" );
ArrayList<RelativePathElement> pathElements = new
ArrayList<>();
for( int i = 0; i < urlParts.length; i++ ) {
pathElements.add( new RelativePathElement(
Identifiers.HierarchicalReferences, false, true,
new QualifiedName( 2, urlParts[ i ] ) ) );
}
RelativePathElement[] pathElementsArray =
pathElements.toArray(
new RelativePathElement[ pathElements.size() ] );
RelativePath rp = new RelativePath( pathElementsArray
);
return rp;
}
|