WellKnownNodes (C)
The C SDK uses the UA_WELL_* macros from opcua_node_id.h (NodeId string literals whose value is ns=0) to improve readability by replacing hand-written strings. For other standard nodes that the SDK does not override, just write the literal directly.
Supporting
- See Namespace Reverse Lookup Namespaces.
- To NodeId read the data, see Read / Write.
SDK Available UA_WELL_* macros
/* opcua_node_id.h — Standard OPC UA Node (ns=0) */
/* Root */
#define UA_WELL_ROOT_FOLDER "i=84"
#define UA_WELL_OBJECTS_FOLDER "i=85"
#define UA_WELL_TYPES_FOLDER "i=86"
#define UA_WELL_VIEWS_FOLDER "i=87"
/* The server itself */
#define UA_WELL_SERVER "i=2253"
#define UA_WELL_SERVER_STATUS "i=2256"
/* ServerStatus Structure */
#define UA_WELL_CURRENT_TIME "i=2258"
#define UA_WELL_SERVER_STATE "i=2259"
/* Standards ReferenceType */
#define UA_WELL_REFERENCES "i=31"
#define UA_WELL_HIERARCHICAL_REFERENCES "i=33"
#define UA_WELL_ORGANIZES "i=35"
#define UA_WELL_HAS_TYPE_DEFINITION "i=40"
#define UA_WELL_HAS_PROPERTY "i=46"
#define UA_WELL_HAS_COMPONENT "i=47"
Comparison of Usage
/* Not recommended: Hard-coding */
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, "i=2258", UA_ATTR_VALUE, &st);
/* Recommended: Use macros */
#include <opcua_node_id.h>
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, UA_WELL_CURRENT_TIME, UA_ATTR_VALUE, &st);
ServerStatus Complete Read Example
const char* nodes[] = {
UA_WELL_SERVER_STATE,
UA_WELL_CURRENT_TIME,
UA_WELL_SERVER_STATUS,
UA_WELL_SERVER,
};
DarraUa_DataValue* dvs[4] = { NULL };
DarraUa_Session_ReadNodes(h, nodes, NULL, 4, dvs);
for (int i = 0; i < 4; ++i) {
if (!dvs[i]) continue;
const DarraUa_Variant* v = DarraUa_DataValue_GetValue(dvs[i]);
printf("%-30s -> ", nodes[i]);
/* Format by Type (omitted; see the section Variant for details) */
DarraUa_DataValue_Delete(dvs[i]);
}
Complete List
Lines preceded UA_WELL_* by are macros provided SDK by; the rest are standard OPC UA NodeId, where no SDK macros are provided, so string literals are written directly.
| Node | NodeId | Meaning |
|---|---|---|
| Root | i=84 | UA_WELL_ROOT_FOLDER · Address Space Root |
| Objects | i=85 | UA_WELL_OBJECTS_FOLDER · Business Data Root |
| Types | i=86 | UA_WELL_TYPES_FOLDER · Type Definition Root |
| Views | i=87 | UA_WELL_VIEWS_FOLDER · View Root |
| Server | i=2253 | UA_WELL_SERVER · The Server object itself |
| ServerStatus | i=2256 | UA_WELL_SERVER_STATUS · Server Status Structure |
| ServerStatus.State | i=2259 | UA_WELL_SERVER_STATE · Status (Running / Failed / ...) |
| ServerStatus.CurrentTime | i=2258 | UA_WELL_CURRENT_TIME · Current server time |
| References | i=31 | UA_WELL_REFERENCES · ReferenceType Root |
| HierarchicalReferences | i=33 | UA_WELL_HIERARCHICAL_REFERENCES · Root of hierarchical references |
| Organizes | i=35 | UA_WELL_ORGANIZES · ReferenceType |
| HasTypeDefinition | i=40 | UA_WELL_HAS_TYPE_DEFINITION · ReferenceType |
| HasProperty | i=46 | UA_WELL_HAS_PROPERTY · ReferenceType |
| HasComponent | i=47 | UA_WELL_HAS_COMPONENT · ReferenceType |
| ServerStatus.StartTime | i=2257 | SDK No Macros · Server Startup Time |
| ServerStatus.BuildInfo | i=2260 | SDK No Macro · Manufacturer / Product / Version |
| ServerArray | i=2254 | SDK No Macros · Server-Side Arrays |
| NamespaceArray | i=2255 | SDK No Macros · Namespace Arrays |
| HasSubtype | i=45 | SDK Unlisted constants · ReferenceType (handwritten "i=45") |
For the complete OPC UA standard NodeIds, see the OPC UA Part 6 appendix and the Opc.Ua.NodeIds.csv table provided by the OPC Foundation (applicable across languages).