open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
server_minimal.cpp
int main() {
opcua::Server server;
// Add a variable node to the Objects node
opcua::Node myIntegerNode = parentNode.addVariable({1, 1000}, "TheAnswer");
// Write value attribute
myIntegerNode.writeValueScalar(42);
server.run();
}
High-level node class to access node attribute, browse and populate address space.
Definition server.hpp:30
Node & writeValueScalar(const T &value)
Write scalar to variable node.
Definition node.hpp:1168
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
High-level server class.
Definition server.hpp:132
void run()
Run the server's main loop. This method will block until Server::stop is called.