Skip to main content

Nodes (C)

The C SDK has no C# NodeCollection / OpcUaNode lazy-load wrapper class; every node access is calling the API directly with a NodeId string.

Subpage Redirect
  • C#: For information on how to emulate ua.Nodes indexers in C, please refer to NodeCollection.
  • C#: For information on how to simulate a single-node OpcUaNode wrapper in C, please refer to OpcUaNode.
  • For single-level browsing, please see Browse.
  • To continue reading, please see the next page. BrowseNext.
  • For a template implementing a complete traversal, please refer to Browse Automatic Pagination.
  • For batch parsing of paths, please refer to TranslateBrowsePaths.
  • For high-frequency access acceleration, please refer to RegisterNodes.

Three Ways to Access Nodes​

/* Method 1: Direct NodeId string (simplest, most efficient RPC) */
DarraUa_Status st = 0;
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, "ns=2;s=Temperature", UA_ATTR_VALUE, &st);

/* Method 2: Browse through the text first, then NodeId read it (exploratory approach) */
DarraUa_BrowseResult* br = NULL;
DarraUa_Session_BrowseNode(h, "i=85", UA_NODE_CLASS_UNSPECIFIED, &br);
/* Find the matching BrowseName child, retrieve its NodeId string, and then call Read */

/* Method 3: Path Resolution (layer by layer Browse, one segment at a time RPC) */
char buf[128];
DarraUa_Session_ResolveBrowsePath(
h, "i=85", "/Server/ServerStatus/CurrentTime", buf, (int32_t)sizeof(buf));
/* Return 1 = success; "i=2258" is stored in buf; Return 0 = failure */

All three methods are based on Read / Service Browse; just choose the one that feels most natural to you. The more path segments there are, the more round trips Method 3 will require—please use batch paths. TranslateBrowsePaths (RPC Translated in one go).

Selection Guide​

ScenarioRecommendations
Known to be accurate NodeId (Production Code)Method 1: String
Standard ns=0 NodeMethod 1 + WellKnownNodes Hong
Browse Tree / One-Time ScriptMethod 2: BrowseNode
Batch Initialization of Multiple PathsTranslateBrowsePaths
Long-term operation with high-frequency accessRegisterNodes Accelerate

Next Step​