open62541pp 0.19.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 parentNode{server, opcua::ObjectId::ObjectsFolder};
opcua::Node myIntegerNode = parentNode.addVariable({1, 1000}, "TheAnswer");
// Write value attribute
myIntegerNode.writeValue(opcua::Variant{42});
server.run();
}
High-level node class to access node attribute, browse and populate address space.
Definition node.hpp:45
Node & writeValue(const Variant &value)
Write the AttributeId::Value attribute of a node.
Definition node.hpp:1155
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:142
void run()
Run the server's main loop. This method will block until Server::stop is called.
UA_Variant wrapper class.
Definition types.hpp:1048