11#include "open62541pp/config.hpp"
26template <
typename Connection>
44#ifdef UA_ENABLE_ENCRYPTION
129#ifdef UA_ENABLE_ENCRYPTION
133 [[deprecated(
"use ClientConfig constructor and construct Client with ClientConfig")]]
170 [[deprecated(
"use ClientConfig::setTimeout via config() or pass config to Client")]]
175 template <
typename Token>
176 [[deprecated(
"use ClientConfig::setUserIdentityToken via config() or pass config to Client")]]
181 [[deprecated(
"use ClientConfig::setSecurityMode via config() or pass config to Client")]]
223 [[deprecated(
"use Client::setUserIdentityToken(UserNameIdentityToken) instead")]]
243#ifdef UA_ENABLE_SUBSCRIPTIONS
274 detail::ClientContext& context() noexcept;
275 const detail::ClientContext& context() const noexcept;
280 void operator()(
UA_Client* client)
noexcept;
283 std::unique_ptr<detail::ClientContext> context_;
284 std::unique_ptr<UA_Client, Deleter> client_;
292 return (lhs.handle() == rhs.handle());
296 return !(lhs == rhs);
UA_AnonymousIdentityToken wrapper class.
UA_ApplicationDescription wrapper class.
UA_ByteString wrapper class.
ClientConfig(ClientConfig &&other) noexcept
ClientConfig(const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > revocationList={})
Create client config with encryption enabled (PKI).
ClientConfig & operator=(const ClientConfig &)=delete
void setUserIdentityToken(const X509IdentityToken &token)
Set X.509 identity token.
ClientConfig & operator=(ClientConfig &&other) noexcept
void setUserIdentityToken(const IssuedIdentityToken &token)
Set issued identity token.
void setTimeout(uint32_t milliseconds) noexcept
Set response timeout in milliseconds.
ClientConfig(const ClientConfig &)=delete
ClientConfig(UA_ClientConfig &&native)
void setSecurityMode(MessageSecurityMode mode) noexcept
Set message security mode.
void setLogger(LogFunction func)
Set custom log function.
ClientConfig()
Create client config with default configuration (no encryption).
void setUserIdentityToken(const UserNameIdentityToken &token)
Set username/password identity token.
void setUserIdentityToken(const AnonymousIdentityToken &token)
Set anonymous identity token.
void disconnect()
Disconnect and close the connection to the server.
friend detail::ClientContext & detail::getContext(Client &client) noexcept
void setSecurityMode(MessageSecurityMode mode) noexcept
Client(Client &&other) noexcept
UA_Client * handle() noexcept
Node< Client > getViewsNode()
void setUserIdentityToken(const Token &token)
std::vector< Subscription< Client > > getSubscriptions()
Get all active subscriptions.
Client & operator=(const Client &)=delete
Client & operator=(Client &&other) noexcept
Client(const Client &)=delete
void connect(std::string_view endpointUrl, const Login &login)
Connect to the selected server with the given username and password.
void onConnected(StateCallback callback)
Set a state callback that will be called after the client is connected.
std::vector< std::string > getNamespaceArray()
Get all defined namespaces.
Client(ClientConfig &&config)
Create client with given configuration (move ownership to client).
void setTimeout(uint32_t milliseconds) noexcept
void connect(std::string_view endpointUrl)
Connect to the selected server.
std::vector< EndpointDescription > getEndpoints(std::string_view serverUrl)
Gets a list of endpoints of a server.
void onDisconnected(StateCallback callback)
Set a state callback that will be called after the client is disconnected.
Node< Client > getNode(NodeId id)
Client()
Create client with default configuration.
void onSessionActivated(StateCallback callback)
Set a state callback that will be called after the session is activated.
ClientConfig & config() noexcept
void run()
Run the client's main loop by. This method will block until Client::stop is called.
void setLogger(LogFunction logger)
void onInactive(InactivityCallback callback)
Set an inactivity callback.
void setCustomDataTypes(Span< const DataType > dataTypes)
Set custom data types.
void disconnectAsync()
Asynchronously disconnect and close the connection to the server.
Client(const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > revocationList={})
Create client config with encryption enabled (PKI).
void onSessionClosed(StateCallback callback)
Set a state callback that will be called after the session is closed.
bool isConnected() noexcept
Check if client is connected (secure channel open).
Node< Client > getTypesNode()
Subscription< Client > createSubscription(const SubscriptionParameters ¶meters={})
Create a subscription to monitor data changes and events.
void connectAsync(std::string_view endpointUrl)
Asynchronously connect to the selected server.
void runIterate(uint16_t timeoutMilliseconds=1000)
Run a single iteration of the client's main loop.
Node< Client > getObjectsNode()
std::vector< ApplicationDescription > findServers(std::string_view serverUrl)
Gets a list of all registered servers at the given server.
void stop()
Stop the client's main loop.
Node< Client > getRootNode()
bool isRunning() const noexcept
Check if the client's main loop is running.
UA_EndpointDescription wrapper class.
UA_IssuedIdentityToken wrapper class.
High-level node class to access node attribute, browse and populate address space.
View to a contiguous sequence of objects, similar to std::span in C++20.
High-level subscription class.
UA_UserNameIdentityToken wrapper class.
Template base class to wrap native objects.
constexpr const UA_ClientConfig & native() const noexcept
UA_X509IdentityToken wrapper class.
std::function< void()> StateCallback
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
std::function< void(LogLevel, LogCategory, std::string_view msg)> LogFunction
Log function.
std::function< void()> InactivityCallback
bool operator!=(const Client &lhs, const Client &rhs) noexcept
bool operator==(const Client &lhs, const Client &rhs) noexcept
MessageSecurityMode
Message security mode.
Subscription parameters with default values from open62541.