WellKnownNodes (C)
C SDK 매크로 UA_WELL_* (값이 ns=0인 NodeId 문자열 리터럴)를 opcua_node_id.h 제공하며, 직접 문자열을 작성하는 대신 매크로를 사용하여 가독성을 높입니다.SDK 재정의되지 않은 다른 표준 노드의 경우, 리터럴을 직접 작성하면 됩니다.
세트
- 네임스페이스 역조회는 다음을 참조하십시오. Namespaces.
- 데이터 NodeId 읽기에 대해서는 다음을 참조하십시오. Read / Write.
SDK 제공되는 UA_WELL_* 매크로
/* opcua_node_id.h — 표준 OPC UA 노드 (ns=0) */
/* 뿌리 */
#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"
/* 서버 자체 */
#define UA_WELL_SERVER "i=2253"
#define UA_WELL_SERVER_STATUS "i=2256"
/* ServerStatus 구조 */
#define UA_WELL_CURRENT_TIME "i=2258"
#define UA_WELL_SERVER_STATE "i=2259"
/* 표준 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"
사용법 비교
/* 권장하지 않음: 하드코딩 */
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, "i=2258", UA_ATTR_VALUE, &st);
/* 추천: 매크로 사용 */
#include <opcua_node_id.h>
DarraUa_DataValue* dv = DarraUa_Session_ReadNode(
h, UA_WELL_CURRENT_TIME, UA_ATTR_VALUE, &st);
ServerStatus 전체 읽기 예시
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]);
/* 유형별로 서식 지정 (생략, 자세한 내용은 Variant 절 참조) */
DarraUa_DataValue_Delete(dvs[i]);
}
전체 목록
가 포함된 UA_WELL_* 행은 SDK 에서 제공하는 매크로이며, 나머지는 OPC UA 표준에 NodeId따라 매크로를 SDK 지정하지 않고 문자열 리터럴을 직접 작성한 것입니다.
| 노드 | NodeId | 의미 |
|---|---|---|
| Root | i=84 | UA_WELL_ROOT_FOLDER · 주소 공간의 루트 |
| Objects | i=85 | UA_WELL_OBJECTS_FOLDER · 업무 데이터 루트 |
| Types | i=86 | UA_WELL_TYPES_FOLDER · 유형 정의 루트 |
| Views | i=87 | UA_WELL_VIEWS_FOLDER · 뷰 루트 |
| Server | i=2253 | UA_WELL_SERVER · Server 자체 객체 |
| ServerStatus | i=2256 | UA_WELL_SERVER_STATUS · 서버 상태 구조 |
| ServerStatus.State | i=2259 | UA_WELL_SERVER_STATE · 상태 (실행 중 / 실패 / ...) |
| ServerStatus.CurrentTime | i=2258 | UA_WELL_CURRENT_TIME · 서버의 현재 시간 |
| References | i=31 | UA_WELL_REFERENCES · ReferenceType 뿌리 |
| HierarchicalReferences | i=33 | UA_WELL_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 매크로 없음 · 서버 시작 시간 |
| ServerStatus.BuildInfo | i=2260 | SDK 무홍 · 제조사 / 제품 / 버전 |
| ServerArray | i=2254 | SDK 매크로 없음 · 서버 측 배열 |
| NamespaceArray | i=2255 | SDK 매크로 없음 · 네임스페이스 배열 |
| HasSubtype | i=45 | SDK 수록되지 않은 상수 · ReferenceType (손글씨 "i=45") |
전체 OPC UA 표준 NodeId 자세한 내용은 OPC UA Part 6. 부록 및 OPC Foundation 제공된 Opc.Ua.NodeIds.csv 표(다국어 공통)를 참조하십시오.