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
- See Namespace Reverse Lookup Namespaces.
- To NodeId read the data, see Read / Write.
Introduction
use darra_opcua::well_known_nodes;
// Or use wildcards
use darra_opcua::well_known_nodes::*;
Common Root Nodes (Folder)
| Constants | NodeId | Meaning |
|---|---|---|
| ROOT_FOLDER | i=84 | Address Space Root |
| OBJECTS_FOLDER | i=85 | Business Data Root |
| TYPES_FOLDER | i=86 | Type Definition Root |
| VIEWS_FOLDER | i=87 | View Root |
| OBJECT_TYPES_FOLDER | i=88 | Object Type Root |
| VARIABLE_TYPES_FOLDER | i=89 | Variable Type Root |
| DATA_TYPES_FOLDER | i=90 | Data Type Root |
| REFERENCE_TYPES_FOLDER | i=91 | Reference Type Root |
Server Status
| Constants | NodeId | Meaning |
|---|---|---|
| SERVER | i=2253 | The Server Object Itself |
| SERVER_SERVER_ARRAY | i=2254 | ServerArray Array of Strings |
| SERVER_NAMESPACE_ARRAY | i=2255 | NamespaceArray Array of Strings |
| SERVER_SERVER_STATUS | i=2256 | Server Status Structure |
| SERVER_SERVER_STATUS_START_TIME | i=2257 | Server Startup Time |
| SERVER_SERVER_STATUS_CURRENT_TIME | i=2258 | Current server time |
| SERVER_SERVER_STATUS_STATE | i=2259 | Status (Running / Failed / ...) |
| SERVER_SERVER_STATUS_BUILD_INFO | i=2260 | BuildInfo (Product / Manufacturer / Version) |
| SERVER_SERVER_STATUS_BUILD_INFO_PRODUCT_NAME | i=2261 | Product Name |
| SERVER_SERVER_STATUS_BUILD_INFO_PRODUCT_URI | i=2262 | Products URI |
| SERVER_SERVER_STATUS_BUILD_INFO_MANUFACTURER | i=2263 | Manufacturer Name |
| SERVER_SERVER_STATUS_BUILD_INFO_SOFTWARE_VERSION | i=2264 | Version |
| SERVER_SERVER_STATUS_BUILD_INFO_BUILD_NUMBER | i=2265 | BuildNumber |
| SERVER_SERVER_STATUS_BUILD_INFO_BUILD_DATE | i=2266 | BuildDate |
| SERVER_SERVER_STATUS_SECONDS_TILL_SHUTDOWN | i=2992 | Seconds remaining until closing |
| SERVER_SERVER_STATUS_SHUTDOWN_REASON | i=2993 | Reason for Closure |
Standards ReferenceType
| Constants | NodeId |
|---|---|
| REFERENCES | i=31 |
| NON_HIERARCHICAL_REFERENCES | i=32 |
| HIERARCHICAL_REFERENCES | i=33 |
| HAS_CHILD | i=34 |
| ORGANIZES | i=35 |
| HAS_EVENT_SOURCE | i=36 |
| HAS_MODELLING_RULE | i=37 |
| HAS_ENCODING | i=38 |
| HAS_DESCRIPTION | i=39 |
| HAS_TYPE_DEFINITION | i=40 |
| HAS_PROPERTY | i=46 |
| HAS_COMPONENT | i=47 |
Standards DataType
| Constants | NodeId |
|---|---|
| BASE_DATA_TYPE | i=24 |
| BOOLEAN | i=1 |
| SBYTE | i=2 |
| BYTE | i=3 |
| INT16 | i=4 |
| UINT16 | i=5 |
| INT32 | i=6 |
| UINT32 | i=7 |
| INT64 | i=8 |
| UINT64 | i=9 |
| FLOAT | i=10 |
| DOUBLE | i=11 |
| STRING | i=12 |
| DATE_TIME | i=13 |
| GUID | i=14 |
| BYTE_STRING | i=15 |
| XML_ELEMENT | i=16 |
| NODE_ID_TYPE | i=17 |
| STATUS_CODE | i=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.