10#include "open62541pp/config.hpp"
47#ifdef UA_ENABLE_ENCRYPTION
166 config().addCustomDataTypes(dataTypes);
218#ifdef UA_ENABLE_SUBSCRIPTIONS
221 [[deprecated(
"use Subscription constructor")]]
246 detail::ClientContext& context() noexcept;
247 const detail::ClientContext& context() const noexcept;
249 friend detail::ClientContext& detail::getContext(
Client& client) noexcept;
252 void operator()(
UA_Client* client)
noexcept;
255 std::unique_ptr<detail::ClientContext> context_;
256 std::unique_ptr<UA_Client, Deleter> client_;
266 return (lhs.handle() == rhs.handle());
271 return !(lhs == rhs);
UA_ByteString wrapper class.
ClientConfig(const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > revocationList={})
Create client config with encryption enabled (PKI).
ClientConfig(UA_ClientConfig &&native) noexcept
void setTimeout(uint32_t milliseconds) noexcept
Set response timeout in milliseconds.
ClientConfig(const ClientConfig &)=delete
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).
ClientConfig(ClientConfig &&) noexcept=default
void addCustomDataTypes(Span< const DataType > types)
Add custom data types.
void setUserIdentityToken(const AnonymousIdentityToken &token)
Set anonymous identity token.
void disconnect()
Disconnect and close the connection to the server.
Client(Client &&other) noexcept
Client & operator=(const Client &)=delete
Client & operator=(Client &&other) noexcept
Client(const Client &)=delete
Client(UA_Client *native)
Create client from native instance (move ownership to client).
void onConnected(StateCallback callback)
Set a state callback that will be called after the client is connected.
bool operator!=(const Client &lhs, const Client &rhs) noexcept
Client(ClientConfig &&config)
Create client with given configuration (move ownership to client).
bool operator==(const Client &lhs, const Client &rhs) noexcept
void connect(std::string_view endpointUrl)
Connect to the selected server.
void onDisconnected(StateCallback callback)
Set a state callback that will be called after the client is disconnected.
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
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.
std::vector< Subscription< Client > > subscriptions()
Get all active subscriptions.
void onInactive(InactivityCallback callback)
Set an inactivity callback.
void disconnectAsync()
Asynchronously disconnect and close the connection to the server.
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).
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.
void onSubscriptionInactive(SubscriptionInactivityCallback callback)
Set a subscription inactivity callback.
void stop()
Stop the client's main loop.
bool isRunning() const noexcept
Check if the client's main loop is running.
UA_DataType wrapper class.
View to a contiguous sequence of objects, similar to std::span in C++20.
High-level subscription class.
Template base class to wrap (native) objects.
constexpr UA_ClientConfig * handle() noexcept
Return pointer to native object.
constexpr const UA_ClientConfig & native() const noexcept
UA_AnonymousIdentityToken wrapper class.
UA_ApplicationDescription wrapper class.
UA_EndpointDescription wrapper class.
UA_IssuedIdentityToken wrapper class.
UA_UserNameIdentityToken wrapper class.
UA_X509IdentityToken wrapper class.
MessageSecurityMode
Message security mode.
uint32_t IntegerId
IntegerId.
std::function< void(IntegerId subscriptionId)> SubscriptionInactivityCallback
std::function< void()> StateCallback
std::function< void(LogLevel, LogCategory, std::string_view msg)> LogFunction
Log function.
std::function< void()> InactivityCallback
static void clear(UA_ClientConfig &config) noexcept
static UA_ClientConfig move(UA_ClientConfig &&config) noexcept
static UA_ClientConfig copy(const UA_ClientConfig &config)
Default type handler providing standard copy and move operations.
Subscription parameters with default values from open62541.