On Tue, Nov 29, 2016 at 9:23 AM, Mario Kostadincev <mario.kostadincev@xxxxxxxxxxxx>
wrote:
Hello all!
I wonder how the building of a hierarchical tree which looks in my case
something like this:
MOpcDir browseNode(int level, MOpcDir mn,
OpcUaClient client, NodeId
browseRoot) {
BrowseDescription
browse = new
BrowseDescription(browseRoot, BrowseDirection.Forward,
Identifiers.References,
true,
uint(NodeClass.Object.getValue() | NodeClass.Variable.getValue()),
uint(BrowseResultMask.All.getValue()));
level++;
try {
BrowseResult browseResult =
client.browse(browse).get();
try {
for (ReferenceDescription rd :
browseResult.getReferences()) {
String n =
rd.getBrowseName().getName();
String t =
rd.getNodeClass().toString();
MOpcDir
currentnode = new
MOpcDir(n);
int lvl= level;
if (t ==
"Object")
{
rd.getNodeId().local().ifPresent(nodeId -> {
// recursively
browse to children
mn.add(browseNode(lvl, currentnode,client, nodeId));
});
}
if (t ==
"Variable")
mn.add(new MOpcVariable(n));
}
} catch (Exception e) {
}
} catch
(InterruptedException | ExecutionException e) {
logger.error("Browsing nodeId={} failed: {}",
browseRoot, e.getMessage(), e);
}
level--;
return mn;
}
...can be transformed by using CompletableFuture to speed-up scanning of a
large OPC structure (currently around 220k elements and takes around 3-4
hours).
Kind regards
Mario Kostadincev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/milo-dev