Skip to content

Commit

Permalink
Merge pull request #578 from ASNeG/577_unknown_nodes_in_create_object…
Browse files Browse the repository at this point in the history
…_instance

handle unknwon list nodes in create object instance service
  • Loading branch information
huebl authored Aug 22, 2023
2 parents 7978997 + d7c0345 commit 6d8ec4c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/OpcUaStackServer/InformationModel/ObjectInstanceBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,21 @@ namespace OpcUaStackServer
auto baseNodeClassChildTemplate = childBaseNodeClassVec[idx];
OpcUaQualifiedName browseName = *childBaseNodeClassVec[idx]->getBrowseName();

// only nodes with modelling rules are allowed
// only nodes with modeling rules are allowed
OpcUaNodeId modellingRule;
if (!baseNodeClassChildTemplate->referenceItemMap().getHasModellingRule(modellingRule)) {
continue;
}

// Check if node is optional
if (modellingRule == OpcUaNodeId(OpcUaId_ModellingRule_OptionalPlaceholder)) {
// ignore optional list elements
std::string browseNameString = browseName.name().toStdString();
if (!browseNameString.empty()) {
if (browseNameString[0] == '<' && browseNameString[browseNameString.size()-1] == '>') continue;
}
}

// handle childs of node
browseNames.pathNames()->set(size, boost::make_shared<OpcUaQualifiedName>(browseName));
BaseNodeClass::SPtr nodeClassChild = createNodeAndClilds(*nodeClass->getNodeId(), baseNodeClassChildTemplate, browseNames);
Expand Down

0 comments on commit 6d8ec4c

Please sign in to comment.