WellKnownNodes (C)
O C SDK fornece em opcua_node_id.h as macros UA_WELL_* (literais de string de NodeId com valor ns=0); use-as em vez de escrever as strings manualmente para melhorar a legibilidade. Nos demais nós padrão não cobertos pelo SDK, basta escrever diretamente o literal.
acompanhamento
- Consulte a pesquisa reversa do namespace Namespaces.
- Para ler dados por NodeId, consulte Read / Write.
Macros UA_WELL_* fornecidas pelo SDK
/* opcua_node_id.h — Ponto OPC UA padrão (ns=0) */
/* Raiz */
#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"
/* O próprio servidor */
#define UA_WELL_SERVER "i=2253"
#define UA_WELL_SERVER_STATUS "i=2256"
/* ServerStatus Estrutura */
#define UA_WELL_CURRENT_TIME "i=2258"
#define UA_WELL_SERVER_STATE "i=2259"
/* Padrão 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"
Comparação de usos
/* Não recomendado: codificação rígida */
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, "i=2258", UA_ATTR_VALUE, &st);
/* Recomendação: use macros */
#include <opcua_node_id.h>
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, UA_WELL_CURRENT_TIME, UA_ATTR_VALUE, &st);
ServerStatus Exemplo de leitura completa
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]);
/* Formatar por tipo (omitido; consulte a seção Variant para mais detalhes) */
DarraUa_DataValue_Delete(dvs[i]);
}
Lista completa
As linhas com UA_WELL_* são macros fornecidas SDK por ; as demais seguem o padrão OPC UA de NodeId, SDK sem macros, e apresentam literais de string escritos diretamente.
| Nó | NodeId | Significado |
|---|---|---|
| Root | i=84 | UA_WELL_ROOT_FOLDER · Raiz do espaço de endereços |
| Objects | i=85 | UA_WELL_OBJECTS_FOLDER · Base de dados operacionais |
| Types | i=86 | UA_WELL_TYPES_FOLDER · Definição da raiz do tipo |
| Views | i=87 | UA_WELL_VIEWS_FOLDER · Raiz da visualização |
| Server | i=2253 | UA_WELL_SERVER · Objeto do próprio servidor |
| ServerStatus | i=2256 | UA_WELL_SERVER_STATUS · Estrutura do status do servidor |
| ServerStatus.State | i=2259 | UA_WELL_SERVER_STATE · Status (Em execução / Falha / ...) |
| ServerStatus.CurrentTime | i=2258 | UA_WELL_CURRENT_TIME · Hora atual do servidor |
| References | i=31 | UA_WELL_REFERENCES · ReferenceType Raiz |
| HierarchicalReferences | i=33 | UA_WELL_HIERARCHICAL_REFERENCES · Raiz de referência hierárquica |
| 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 | Sem macros do SDK · Tempo de inicialização do servidor |
| ServerStatus.BuildInfo | i=2260 | Sem macro do SDK · Fabricante / Produto / Versão |
| ServerArray | i=2254 | Sem macros do SDK · Matriz do servidor |
| NamespaceArray | i=2255 | Sem macros do SDK · Matriz de espaços de nome |
| HasSubtype | i=45 | Constantes não incluídas no SDK · ReferenceType (escrito à mão "i=45") |
Para os NodeIds padrão completos da OPC UA, veja o Apêndice da OPC UA Parte 6 e as tabelas Opc.Ua.NodeIds.csv fornecidas pela OPC Foundation (válidas em qualquer idioma).