open62541pp 0.18.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
client_minimal.cpp
#include <iostream>
int main() {
opcua::Client client;
client.connect("opc.tcp://localhost:4840");
opcua::Node node(client, opcua::VariableId::Server_ServerStatus_CurrentTime);
const auto dt = node.readValueScalar<opcua::DateTime>();
std::cout << "Server date (UTC): " << dt.format("%Y-%m-%d %H:%M:%S") << std::endl;
}
High-level client class.
Definition client.hpp:126
void connect(std::string_view endpointUrl)
Connect to the selected server.
UA_DateTime wrapper class.
Definition types.hpp:401
std::string format(std::string_view format, bool localtime=false) const
Convert to string with given format (same format codes as strftime).
High-level node class to access node attribute, browse and populate address space.
Definition node.hpp:45
T readValueScalar()
Read scalar value from variable node.
Definition node.hpp:850