open62541pp
0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
server_minimal.cpp
#include <
open62541pp/node.hpp
>
#include <
open62541pp/server.hpp
>
int
main() {
opcua::Server
server;
// Add a variable node to the Objects node
opcua::Node
parentNode(server,
opcua::ObjectId::ObjectsFolder
);
opcua::Node
myIntegerNode = parentNode.
addVariable
({1, 1000},
"TheAnswer"
);
// Write value attribute
myIntegerNode.
writeValueScalar
(42);
server.
run
();
}
opcua::Node
High-level node class to access node attribute, browse and populate address space.
Definition
server.hpp:30
opcua::Node::writeValueScalar
Node & writeValueScalar(const T &value)
Write scalar to variable node.
Definition
node.hpp:1168
opcua::Node::addVariable
Node addVariable(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add variable.
Definition
node.hpp:156
opcua::Server
High-level server class.
Definition
server.hpp:132
opcua::Server::run
void run()
Run the server's main loop. This method will block until Server::stop is called.
opcua::ObjectId::ObjectsFolder
@ ObjectsFolder
node.hpp
server.hpp
Generated by
1.11.0