Skip to main content

well_known_nodes

darra_opcua::well_known_nodes Module-defined NodeId string constants for standard OPC Foundation nodes. Use these instead of writing them manually to improve i=2258 code readability.

Supporting

Introduction​

use darra_opcua::well_known_nodes;
// Or use wildcards
use darra_opcua::well_known_nodes::*;

Common Root Nodes (Folder)​

ConstantsNodeIdMeaning
ROOT_FOLDERi=84Address Space Root
OBJECTS_FOLDERi=85Business Data Root
TYPES_FOLDERi=86Type Definition Root
VIEWS_FOLDERi=87View Root
OBJECT_TYPES_FOLDERi=88Object Type Root
VARIABLE_TYPES_FOLDERi=89Variable Type Root
DATA_TYPES_FOLDERi=90Data Type Root
REFERENCE_TYPES_FOLDERi=91Reference Type Root

Server Status​

ConstantsNodeIdMeaning
SERVERi=2253The Server Object Itself
SERVER_SERVER_ARRAYi=2254ServerArray Array of Strings
SERVER_NAMESPACE_ARRAYi=2255NamespaceArray Array of Strings
SERVER_SERVER_STATUSi=2256Server Status Structure
SERVER_SERVER_STATUS_START_TIMEi=2257Server Startup Time
SERVER_SERVER_STATUS_CURRENT_TIMEi=2258Current server time
SERVER_SERVER_STATUS_STATEi=2259Status (Running / Failed / ...)
SERVER_SERVER_STATUS_BUILD_INFOi=2260BuildInfo (Product / Manufacturer / Version)
SERVER_SERVER_STATUS_BUILD_INFO_PRODUCT_NAMEi=2261Product Name
SERVER_SERVER_STATUS_BUILD_INFO_PRODUCT_URIi=2262Products URI
SERVER_SERVER_STATUS_BUILD_INFO_MANUFACTURERi=2263Manufacturer Name
SERVER_SERVER_STATUS_BUILD_INFO_SOFTWARE_VERSIONi=2264Version
SERVER_SERVER_STATUS_BUILD_INFO_BUILD_NUMBERi=2265BuildNumber
SERVER_SERVER_STATUS_BUILD_INFO_BUILD_DATEi=2266BuildDate
SERVER_SERVER_STATUS_SECONDS_TILL_SHUTDOWNi=2992Seconds remaining until closing
SERVER_SERVER_STATUS_SHUTDOWN_REASONi=2993Reason for Closure

Standards ReferenceType​

ConstantsNodeId
REFERENCESi=31
NON_HIERARCHICAL_REFERENCESi=32
HIERARCHICAL_REFERENCESi=33
HAS_CHILDi=34
ORGANIZESi=35
HAS_EVENT_SOURCEi=36
HAS_MODELLING_RULEi=37
HAS_ENCODINGi=38
HAS_DESCRIPTIONi=39
HAS_TYPE_DEFINITIONi=40
HAS_PROPERTYi=46
HAS_COMPONENTi=47

Standards DataType​

ConstantsNodeId
BASE_DATA_TYPEi=24
BOOLEANi=1
SBYTEi=2
BYTEi=3
INT16i=4
UINT16i=5
INT32i=6
UINT32i=7
INT64i=8
UINT64i=9
FLOATi=10
DOUBLEi=11
STRINGi=12
DATE_TIMEi=13
GUIDi=14
BYTE_STRINGi=15
XML_ELEMENTi=16
NODE_ID_TYPEi=17
STATUS_CODEi=19

Namespace Constants​

use darra_opcua::well_known_nodes::well_known_namespaces;

well_known_namespaces::OPC_FOUNDATION; // "http://opcfoundation.org/UA/" (ns=0)
well_known_namespaces::DI; // "http://opcfoundation.org/UA/DI/"

Usage​

use darra_opcua::well_known_nodes;

// Not recommended: Hard-coding
let dv = s.read("i=2258")?;

// Recommendation: Use constants
let dv = s.read(well_known_nodes::SERVER_SERVER_STATUS_CURRENT_TIME)?;

ServerStatus Read in Full​

use darra_opcua::{well_known_nodes, AttributeId};

let nodes = [
well_known_nodes::SERVER_SERVER_STATUS_STATE,
well_known_nodes::SERVER_SERVER_STATUS_CURRENT_TIME,
well_known_nodes::SERVER_SERVER_STATUS_START_TIME,
well_known_nodes::SERVER_NAMESPACE_ARRAY,
];
let values = s.read_many(&nodes, AttributeId::Value)?;

if let Some(Some(state)) = values.first() {
println!("State = {:?}", state.variant());
}
if let Some(Some(curr)) = values.get(1) {
println!("CurrentTime = {:?}", curr.source_timestamp());
}
if let Some(Some(start)) = values.get(2) {
println!("StartTime = {:?}", start.source_timestamp());
}
if let Some(Some(ns)) = values.get(3) {
println!("Namespaces = {:?}", ns.variant());
}

Complete List​

Check the source files for the module darra_opcua::well_known_nodes in the code (cargo doc you can view them there as well). OPC Foundation All commonly used nodes under the standard namespace are there.

Next Step​