Why the node can't be gotten?

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
guolin
Hero Member
Hero Member
Posts: 24
Joined: 10 Jul 2014, 10:49

Why the node can't be gotten?

Post by guolin »

Hello, Why I can't get the node in the override of aftaerStartup of MyBANodeManagerNodeSetXml, where I wan to add my variables to be historied.
UaNodeId(6025,,getNameSpaceIndex()) return a NULL node but acutually the node is existing in the xml based UANodeSet.

UaStatus MyBANodeManagerNodeSetXml::afterStartUp()
{
UaStatus ret;
m_pHistoryManager->pHistoryServerCapabilities()->setAccessHistoryDataCapability(OpcUa_True);
m_pHistoryManager->addVariableToHistorize(getNode(UaNodeId(6025,,getNameSpaceIndex())));
m_pHistoryManager->startUp(m_pServerManager);
return ret;
}



Thanks!
Guolin

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Why the node can't be gotten?

Post by Support Team »

Hello Guolin,

the afterStartUp() method is called directly after the MyNodeManagerNodeSetXml is started.
After that the server loads the address space from the xml file. So the node does not exist jet when you try to add the node to historizing.
You could put the code to add a variable to historizing into the NodeManagerNodeSetXml::variableCreated().
The example in the DemoServer uses this mechanism to initialize certain values on variables - see MyNodeManagerNodeSetXml::variableCreated.

Best regards

Unified Automation Support Team

guolin
Hero Member
Hero Member
Posts: 24
Joined: 10 Jul 2014, 10:49

Re: Why the node can't be gotten?

Post by guolin »

Thanks!

Now I do it in NodeManagerNodeSetXml::variableCreated(). while in HistoryManagerBuildingAutomation::startUp(), "dataMonitoredItems.m_createResult.isGood()" is not Good other than a "BadNodeIdUnknown".
The NodeId does really exist in the NodeSet.

What is the possible reason?

Post Reply